-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Expose the ability to add a local wheel through the CLI. #1038
Conversation
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 sounds like a good idea. John gets back tomorrow and will probably have some good thoughts on this.
pex/bin/pex.py
Outdated
help="Add a wheel distribution (.whl) from a local path into the generated .pex file." | ||
" This option can be used multiple times.", |
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.
Might be helpful to explain more about the expectation. Can this be a .whl
file, or it should be an expanded folder?
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.
Relative path or absolute path?
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 think the fact that the metavar says it should be a file is enough to distinguish that it isn't an expanded folder, and the fact that the .whl suffix is suggested. I'll make a change to indicate it can be relative or absolute, and to canonicalize any relative paths.
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.
Actually the PEXBuilder.add_dist_location
method that does the work here already deals with relative paths. I'll change the comment.
Is this not already possible? e.g. with: > pex --find-links "$(dirname my-requirement-2.0.0-py2-py3.whl)" my-requirement==2.0.0 |
Good point Danny. See the blue tool tip in https://www.pantsbuild.org/docs/python-third-party-dependencies#basic-setup about how to install from local files in general with Pex. |
(Will re-approve if we find this solves something we can't yet do)
@Eric-Arellano @cosmicexplorer The main difference I see is that the -w option is supposed to be to stuff some .whl into the pex without invoking the pex resolver. Passing the requirement specifier and a --find-links still has pex run its resolver for that requirement, which I want to avoid. And the pex will fail to build if any of the |
I see the PEP440 direct references in the tooltip you suggested. That combined with --no-transitive works for me. Thanks! |
Oh -- thanks for pointing that out! Glad that the use case is still already supported ^_^ |
Thanks to all for realizing this was an existing feature. The feature actually predates using Pip (where Pex gained support for PEP-440). Since Pip supports a non-PEP'd local path just like Pex used to before adopting Pip internally, this always worked without interuption during the Pip transition. So long ago (two years ago to the day in this example), you could do the simplest thing imaginable:
Just like you can today:
|
Because you were kind enough to provide that excellent description, I want to put it on the record that PEP440 direct references don't support relative paths like pex. So I just resorted to using the example you gave. This issue pypa/pip#6658 seems to be at the core of it and pip hasn't addressed it yet. Hopefully they will and PEX and pip can standardize on direct references. |
Pex already has the ability to add distributions from pre downloaded locations. This change will allow users to use wheel resolving and caching strategies outside of the pex, and then build canonically formed PEXes from external requirement sets.