-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Open up plat/abi/impl options to install --target
#5404
Open up plat/abi/impl options to install --target
#5404
Conversation
4ffa9df
to
7b56d46
Compare
I commented on #5355 also, but wanted to repost here too. This feature sounds like exactly what I need! Hi I have been fighting basically this issue for a while now. I am using the Resin.io service, which uses a cross-compiling build system in order to build a docker container for a Raspberry Pi device. However their build systems run on armv8l, and I'm looking to install for the armv6l for the Pi Zero W. I've knocked into this issue multiple times working with this platform. I think in terms of ARM wheels, Docker containers, and cross compilation, where there is more weirdness and incompatibilities between architectures something like the above solutions would be a great improvement. |
I tried running the test suite on a windows machine and couldn't reproduce the errors from AppVeyor, not sure what's going on there if anyone has an insight I'm all ears |
Might have been a transient issue? |
(closed-opened to re-trigger the builds) |
👋 just offering a friendly ping |
Hey @sixninetynine! :) I don't have the bandwidth currently to review this PR (or any non-trivial PR for that matter). I'll get to this soon though. Sorry to keep you waiting. |
@pfmoore would love your opinion on the discussion happening in #5453 and how it relates to this PR. Specifically the notion that merely including dist options in the install command accounts for the explicitness of the request. I'm perfectly happy removing the cc @chriskuehl & @asottile |
Personally, I see the two use cases as different. This PR is saying "I want to manage packages for a specific platform/abi/impl, which is not the same as the current environment", whereas #5453 is about allowing the user to describe the current environment's compatibility in terms of non-default unique tags (ones that don't match any of the standard sets). As the use cases differ, I'd rather the UIs differed as well. To put it another way, I see this PR as being about allowing certain carefully chosen commands to call I believe there have been previous discussions about having finer-grained ways of describing your environment, fitting between manylinux (highly generic) and "linux" (basically machine-specific). There may even be a mechanism in place. I don't have specifics, unfortunately (see below - I don't really know much about this area of Linux). That sounds pretty close to what #5453 is trying to achieve. Disclaimer: Personally, I use Windows and #5453 is not really an issue there. So I'm probably not the best person to have an opinion here. My comments above are from a general perspective of making sure we get pip's UI right, but someone with a Linux background may feel differently. |
I'm not sure they're all that different. I believe (correct me if I'm wrong) the primary usecase of this PR is to be able to build a site-packages from a disparate architecture / platform and deploy it (think: running On darwin, |
One of the usecases also mentioned in #5453 is identical to this one -- being able to build a virtualenv for an alternate platform direct link to the discussion also linked there |
I see this PR as a better solution to that problem. I'm pretty strongly of the opinion that being able to do
which puts mutually incompatible binaries into site-packages, is wrong. Doing the same with Basically, I'd rather see #5453 be implemented as a configuration, that says "this environment conforms to platform tag XXX". That's my impression of how previous discussions on this topic have gone. But as I've said, this is a Linux-related issue, and I'm not a Linux specialist, so I've said what I want to - from this point, I'll leave it to others to decide on how to proceed. |
I was under the impression that the same requirements that were added for That is, I think it's very explicit that running I agree that it's possible for someone to put mutually incompatible binaries into $ pip download --only-binary :all: --platform macosx_10_10_x86_64 numpy
...
Successfully downloaded numpy
$ pip download --only-binary :all: --platform manylinux1_x86_64 numpy
...
Successfully downloaded numpy
$ ls
numpy-1.14.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
numpy-1.14.3-cp27-cp27m-manylinux1_x86_64.whl What I hope to convince is that requiring An aside: if this is implemented without requiring |
Wanted to give a little more information about how I am currently getting around this problem. arch_test.py: Install command:
Not sure if that helps anything. I'd like to specify Ideal use case:
|
OK, I just want to summarize the current status of this PR and our options... This PR, as it stands, adds the "dist" options ( @chriskuehl, @asottile & @sako0938 have since commented regarding a similar feature request #5453 and suggest that this feature would be more useful if not restricted only to the I have no qualms updating this PR to remove the restriction on Thanks in advance! |
I started a thread on distutils-sig to discuss the implications of this PR and what direction to go in. Quoting @ncoghlan :
I think this sounds good, especially the point about it being easier to loosen restrictions later.
I think this is ok as well, given that using these commands without specifying --only-binary raises the usual (expected) error. |
@pradyunsg offering a friendly ping, given the above updates |
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.
Appreciate the ping. Just read up on this PR and the related discussions.
LGTM functionally, based on a visual review of the diff on GitHub's UI. I'll take it for a spin sometime today.
src/pip/_internal/cmdoptions.py
Outdated
@@ -60,6 +61,42 @@ def getname(n): | |||
) | |||
|
|||
|
|||
def check_dist_restriction(options, check_target=False): | |||
"""Function for determinming if custom platform options are allowed. |
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.
typo.
src/pip/_internal/cmdoptions.py
Outdated
@@ -406,6 +443,61 @@ def only_binary(): | |||
) | |||
|
|||
|
|||
def platform(): | |||
return Option( |
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.
The pattern in this file is to use functools.partial for this unless there's a mutable value involved. Staying consistent with that would be nice.
@@ -13,6 +13,7 @@ | |||
from pip._internal.exceptions import ( | |||
CommandError, InstallationError, PreviousBuildDirError, | |||
) | |||
from pip._internal.index import FormatControl |
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.
Unnecessary import.
As a side note, could you rebase on master? There's a bunch of CI related improvements (including reenabling checking of unused imports).
tests/functional/test_install.py
Outdated
assert distinfo in result.files_created | ||
|
||
# Test install without --target | ||
result = script.pip( |
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 result isn't being used in any way. I'd suggest adding a check for the exit code immediately after.
Out the back of my head, I think expect_error lets a test pass even if there's no errors. If that's the case, the above would be needed anyway. :)
assert distinfo in result.files_created | ||
|
||
# Test a full path requirement (without --target) | ||
result = script.pip( |
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.
As above.
src/pip/_internal/cmdoptions.py
Outdated
not options.ignore_dependencies | ||
) | ||
|
||
if dist_restriction_set and no_sdist_dependencies: |
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 know it wasn't there originally but adding a comment that explains why these error messages are raised would be appreciated.
src/pip/_internal/cmdoptions.py
Outdated
]) | ||
|
||
binary_only = FormatControl(set(), {':all:'}) | ||
no_sdist_dependencies = ( |
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.
naming: sdist_dependencies_allowed
9fda856
to
16c8798
Compare
@pradyunsg thanks for the review! updated the diff per your comments and rebased as well. |
@pradyunsg any chance this could make it into #5516 ? :) |
I'm not 100% comfortable being the only one to review and merge since I'm not completely familiar with the nuances involved here. Maybe someone else from @pypa/pip-committers who's more familiar could review this. As for making into 18.0, I don't think we'd block 18.0 for this -- I'm fine if this has to wait until 18.1. It's definitely nicer if it doesn't have to wait. :) |
159 additional commits - did a rebase get done incorrectly? |
372a8ff
to
369deee
Compare
@pfmoore haha, yep, I royally borked it up. Fixing now |
8bac0fb
to
f0777e8
Compare
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
@pfmoore @pradyunsg before I resolve these conflicts, what are the next steps for this PR? |
I can't speak for @pfmoore -- I just haven't find the time to take a deeper dive to actually review this properly; until now. These changes as they stand, look good to me. |
Changes look OK to me |
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.
Looks OK once merge conflicts resolved
Cool. So, the next step is to fix the merge conflicts and ping us. :) |
f0777e8
to
d86dc8d
Compare
* Move dist restriction options to be re-usable (between install/download) * Make dist restriction options usable in `install` (exclusively with --target) * Add a check_supported_wheels bool to RequiriementSet for non-resolved (full path) dependencies
d86dc8d
to
cddcb14
Compare
thanks @pradyunsg & @pfmoore |
This fixes exactly the issue I was just trying to solve. When can we expect a new release of pip? Thanks for all the hard work! |
@chadrik you can always install from master too:
|
yup, already on it! Thanks for the quick feedback.
…On Mon, Aug 13, 2018 at 3:28 PM Loren Carvalho ***@***.***> wrote:
@chadrik <https://github.com/chadrik> you can always install from master
too:
python3 -m pip install --upgrade git+git://github.com/pypa/pip.git#egg=pip
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5404 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD3E0EM4g9eOu4FMjZxK7fnX7F68P9pks5uQf2IgaJpZM4T-F0l>
.
|
Thanks for the PR @sixninetynine! Much appreciated. :) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary:
install
(exclusively with --target)Greetings pip maintainers!
This is an implementation of the suggestions in #5355 - @pfmoore suggested that allowing a user to circumvent the local compatibility checks would be allowable only in the case of using
--target
, and I agree completely.One part that may be controversial is that this diff also adds the
--platform
,--abi
,--python
&--implementation
args to theinstall
command. Though it is constrained to only if--target
is being used. This is purely for convenience sake, so that users who wish to install with--target
don't have to make multiple invocations of pip (e.g.pip download
and thenpip install --target $dir ./wheel1.whl ./wheel2.whl
etc).One thing I'm a little iffy on is the test suite, I looked at similar tests and tried to adhere to their style and convention, but I needed an additional wheel and I'm not certain how they were created (the wheels with mocked pep425 names). What I ended up doing was copying one of them and simply changing the file's name. I imagine there's a better way?
Here's some examples of the UX:
using
--target
and dist options:output:
trying to use dist options w/o specifying
--target
:output:
All the usual dist-related error messages are preserved, for example, not specifying
--only-binary
:So as you can see, it's not a terribly drastic change in terms of behavior, but does alter the
--help
output ofinstall
and opens up potential avenues for users to break things in interesting ways, so I understand any reticence to the change and am very receptive to ideas on how to strike a balance between ease-of-support, ease-of-use & this functionality.Looking forward to discussion
-Loren