[feature] Support pipx run with different name in entry point natively if a package wants to support it
See original GitHub issueHow would this feature be useful?
Currently, running pipx run build
does not work; it requires pipx run --spec build pyproject-build
. It would not be safe to add a build
script entry point to pypa/build
, due to how common that name would be. It would be nice to have a way for a package to tell pipx run “here’s my entry point, use this”. I know the author of pypa/build (@FFY00) was interested in supporting pipx (and pipx run build
would be fantastic, imo). This affects projects with a common or unsafe name for an entry point.
Describe the solution you’d like These are some initial ideas:
- If a matching console entry point is not found,
pipx run
could fall back onpython -m <name>
if<name>/__main__.py
is present. - There could be a pipx entry point in a package. Say
"pipx.run.<name>"
. If this was specified, then that would be used by run. (I’m not very familiar with non-console entry points, but I think this is a valid way to use them) - Have a dict in pipx for common packages. (probably not a good idea? If #596 went through, then one could argue that build, also being in the PyPA, would be a valid candidate for special treatment. This doesn’t solve the issue generally, though)
These ideas would allow a package that supports pipx to have a dependency that supports pipx and not trip up the discovery.
Describe alternatives you’ve considered
This potentially would be a useful alternative to https://github.com/pipxproject/pipx/issues/177. I really like the idea of pipx run -m
, as it would let me do things like pipx run -m rich
, since rich
so far has resisted adding an entry point and is python -m rich.<stuff>
only.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (11 by maintainers)
Top GitHub Comments
This was completed in #615 and released in 0.16, and is now even available on all the GitHub Actions runners! 😃
Makes sense. I may find some time to implement this and see how it works in practice.