-
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
Deprecate requirements format "base=>1.0[extra]" #8424
Deprecate requirements format "base=>1.0[extra]" #8424
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.
Thank you for filing this PR @jku!
A couple of minor code-style related comments. The rest looks great to me! ^>^
50139e7
to
f17daa0
Compare
thanks for review @pradyunsg, I've done the requested changes and a minor tweak to the actual message. |
If I'm reading the PR correctly, we're actually deprecating all non-PEP 440 version numbers, not just the I'm not against this in principle, but have we checked how many packages this will apply to? Does PyPI enforce PEP 440 version format? I'd be fine with only considering PyPI here (private indexes can police themselves in this matter). |
Fair point. I think having a look through pypi is prudent in any case... I'll think about this |
If I’m understanding the situation correctly,
And somehow this is would later be used to select extra If this is a case, the fix likely should not be to deprecate the legacy specifiers, but to figure out why it’s selecting the extra, and make it not do that. |
Correct. I tried to start a discussion on this in the bug, please see my last three comments in #8288 and comment there if you have ideas.
Well, it might still be prudent to warn or stop processing as early as possible -- but let's figure out the big picture first in any case: I think the issue discussion might be the right place for that |
pypi does enforce pep-440: upload fails with non-conformant version. I've had a look at wheel filenames in pypi repo: out of 1.1 million wheel files 84 have non-conforming versions (and are not somehow otherwise broken). 9 of them are current versions. Something prevents installing them without the version: e.g. So there is a small number of packages with non-conforming version numbers that currently are somewhat installable from pypi -- they are not likely to be very popular as the "non-versioned" installation method already fails. |
Thanks for doing that analysis. It sounds like if we decide to deprecate, the impact will be sufficiently low to make it a reasonable option (we'd still need the deprecation period, to cover non-PyPI projects, of course). |
ce82ec4
to
ccc4712
Compare
Changes since the previous review:
I don't think this is an option (as long as there is no refactoring of the whole function). We know why this happens: the version string is wrong so I do not think we should add more parsing code to figure it out earlier in |
Interesting, it looks like the command line test I added fails on windows: the extra package does not get created (alternatively, I do something wrong in the test). There's no stdout/stderr listed for the AssertionError (not sure why, it does happen locally) but it's clear from the "created" list that the |
You’re hit by a quirk in pip’s test utilities. |
Or alterntively you can write the requirement line into a file and use |
Thank you, that seems obvious now that you pointed it out. This was a good find though: I had not extensively tested what actually passes the version check and I really should have... As I mentioned the specifier version becomes garbled: The tests I had picked all worked but it turns out quite a few of the comparisons do not, e.g. these do not work at all currently (examples from the test in question, requires_simple_extra == 0.1):
I wonder if the right choice is actually to error out without a deprecation -- this seems to be quite thoroughly broken right now. |
To summarize the slightly meandering thread, current state of the PR is:
I think the right thing to do might be to just error out with the current check (does version end in "]"?) instead of deprecating. I can do one more pass of this if that sounds good (although how useful this is without a refactoring of |
ccc4712
to
6e1eff8
Compare
This comment has been minimized.
This comment has been minimized.
This requirements format does not conform to PEP-508. Currently the extras specified like this work by accident (because _strip_extras() also parses them). The version checks end up being done with a misparsed version '1.0[extra]' -- this is not changed in this commit. Add deprecation warning and fix the corresponding resolver test. Add a command line test. Note that we really only check that the Requirement has SpecifierSet with a specifier that ends in a ']'. A valid version number cannot contain ']' and no wheels currently on pypi have versions ending in ']'.
6e1eff8
to
76b20d7
Compare
latest pushes change
|
Thanks @jku! ^>^ |
Note: I'm new to pip code and it was not obvious where this should be done: feel free to point me to another direction. I chose this spot in
parse_req_from_line()
because there's other validation right next to it.There's currently no "gone_in" defined for the deprecation: let me know if there's a policy I should follow here.
The bug also has my comments on some other weirdness that may or may not be related bugs.
Fixes #8288
This requirements format does not conform to PEP-508. Add deprecation
warning and fix the corresponding test.
Note that the actual added check ensures the specifier is compliant
with PEP-440 (the specifier version is invalid "1.0[extra]").