Fix dependency cache inconsistency with prerelease versions#7978
Merged
radoering merged 2 commits intopython-poetry:masterfrom May 22, 2023
Conversation
chriskuehl
commented
May 21, 2023
radoering
requested changes
May 21, 2023
Member
radoering
left a comment
There was a problem hiding this comment.
LGTM. 👍 Just something about our (implicit) internal coding style considering tests.
4ac3bea to
952af40
Compare
radoering
approved these changes
May 22, 2023
952af40 to
6a189da
Compare
poetry-bot bot
pushed a commit
that referenced
this pull request
May 24, 2023
(cherry picked from commit fd70f7e)
radoering
pushed a commit
that referenced
this pull request
May 24, 2023
(cherry picked from commit fd70f7e)
Closed
3 tasks
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 PR fixes an inconsistency identified in #7950 (comment) where in some situations Poetry will not select a prerelease package version even though it satisfies all constraints.
Poetry is supposed to consider prerelease package versions if no other package versions satisfy the constraints. I believe this works if the constrained dependency is at the top level, but not necessarily if the constraint is introduced at a later level. Currently, whether it works or not depends on some arbitrary factors like the order dependencies are evaluated in and if the solver recently backtracked.
Regression test
I introduced a regression test which fails on
master:The test passes if I disable the
DependencyCache(replace the contents ofDependencyCache._search_for()withreturn self.provider.search_for(dependency), and also passes with the patch provided in this PR.Additionally, the reproduction using
black<22from #7950 (comment) also succeeds for me now.