-
Notifications
You must be signed in to change notification settings - Fork 34
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
Make it possible (for a reporter) to determine which candidate a requirement originates from #46
Comments
Actually, this doesn't work for "root" requirements (workaround: have logic to look at whether starting was called), or for candidates that get evaluated but not pinned (useful for showing mismatches / failures). |
Alternatively, we could add a diff --git a/src/resolvelib/resolvers.py b/src/resolvelib/resolvers.py
index 157eefa..60cdb32 100644
--- a/src/resolvelib/resolvers.py
+++ b/src/resolvelib/resolvers.py
@@ -218,6 +218,7 @@ class Resolution(object):
def _attempt_to_pin_criterion(self, name, criterion):
causes = []
for candidate in reversed(criterion.candidates):
+ self._r.evaluating(candidate)
try:
criteria = self._get_criteria_to_update(candidate)
except RequirementsConflicted as e: That'd make the order-of-relevant-reporter-hook-calls:
To:
|
BaseReporter.adding_requirement
I don’t like having too many hooks being called for a given code path. Would it be okay if a hook is added to report a candidate does not match? (i.e. for each candidate, either |
I for one prefer this option, fwiw, since the naming is a lot easier to understand - although I can see the advantage of having two completely separate calls as well to avoid having to embed the conditional logic in the reporter. |
The other option is to add a |
This doesn't make it possible to have all the information about which candidate the requirement originated from (see |
I can always pass in the requirements as well. How about tried_to_pin(requirements: List[Requirement], candidate: Optional[Candidate]) where |
@uranusjr What would |
The requirements that the resolver tried to find the intersection on. But now I see that’s not what you want, but I think I’ll go with the |
This would be useful for reporters, to determine why a certain requirement is added.
I'm imagining a
evaluating
hook, that's called at the start of the loop on_attempt_to_pin_criterion
, prior topinning
but unconditionally (so that it doesn't actually have to match the criterion).As an example, I want to be able to visualize false-starts / not-compatible-version checks, before they're pinned and currently, there's no way for the reporter to get this information.
The text was updated successfully, but these errors were encountered: