-
Notifications
You must be signed in to change notification settings - Fork 251
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
fix and make common python version normalization #385
fix and make common python version normalization #385
Conversation
f554b71
to
3d1d83a
Compare
3d1d83a
to
a571fa5
Compare
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 think that being bug/implementation compatible with Pip here is, unfortunately, the correct move. That being said, I would like to put a streamlined version of your testing/research in the docstring or comments as appropriate. Looks good to merge after that.
Also handle a single digit of precision more carefully at the boundary.
I added a comment. I also went to the trouble of installing python 3.0.0, to see how single digit precision really works at the edge cases. Turns out that So I've added a comment saying that, and updated the code accordingly (not that there's anyone out there running 2.0.0 or 3.0.0 who will ever care about the difference) |
Hmm, not sure I appreciate sonarcloud telling me that it doesn't like this code, let's try a small rearrangement... |
fcb9446
to
f4e3732
Compare
f4e3732
to
8207439
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Good luck to anyone who thinks they can make this function satisfy sonarcloud, I've suppressed the warning |
Honestly I find the SonarCloud-driven version to be more readable and cleaner :) LGTM if suppressing Sonar is all we can do, despite the mild refactor. |
Also handle a single digit of precision more carefully at the boundary.
relating to python-poetry/poetry#5717
there were two similar but diverging bits of code. They really ought to be the same; and the version that I've gone for is actually not quite the same as either of the originals.
Specifically, in the handling of python_version when specified with either one or two digits...
First, the single digit case.
python_version > 3
is strictly not valid, PEP 508 says that thepython_version
should be equivalent to'.'.join(platform.python_version_tuple()[:2])
.pip
and arequirements.txt
teaches me that in my 3.8.10 environment,python_version > 3
does allow a dependency to be installedpython_version <= "3"
does not allow installation at 3.8.10>3
as> 3.0.0
per Fix an error when handling single digit Python markers #155 is reasonable, and have removed code that treats>3
as>=4.0.0
For the two digit case though, experiment shows that
python_version > "3.8"
does indeed cause pip not to install a dependency in my 3.8.10 environment, that I think should be reinterpreted as>=3.9.0
. So I have included that code.