Merged
Conversation
d4d47c7 to
d908cf9
Compare
radoering
reviewed
May 29, 2022
Member
There was a problem hiding this comment.
First thought: Is that any different from building the union and returning its ranges?
After trying the last test case: Ahh, that's what it's for. (Should have read your description more thoroughly. 😉)
The implementation seems correct to me and the unit tests are fine. I don't have a better name or place for that function either. I just want to wait a bit if there are other opinions.
|
Kudos, SonarCloud Quality Gate passed!
|
radoering
approved these changes
May 29, 2022
bostonrwalker
pushed a commit
to bostonrwalker/poetry-core
that referenced
this pull request
Aug 29, 2022
* Add constraint_regions * unit test constraint_regions * _ranges_for() and flatten are the same
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








This adds
constraint_regions()which is a utility that takes a set of python version constraints and spits out the distinct regions that those constraints split the world into.For instance: input
>=3.6and>=2.7,<3.0.0 || >=3.4.0output
<2.7,>=2.7,<3.0.0,>=3.0.0,<3.4.0,>=3.4.0,<3.6,>=3.6.I am expecting views on whether this is the right place for such code to live, and what the method should be called, and requests for unit tests, which we can get to in due course...
The motivation for this is that I think we need it to fix a particularly icky
poetry exportexample python-poetry/poetry-plugin-export#32. There, the tree-walk at some point finds the requirement:and correctly decides that only ipython 7.16.3 can satisfy this. But that causes it to add a
... or python_version >= "3.6" ...marker for ipython 7.16.3, which sadly overlaps with the markers on a newer ipython version.My intended fix is to split up the python version space and when adding a requirement during the walk, actually add several requirements, one for each range of python versions. That allows the locker to limit the ipython 7.16.3 selection to
>3.6,<=3.7and all is right again.(I'll follow up with an MR in poetry, hopefully clarifying the above).