openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

Calling the generator from cli works with different syntax from documentation

Open rodigu opened this issue 7 months ago • 2 comments

Describe the bug

Calling from cli using the suggested method with python -m does not work.

python -m openapi-python-client --version
PATH_TO_PYTHON\python.exe: No module named openapi-python-client

Using underscores, however, does work (python -m openapi_python_client -version):

python -m openapi_python_client --version
openapi-python-client version: 0.24.3

OpenAPI Spec File

Not applicable

Desktop (please complete the following information):

  • OS: Windows 11 (Microsoft Windows NT 10.0.26100.0)
  • Python Version: [e.g. 3.12.7]
  • openapi-python-client version [e.g. 0.24.3]

Additional context

Running from a powershell instance in VSCode with a conda environment selected as a Python interpreter.

Would it be possible to add a line to the documentation mentioning the call with python -m?

rodigu avatar May 28 '25 12:05 rodigu

Sure, definitely not opposed. I'm curious why/when someone would opt for python -m openapi_python_client over running openapi-python-client, though, so we can add some guidance?

dbanty avatar Jun 01 '25 23:06 dbanty

I use pyenv and have several versions of python installed. The top answer to this Stack Overflow question surmises the scenario I find myself in: https://stackoverflow.com/questions/50821312/what-is-the-effect-of-using-python-m-pip-instead-of-just-pip

I admit that thinking further about it now, it does feel like a fairly niche "issue of my own creation."

rodigu avatar Jun 02 '25 12:06 rodigu