Skip to content
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

Add --platform and --supported-interpreter-version options to the pip install command #2965

Conversation

MathewJennings
Copy link

@MathewJennings MathewJennings commented Jul 7, 2015

This work started in PR #2911, and has been reproduced in a cleaner fashion here.

This allows a user to ask to download wheels of a different platform than that of the local machine running the command. This option enforces that the --download option is also specified, and will not attempt to install wheels of an incorrect platform.

@MathewJennings MathewJennings force-pushed the pip-install-additional-options branch from 871e46d to eaf0eac Compare July 7, 2015 21:40
@MathewJennings
Copy link
Author

Sorry, I didn't expect my force push to blow away the comments, but I addressed the indented block issue brought up by @jamezpolley.

@simlun
Copy link

simlun commented Jul 8, 2015

I love this idea, it's precisely what I wanted to use right now 😄

@xavfernandez
Copy link
Member

distlib is a vendored dependency of pip. There should be no modification to its code (except when bumping distlib to a new version, cf 320a07f).

@MathewJennings
Copy link
Author

@xavfernandez, I got a little trigger happy when I was removing my calls to pdb.set_trace() after I finished testing. I just git grepped for all instances of that method call and deleted them. Do you think I should place those lines back in distlib, or do you think that maybe this is a small exception? I'm not sure if those debug lines were left in there on purpose.

(This has been resolved. The changes to distlib have been reverted)

@MathewJennings MathewJennings changed the title Add --platform option to the pip install command Add --platform and --supported-interpreter-version options to the pip install command Jul 9, 2015
@MathewJennings
Copy link
Author

The second option I added is called --supported-interpreter-version. This option also requires the --download option to be specified. It lets you require pip to search for a target wheel that supports a particular version of python.

@MathewJennings MathewJennings force-pushed the pip-install-additional-options branch 3 times, most recently from 9431736 to d68faf4 Compare July 14, 2015 20:35
@MathewJennings
Copy link
Author

Is there anything else that needs to be done to get this change merged in?

@patricklaw
Copy link

Hey, we're blocking on this making it into a release in order to release a related feature over at pantsbuild/pants. Would it be possible for someone to take a look and merge it in if everything is okay?

@xavfernandez
Copy link
Member

It would be cleaner to first implement #2643 and then add those specific options to the new pip download command.

@MathewJennings
Copy link
Author

@xavfernandez Just did this in a different PR: #2995

)

cmd_opts.add_option(
'--supported-interpreter-version',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--interpreter-version seems enough (and we are not using --supported-platform)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@xavfernandez
Copy link
Member

Something that is missing from this PR is the ability to download package for a different interpreter (i.e. downloading packages for PyPy from a CPython venv)

@MathewJennings
Copy link
Author

@xavfernandez As for adding different python implementation support, I think it's doable but non-trivial (compared to adding different python version support -- the second thing I did in this PR). I'd rather save that for a different PR, after we get pip download finished and this PR updated to be working on pip download instead of pip install. Do you know if there is any way to make this PR reflect the changes in #2995 without having to, say, wait for that to merge first and then rebase this branch?

@xavfernandez
Copy link
Member

It looks like you overrode supported_tags but not supported_tags_noarch meaning they could end up inconsistent and give strange warnings on PyPI wheels.

… the user more control when downloading packages.

The two new options are --platform and --supported-interpreter-version, and both enforce that the --download option is also specified, else a CommandError is raised.

With the --platform option, a user can ask to download wheels of a different platform than that of the local machine running the command, which is designed as a utility for gathering dependencies and preparing a distribution. Because this option enforces that the --download option is also specified, it will never attempt to install wheels of an incorrect platform.

With the --supported-interpreter-version option, a user can ask to download wheels that are explicitly compatible with a specific Python interpreter version, which is designed as a similar utility to the --package option.
@MathewJennings
Copy link
Author

@xavfernandez, good catch, I just fixed that by adding a valid_tags_noarch instance variable to the PackageFinder class. Now tags for noarch are parallel to tags that do consider architecture.

@xavfernandez
Copy link
Member

The --interpreter-version option bothers me regarding the alternative jython/pypy...

@MathewJennings
Copy link
Author

Hm, do you think it would be more clear to use the more-verbose --interpreter-version-number? I'm just trying to allow different options for --interpreter-version (e.g. 2.7) and --interpreter-implementation (e.g. CPython). In this regard, I think it best to leave them as two different options, to give more control to the user.

As for implementing --interpreter-implementation, I'd prefer to leave that to another PR, for various reasons. It shouldn't be too hard to add it after pip download makes it into develop, but I'd rather not implement another option before that happens.

@xavfernandez
Copy link
Member

Ok, --interpreter-implementation would indeed fit the bill.

@patricklaw
Copy link

I am continuing this PR here: #3092. It is still blocking on #3085 being merged, though.

@dstufft dstufft closed this May 18, 2016
@dstufft
Copy link
Member

dstufft commented May 18, 2016

Accidentally closed this, reopening. Sorry!

@dstufft dstufft reopened this May 18, 2016
@simlun
Copy link

simlun commented May 19, 2016

Accidentally closed this, reopening. Sorry!

Oh no, you made me so happy there for a second xD What a tease, lol

@BrownTruck
Copy link
Contributor

Hello!

As part of an effort to ease the contribution process and adopt a more standard workflow pip has switched to doing development on the master branch. However, this Pull Request was made against the develop branch so it will need to be resubmitted against master. Unfortunately, this pull request does not cleanly merge against the current master branch.

If you do nothing, this Pull Request will be automatically closed by @BrownTruck since it cannot be merged.

If this pull request is still valid, please rebase it against master (or merge master into it) and resubmit it against the master branch, closing and referencing the original Pull Request.

If you choose to rebase/merge and resubmit this Pull Request, here is an example message that you can copy and paste:

This work started in PR #2911, and has been reproduced in a cleaner fashion here. 

This allows a user to ask to download wheels of a different platform than that of the local machine running the command. This option enforces that the --download option is also specified, and will not attempt to install wheels of an incorrect platform.

---

*This was migrated from pypa/pip#2965 to reparent it to the ``master`` branch. Please see original pull request for any previous discussion.*

@BrownTruck BrownTruck added asked to reparent auto-bitrotten PRs that died because they weren't updated labels May 19, 2016
@BrownTruck
Copy link
Contributor

This Pull Request was closed because it cannot be automatically reparented to the master branch and it appears to have bit rotted.

Please feel free to re-open it or re-submit it if it is still valid and you have rebased it onto master or merged master into it.

@BrownTruck BrownTruck closed this May 26, 2016
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-bitrotten PRs that died because they weren't updated auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants