chriskuehl / dumb-pypi

PyPI generator, backed entirely by static files

Home Page:https://chriskuehl.github.io/dumb-pypi/test-repo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature] allow execution via `python -m dumb_pypi`

masenf opened this issue · comments

This is a common pattern used by python libraries that expose a cli and it makes it a bit easier to reason about what interpreter will be used to run the module.

For example, if I run /path/to/my/venv/bin/python -m dumb_pypi and venv doesn't have dumb-pypi installed, then I definitely get an error, even if I have dumb-pypi installed locally or in the system.

If I run dumb_pypi and my current environment doesn't have it installed, it might find the command somewhere else, unexpected.

From the cli, I could just as easily run /path/to/my/venv/bin/dumb-pypi, however from python code, it's much cleaner to use the subprocess.run([sys.executable, "-m", "dumb_pypi"]) pattern, so that I know the code is only digging into modules visible from the same python interpreter, rather than the system path.

I will send a PR, if you want this feature.

You should be able to use python -m dumb_pypi.main

Thanks

@chriskuehl @asottile also, thanks for the project, it's exactly what I needed 👍