-
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
Require minimum pip version? #4145
Comments
If pip is looking at a To build the wheel, I don't see how pip should be involved outside of setting up the proper build environment so I don't see why a specific version of pip would be required... The only reason I see would be that the If the built wheel is incompatible with older version of pip, pip already has a mecanism to recognize if it is able to properly install a wheel via its wheel version (cf https://github.com/pypa/pip/blob/b559221/pip/wheel.py#L550-L576). |
I'm with @xavfernandez here. I can't see why a project would need to require a given version of pip. For wheels, the wheel version is enough. For sdists, there's either So I'd claim YAGNI for this. |
|
Maybe I missed something. I thought the Project authors shouldn't need to be responsible for tracking which precise version of pip supports the features they use. As long as they are using a defined version of the file format, they should be fine. Of course, unless I'm mistaken, the |
My main point is that I don't see why we should have a pip specific
Either we declare it useless (as it was chosen to do in https://www.python.org/dev/peps/pep-0518/#a-semantic-version-key , with which I don't agree ^^) or we bite the bullet and declare a full-fledged I'd hate it to see other tool than pip use the |
The version number in Beyond that though, this key isn't just useful for
And those are just off the top of my head. That gives two key benefits to this over simply versioning the
|
Hmm, OK. Thanks for the examples. I'm still not clear, though. Pip's job here is to do the install, which means unpacking and installing a wheel. We also orchestrate the building of wheels, if there is only a sdist available, but we do that currently by calling out to setuptools, and in future by calling out to an arbitrary build tool. So surely it's the build tool that has to be the right version to support these features, not pip? In the case of environment markers or requires-python, I can see the project wanting to ensure that the build tool has support for those features - but why would they care what version of pip is involved? The only thing I can think of is if we're thinking of wheels having metadata that older versions of pip don't respect. That seems to me to be a problem with either pip or the metadata spec - if "ignore unknown metadata" isn't appropriate for a given piece of metadata, then adding that metadata should have required a metadata version bump (so that installers such as pip can say "don't know what to do with this version"). Of course, historically we may not have done that, but going forward maybe we should? I'd see that as a better solution than allowing projects to say "you can't use pip version X for my project" (after all, users will still be able to use pip 9 or earlier, because those versions won't respect the "minimum pip version" metadata!) As for "don't fall back to sdist if there's no wheel", isn't that what I'd really rather see an example of a project saying "we have a problem with people using old versions of pip to install our code, and it's causing this specific issue" before we try to design a general solution that may get over-used. |
@pfmoore In the case of all of the examples listed, the problem was in pip not in setuptools, furthermore, once we have build requirements setup via They care about what version of pip is involved, because if pip doesn't support them then their project is either going to be silently broken or get bad behavior. In the case of the environment markers for instance, pip was not interpreting environment markers from a sdist (even though setuptools had them and was writing them) until pip 6.0. So projects who want to support pip < 6 need to replicate the environment markers using python logic inside of their I opened this issue right now because another person had reached out asking how they can tell what version of pip was being used to install their project, because their project is extremely complex to build (moreso than numpy) and so they publish wheels for all of the various platforms. However people with old pips fall back to downloading the sdist by default and then get a very confusing error and start coming to them asking for help, when they would be fine if they simply upgraded their version of pip. As I was thinking about this feature, it also occurred to me that if we added it, then projects could use it when we add other features in the future that they depend on if they want to hard fail instead of trying to maintain a compatibility shim. Such as with the abstract build system. |
OK. Thanks for the explanation. But am I right in thinking that a specification of "requires pip 12+" (for example) would actually mean "requires pip 12+, or pip 9 or earlier", because pip 9 will ignore this new metadata? So while this may address issues like this, it won't be a complete solution (not that anything could be) until pip 9 is "too old to be worth worrying about"? I still don't really like this option, as it seems like it's too blunt an instrument, but if no-one's offering more nuanced solutions, I'm not going to block this as a "better than nothing" option. However, I would like to consider the option of making the message a warning, rather than an error. A warning along the lines of "This project is designed to be installed with pip version X or later. You are using an older version - if you get errors you should upgrade pip" would have much the same effect, but without blocking out cases that would work (maybe the user has just put a lot of effort into setting up the right build environment, because he can't upgrade pip for whatever reason). |
@pfmoore Yes that is correct, it would effectively be It's a bit of a chicken and egg scenario of course, where the longer we wait to add it, the window of < 9.1 just keeps moving up for each release we do. Of course we can decide that that gap means the solution isn't "good enough" to pass muster because there's always going to be some older pips that don't support it. Making it a warning, either just by always making it a warning or by making it an error with a flag to downgrade it to a warning seems fine to me. To be clear, I don't know exactly how I feel about it. I think it could be a useful option to have, but I also don't want to be in a palce where every project is just sort of expected to have some sort of minimum pip version chucked in a file alongside things. |
I thought one of the point of PEP 518 was to help differentiate the roles of the installer ( But I guess we are not there yet and pip's version is still important as of the capabilities of the installer: does it undestand such metadata ? will it correctly resolve dependencies ? does it understand pure I guess what is bothering me with this is that it will encourage project maintainers to specify their installer requirements via a pip minimum version. |
@xavfernandez There is still a separation of concerns, but no matter what people are going to be dependent on which feature the installer that their end users are using have implemented. We've successfully documented and standardized things as we've gone alone which makes it so that people can write their own installer if they so wish and it can slot in just as pip does now. If there becomes a second popular installer, I could imagine it getting a similar option itself. Importantly, this is not something that is getting added to the standard metadata and it does not influence anything about how the actual installation happens. It merely states whether or not pip is capable of using the new, standard features that this project relies on. |
@dstufft I think you've convinced me of the validity of the need, thanks for the clarification/explanation 👍 |
@pypa/pip-committers Do we want to go ahead with this? |
I don't object to it |
I'm assuming this will not happen in pip 10, so we'll move it to the "10.1" milestone once that is created. |
Pushing this to the next release since I don't think we'll be ready for this by pip 18.1. |
An example use case for this:
|
@hugovk, are you suggesting that there be an option for matching Python version as well, or is always displaying a warning that the user may need to upgrade sufficient? |
I think it's fine to always display it, that we could simply require (or warn about) pip >= 19.2 for all our supported Pythons (3.5-3.8). It's good for people to keep pip up-to-date. |
After thinking about it more, I'm not sure there's anything here that couldn't be handled by a build backend, assuming we're talking about sdists. To me that would be a good enough reason not to implement it in pip. First, this wouldn't need to be implemented in every backend since a backend Then, if someone did want to explicitly warn or fail based on pip version, the wrapper could recurse up the process hierarchy until it found pip, invoke the equivalent of This handles several concerns expressed above:
|
I'm gonna apply this logic and take the liberty of closing this issue. |
With #3691 projects can take control over every version of tooling they interact with from build tools to runtime dependencies. The one thing they can't control is what version of thing they are installed with. This makes a lot of sense both from a practical standpoint (you can't run N versions of pip at once for each thing you're installing) and from a purity standpoint (our standards are not written solely for pip, they're written so any installer can function instead of pip if desired).
That being said, it's still useful for projects to require a specific version of pip to install their thing, particularly when installing from sdist as wheels have version numbers and the like to handle compatible/incompatible changes to that spec and there isn't really much place for logic to happen that people might depend on something pip is providing (or not). However, with sdists there is a lot of feature detection that is going to be happening (does pip support pyproject.toml or not? What about a future abstract build system? what about other, future things we're not even currently thinking of?). We could just shrug our shoulders and ignore it for now and say that someday we'll make a sdist 2.0 that also bakes in a version number like wheel does. That is a good solution but will require a fair amount of effort to get done, but as a stop gap we could do something like using the new
pyproject.toml
file and add our own section to it. Something like:With this pip could look and if this is declared, it can fail out saying that the project requires pip X.Y in order to build. This of course won't help all of the old versions of pip, but going forward it could be a useful escape hatch for people.
Thoughts @pypa/pip-committers ?
The text was updated successfully, but these errors were encountered: