Skip to content
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

New disjoint method for provider #179

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

notatallshaw
Copy link
Collaborator

@notatallshaw notatallshaw commented Nov 10, 2024

Fixes #171

This allows the provider to implement a method to determine the causes which are disjoint, this has a number of advantages:

  1. It reduces the number of causes saved to the state
  2. If the provider uses backtrack_causes in get_preference or narrow_requirement_selection they will be the disjoint causes allowing the provider to not have to iterate through as many causes or re-implement figuring out disjoint causes on every different method call
  3. For ResolutionImpossible errors the disjoint causes will naturally be returned

If the provider does not implement a disjoint method then there is no behavior change, so this PR should be completely backwards compatible.

@notatallshaw
Copy link
Collaborator Author

This new method seems quite natrual, happy to take any bikeshedding suggestions.

I have a hacky version of implementing it with pip and dep-logic: pypa/pip@main...notatallshaw:pip:speedy-resolve (For the real version I will need to more carefully consider when ExplicitRequirements and SpecifierRequirements are disjoint). But it already successfully speeds up various resolutions.

@notatallshaw
Copy link
Collaborator Author

I've come to realize a problem with this approach, or at least why pip couldn't easily adopt it, I write up in more detail shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant