-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Simplify, fix, and add unit tests for PipProvider.get_preference
#12982
Conversation
CI is green, ready for review / merge |
Tentatively putting this on the 24.3 milestone since it's a small bug fix, a small refactor, and finally unit tests get_preference! Feel free to remove. |
For this one, we'd need a review by a committer who is more familiar than I am with the innards of the resolver. |
I ran all scenarios against: https://github.com/notatallshaw/Pip-Resolution-Scenarios-and-Benchmarks There is no regression or advantage between this PR and pip 24.2, which is what I expected (there was a small chance removing the broken |
* If equal, prefer if any requirement is "pinned", i.e. contains | ||
operator ``===`` or ``==``. | ||
* If a requirement is part of the current cause for backtracking. |
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.
This sentence seems to be incomplete?
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.
Thanks, I've update to match the style of the surrounding sentances.
operator ``===`` or ``==``. | ||
* If the a member of backtrack causes. |
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.
Is this sentence correct?
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.
Thanks, I've updated this point to match what I wrote in the docs
90d10d6
to
b8d1f11
Compare
Going to make a single follow up PR once #13001 lands, I'll comment here once done. |
Fixes: #12975
This PR does the following:
direct
as a preference based on this reasoning:direct
preference in resolution doesn't work #12975 (comment)get_preference
(removes logic flow via exception)get_preference
get_preference
Side note: I think I've found a bug in the way
parent_depths
is calculated when a requirement with an extra is involved, but it was too involved to fix in this PR, once I've pinned it down I will make a follow up PR.