-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support multiple abi
and platform
values for pip download
.
#8820
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
Conversation
9bb8b2e
to
1b5aa8b
Compare
Would it be better to make the options
|
+1 on making it an |
I don’t think backward compatibility would be an issue either way, since comma is not a valid character in wheel tags anyway 🙂 |
I was thinking about the name change (e.g. platform -> platforms) but I guess we can keep an alias if we're to go with the comma-separated list. |
Thanks for the guidance! This is my first would-be contribution to pip, so I'm a bit unfamiliar with internal stylistic conventions - Will look at |
@uranusjr I pushed the |
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.
Sorry for the delay. Just one nitpick on the help message, otherwise this looks good to me. Thanks for the effort!
02cf555
to
d091260
Compare
@uranusjr No problem, and thanks for taking a look! I've addressed your feedback, and have added a couple of elementary functional test-cases. Let me know if you have any other points of concern, whether you'd like to see broader test coverage, or whether things look good to you as-is. Thanks again for your time! |
@uranusjr Thanks for the review and approval! As this is my first time contributing to |
Friendly ping 🙂 |
91a0cc5
to
c12157d
Compare
@uranusjr @pradyunsg Wanted to ping this again - I had to rebase and resolve some conflicts yesterday, following other changes that were merged. Would be nice to get this in, to avoid doing so repeatedly. Still a bit unclear as to whether we're waiting on other steps (e.g. additional reviews) before merging. Some clarification on the usual process would be appreciated. Thanks in advance! |
Usually, we wait on a couple of reviews or have the primary reviewer be fairly certain that things will work. I'm personally not super comfortable around ABI tags and if/how we should expose them to the end user, so I'm not comfortable reviewing this (and considering the implications of this change) myself. :) @uranusjr if you reckon this is good to go, I'm happy to merge. |
Wheel tags are difficult, but these flags are designed as explicit overrides and the user has always been responsible for keeping the values straight, so I don’t think this PR has much chance to go wrong, actually. I think it’d be fine including this in 20.3. |
if platforms and len(platforms) == 1: | ||
# Only expand list of platforms if a single platform was provided. | ||
# Otherwise, assume that the list provided is comprehensive. | ||
platforms = _get_custom_platforms(platforms[0]) |
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.
Why not call _get_custom_platforms
on all provided platforms
?
I'd find it strange that pip download --platform manylinux2010 foobar
would successfully find a manylinux1_x86_64
wheel but pip download --platform manylinux2010 --platform manylinux2014 foobar
wouldn't.
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.
@xavfernandez I think this is a bit tricky.
I think it's reasonable to assume that anybody providing multiple --platform
invocations is a fairly expert user, who is targeting a particular python interpreter different than the one through which pip
is running. Therefore, the user should be the authority on what is and is not supported.
There may be edge-cases in which manylinux2014
wheels are acceptable, but manylinux1
wheels are not. For instance, the manylinux2014
and manylinux2010
specifications don't allow for binaries to link against the ncurses
library, whereas manylinux1
does allow this library. If a user knows that their target environment does not provide ncurses
, then they might write
pip download \
--platform manylinux2014 --platform manylinux2010 --platform any \
--abi cp39m --abi abi3 --abi none \
--python-version 39 \
--no-deps \
hiredis==0.3.1
To avoid downloading wheels built for manylinux1
.
This won't be an issue for most users, but it could come up in more complex deployments (e.g. large monorepos), which (I think) is the setting in which this feature is most likely to be useful.
What do you think? We could always add platform-expansion here later - It's probably more difficult to take it back, afterwards.
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.
Another question is one of precedence. Given the following two commands:
1. pip download --platform manylinux2014_x86_64 --platform linux_x86_64 foobar==0.1.0
2. pip download --platform manylinux_2014_x86_64 --platform any foobar==0.1.0
where the available wheels are built for [linux_x86_64, manylinux2010_x86_64, any]
, what should each command download?
If we perform manylinux
-expansion, I would expect for 1
to download linux_86_64
(since I explicitly declared that platform to be acceptable), whereas I would expect for 2
to download manylinux2010_x86_64
(since any
should probably be lowest precedence).
On the other hand, one might argue that manylinux2014_x86_64
should expand "in-place" in the precedence-list, to include all three manylinux
-platforms. In that case, 1
should download manylinux2010_x86_64
.
My intention isn't to argue which approach is more "correct" - Instead, it's to point out that the outcome is non-obvious. If we instead tell pip
to just trust what the user provided, then this question melts away.
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 would expects the --platform
values be simply union-ed, and all expansions done in-place. The wheels downloaded would typically be installed by pip install on a specific platform, which would again filter the wheels. Incompatible wheels downloaded previously wouldn’t really make any practical differences (except some additional local disk space).
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.
Fair enough, I suppose I don't feel strongly in either direction.
@uranusjr @xavfernandez I've pushed a change to implement this - Let me know what you think.
12a2530
to
880fe55
Compare
4fb0344
to
0fa1a08
Compare
Looks like the MacOS test failures are happening at |
Yup -- #9030. |
Since #9030 should now be solved, rebasing again (sorry) should make the tests pass. |
0fa1a08
to
7632c7a
Compare
@xavfernandez Thanks for the heads up - Done and pushed. |
Merging given multiple approvals and that @uranusjr wants this in 20.3. :P |
As proposed in #6121.
This is useful when fetching wheels for a well-defined interpreter, whose supported ABIs and platforms are known and fixed, different than the one pip is running under.