You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the resolver only allow one way for the provider to trigger backtracking, by supplying requirements (dependencies) that would empty a criterion’s candidate list. This prevents some oppertunities for applications to reject candidates in later stages. pip, for example, wants to reject a candidate with invalid/inconsistent metadata, but there’s currently no way for it to do this.
Except there is already a hook for that: is_satisfied_by(). This hook is already checked during pinning:
# Check the newly-pinned candidate actually works. This should
# always pass under normal circumstances, but in the case of a
# faulty provider, we will raise an error to notify the implementer
# to fix find_matches() and/or is_satisfied_by().
satisfied=all(
self._p.is_satisfied_by(r, candidate)
forrincriterion.iter_requirement()
)
ifnotsatisfied:
raiseInconsistentCandidate(candidate, criterion)
The first block catches RequirementsConflicted, which would be used to trigger backtracking. The second calls is_satisfied_by(), but expects it to always return True (otherwise raises InconsistentCandidate). If we modify the block to instead continue (i.e. give up on the candidate) when is_satisfied() returns false, the provider can then use it to validate the candidate and signal any latent issues that cannot be found previously.
Currently the resolver only allow one way for the provider to trigger backtracking, by supplying requirements (dependencies) that would empty a criterion’s candidate list. This prevents some oppertunities for applications to reject candidates in later stages. pip, for example, wants to reject a candidate with invalid/inconsistent metadata, but there’s currently no way for it to do this.
Except there is already a hook for that:
is_satisfied_by()
. This hook is already checked during pinning:resolvelib/src/resolvelib/resolvers.py
Lines 205 to 221 in 4d6963a
The first block catches
RequirementsConflicted
, which would be used to trigger backtracking. The second callsis_satisfied_by()
, but expects it to always return True (otherwise raisesInconsistentCandidate
). If we modify the block to insteadcontinue
(i.e. give up on the candidate) whenis_satisfied()
returns false, the provider can then use it to validate the candidate and signal any latent issues that cannot be found previously.This would help issues such as pypa/pip#9203, and provide the companion fix needed for pypa/pip#9199.
The text was updated successfully, but these errors were encountered: