-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add 'pipx run' entry point #217
feat: Add 'pipx run' entry point #217
Conversation
pyproject.toml
Outdated
[project.entry-points."pipx.run"] | ||
id = "id.__main__:entrypoint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.f. https://github.com/pypa/build/blob/3c25681123fa1b3af58855eb43204f0de006561a/pyproject.toml#L83-L84 as an example elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for linking this! I have no idea pipx run
had its own entrypoint namespace, so this was helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only learned about it from @henryiii in the last 12 hours. :)
id/__main__.py
Outdated
def entrypoint() -> None: | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly required as one could imagine just using
"id.__main__:main"
in pyproject.toml
but this allows for subtle decoupling between entrypoint
and main
if desired, like build
has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@di might have a different opinion, but IMO it's okay to have this just be main
instead -- I don't think we have a plan/foreseen need for decoupling the two, so YAGNI applies 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with it just being main
as well!
@woodruffw @di This is ready for review. Let me know if you have any questions, and if this isn't of interest feel free to just close it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @matthewfeickert, this is great! I left one comment about the entrypoint (which @di can override).
/gcbrun |
* Allows for running the equivalent of 'python -m id' with 'pipx run id'.
926c2e2
to
67a93df
Compare
Force pushed to cleanup linting — sorry missed that. I'll wait for Dustin's feedback before making any final changes to |
/gcbrun |
python -m id
withpipx run id
.Example: