Respect local versions for all user requirements#5232
Merged
Conversation
52c9796 to
c94e437
Compare
c94e437 to
ce0e0ec
Compare
| })?; | ||
|
|
||
| // Add the local version. | ||
| *version = version.union(&local); |
Member
There was a problem hiding this comment.
I guess this will just... fail? Since it has to be the union of multiple different == requirements, right?
Member
Author
There was a problem hiding this comment.
This should work fine, we want to allow any compatible local versions before narrowing to a fork.
charliermarsh
approved these changes
Jul 19, 2024
Member
charliermarsh
left a comment
There was a problem hiding this comment.
Nice. I find this easier to reason about too.
1f6255e to
4155d78
Compare
Merged
ibraheemdev
added a commit
that referenced
this pull request
Jul 23, 2024
## Summary Similar to #5232, we should also track prerelease strategies per-fork, instead of globally per package. The common functionality for tracking locals and prerelease versions across forks is extracted into the `ForkMap` type. Resolves #4579. This doesn't quite solve #4959, as that issue relies on overlapping markers.
ibraheemdev
added a commit
that referenced
this pull request
Aug 6, 2024
## Summary This fixes a bug introduced by #5232. It turns out that the `universal_disjoint_base_or_local_requirement` test does not actually do what it was meant to because of the incorrect python requirement. With a valid python requirement, it fails on `main`. The problem is that we try to exclude the original base version from the range of allowed versions to try and prefer local versions. However, in the test, there is a branch that depends on the non-local version, with no applicable local in its fork. We should remove this exclusion as prioritization is handled by the candidate resolver.
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.
Summary
This fixes a few bugs introduced by #5104. I previously thought we could track conflicting locals the same way we track conflicting URLs in forks, but it turns out that ends up being very tricky. URL forks work because we prioritize directly URL requirements. We can't prioritize locals in the same way without conflicting with the URL prioritization (this may be possible but it's not trivial), so we run into issues where a correct resolution depends on the order in which dependencies are traversed.
Instead, we track local versions across all forks in
Locals. When applying a local version, we apply all locals with markers that intersect with the current fork. This way we end up applying some local versions without creating a fork. For example, given:We choose
2.0.0+cu118in all cases. However, if a disjoint fork is created based on local versions, the resolver will choose the most compatible local when it narrows to a specific fork. Thus we correctly respect local versions when forking:We should also be able to use a similar strategy for #5150.
Test Plan
This fixes #5220 locally for me, as well as a few other bugs that were not reported yet.