-
Notifications
You must be signed in to change notification settings - Fork 252
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 for handling of version ranges #645
base: main
Are you sure you want to change the base?
Conversation
don't include first prerelease in the allowed max for an exclusive range.
Kudos, SonarCloud Quality Gate passed! |
I now think that the real problem - or anyway among the real problems - is ambiguity in poetry-core's treatment of the max in a strict inequality range.
A possible approach is to handle this at parsing and abandon This also solves those issues reported in poetry - but causes carnage in the test scripts: the main (but probably not only) problem being that parsing and then printing |
If we went down this path, maybe we should also change |
that seems plausible and I have a branch in which I tried it. Among the chaos in the unit tests I see at least these wrinkles
probably there's more that I haven't yet spotted This feels like the right direction conceptually but I've no idea when or whether I'm likely to find the time or energy to do anything about it |
Pre-releases must be excluded by |
You are mistaken, but thanks anyway https://peps.python.org/pep-0440/#summary-of-permitted-suffixes-and-relative-ordering |
Ah, I see. Apologies for wasting your time. In hindsight everything makes much more sense now. I interpreted this part of the PEP incorrectly, "Developmental releases are ordered by their numerical component, immediately before the corresponding release (and before any pre-releases with the same release segment), and following any previous release (including any post-releases)." I had incorrectly taken the parenthetical parts to be solely about how developmental releases for pre-/post-releases are ordered before their respective pre-/post-release. And then I somehow managed to repeatedly miss the full example list at the end of the section you linked. |
don't include first prerelease in the allowed max for an exclusive range.
Fixes python-poetry/poetry#8475, python-poetry/poetry#8405, python-poetry/poetry#8202
(actually 8202 seems to have been resolved by changes in the available dependencies on pypi and so I can't reproduce it now: but I'm pretty sure these will all be the same)
Absurdly I can't find a simple testcase that takes two versions or version ranges and compares or intersects them or something to demonstrate the point. So I confess that I don't fully understand what was going wrong before this fix.
However I do understand that those issues are
=2.*
) which poetry interprets as having a lower bound that is the first dev-release (eg2.dev0
)<2
so I've made this fix somewhat on gut:
<2
certainly shouldn't allow2.dev0
and so it's weird thatallowed_max
would return that value.What can I say? I'm confused, but this looks like a good fix and it does resolve those issues...