diff --git a/news/resolvelib.vendor.rst b/news/resolvelib.vendor.rst new file mode 100644 index 00000000000..50f702cc923 --- /dev/null +++ b/news/resolvelib.vendor.rst @@ -0,0 +1 @@ +Upgrade resolvelib to 0.8.1 diff --git a/src/pip/_vendor/resolvelib/__init__.py b/src/pip/_vendor/resolvelib/__init__.py index af18ddc9712..ce05fd30274 100644 --- a/src/pip/_vendor/resolvelib/__init__.py +++ b/src/pip/_vendor/resolvelib/__init__.py @@ -11,7 +11,7 @@ "ResolutionTooDeep", ] -__version__ = "0.8.0" +__version__ = "0.8.1" from .providers import AbstractProvider, AbstractResolver @@ -19,8 +19,8 @@ from .resolvers import ( InconsistentCandidate, RequirementsConflicted, - Resolver, ResolutionError, ResolutionImpossible, ResolutionTooDeep, + Resolver, ) diff --git a/src/pip/_vendor/resolvelib/__init__.pyi b/src/pip/_vendor/resolvelib/__init__.pyi index 4a84f8f3045..d64c52ced00 100644 --- a/src/pip/_vendor/resolvelib/__init__.pyi +++ b/src/pip/_vendor/resolvelib/__init__.pyi @@ -1,15 +1,11 @@ __version__: str -from .providers import ( - AbstractResolver as AbstractResolver, - AbstractProvider as AbstractProvider, -) +from .providers import AbstractProvider as AbstractProvider +from .providers import AbstractResolver as AbstractResolver from .reporters import BaseReporter as BaseReporter -from .resolvers import ( - InconsistentCandidate as InconsistentCandidate, - RequirementsConflicted as RequirementsConflicted, - Resolver as Resolver, - ResolutionError as ResolutionError, - ResolutionImpossible as ResolutionImpossible, - ResolutionTooDeep as ResolutionTooDeep, -) +from .resolvers import InconsistentCandidate as InconsistentCandidate +from .resolvers import RequirementsConflicted as RequirementsConflicted +from .resolvers import ResolutionError as ResolutionError +from .resolvers import ResolutionImpossible as ResolutionImpossible +from .resolvers import ResolutionTooDeep as ResolutionTooDeep +from .resolvers import Resolver as Resolver diff --git a/src/pip/_vendor/resolvelib/providers.pyi b/src/pip/_vendor/resolvelib/providers.pyi index 86ada59c419..47d6f8abad7 100644 --- a/src/pip/_vendor/resolvelib/providers.pyi +++ b/src/pip/_vendor/resolvelib/providers.pyi @@ -12,7 +12,7 @@ from typing import ( from .reporters import BaseReporter from .resolvers import RequirementInformation -from .structs import KT, RT, CT, Matches +from .structs import CT, KT, RT, Matches class Preference(Protocol): def __lt__(self, __other: Any) -> bool: ... diff --git a/src/pip/_vendor/resolvelib/reporters.py b/src/pip/_vendor/resolvelib/reporters.py index 563489e133b..6695480fff4 100644 --- a/src/pip/_vendor/resolvelib/reporters.py +++ b/src/pip/_vendor/resolvelib/reporters.py @@ -30,6 +30,12 @@ def adding_requirement(self, requirement, parent): requirements passed in from ``Resolver.resolve()``. """ + def resolving_conflicts(self, causes): + """Called when starting to attempt requirement conflict resolution. + + :param causes: The information on the collision that caused the backtracking. + """ + def backtracking(self, candidate): """Called when rejecting a candidate during backtracking.""" diff --git a/src/pip/_vendor/resolvelib/reporters.pyi b/src/pip/_vendor/resolvelib/reporters.pyi index 55e38ab88d6..03d4f09a390 100644 --- a/src/pip/_vendor/resolvelib/reporters.pyi +++ b/src/pip/_vendor/resolvelib/reporters.pyi @@ -7,4 +7,5 @@ class BaseReporter: def ending(self, state: Any) -> Any: ... def adding_requirement(self, requirement: Any, parent: Any) -> Any: ... def backtracking(self, candidate: Any) -> Any: ... + def resolving_conflicts(self, causes: Any) -> Any: ... def pinning(self, candidate: Any) -> Any: ... diff --git a/src/pip/_vendor/resolvelib/resolvers.py b/src/pip/_vendor/resolvelib/resolvers.py index 35e00fa90a1..787681b03e9 100644 --- a/src/pip/_vendor/resolvelib/resolvers.py +++ b/src/pip/_vendor/resolvelib/resolvers.py @@ -4,7 +4,6 @@ from .providers import AbstractResolver from .structs import DirectedGraph, IteratorMapping, build_iter_view - RequirementInformation = collections.namedtuple( "RequirementInformation", ["requirement", "parent"] ) @@ -374,12 +373,12 @@ def resolve(self, requirements, max_rounds): failure_causes = self._attempt_to_pin_criterion(name) if failure_causes: + causes = [i for c in failure_causes for i in c.information] # Backtrack if pinning fails. The backtrack process puts us in # an unpinned state, so we can work on it in the next round. + self._r.resolving_conflicts(causes=causes) success = self._backtrack() - self.state.backtrack_causes[:] = [ - i for c in failure_causes for i in c.information - ] + self.state.backtrack_causes[:] = causes # Dead ends everywhere. Give up. if not success: diff --git a/src/pip/_vendor/resolvelib/resolvers.pyi b/src/pip/_vendor/resolvelib/resolvers.pyi index e61b0bcb40b..0eb5b2162c1 100644 --- a/src/pip/_vendor/resolvelib/resolvers.pyi +++ b/src/pip/_vendor/resolvelib/resolvers.pyi @@ -9,13 +9,7 @@ from typing import ( ) from .providers import AbstractProvider, AbstractResolver -from .structs import ( - CT, - KT, - RT, - DirectedGraph, - IterableView, -) +from .structs import CT, KT, RT, DirectedGraph, IterableView # This should be a NamedTuple, but Python 3.6 has a bug that prevents it. # https://stackoverflow.com/a/50531189/1376863 diff --git a/src/pip/_vendor/resolvelib/structs.pyi b/src/pip/_vendor/resolvelib/structs.pyi index 14cd4644412..fae2a2fcefc 100644 --- a/src/pip/_vendor/resolvelib/structs.pyi +++ b/src/pip/_vendor/resolvelib/structs.pyi @@ -5,17 +5,22 @@ from typing import ( Generic, Iterable, Iterator, + Mapping, Tuple, TypeVar, Union, ) -KT = TypeVar("KT") -RT = TypeVar("RT") -CT = TypeVar("CT") +KT = TypeVar("KT") # Identifier. +RT = TypeVar("RT") # Requirement. +CT = TypeVar("CT") # Candidate. _T = TypeVar("_T") + Matches = Union[Iterable[CT], Callable[[], Iterator[CT]]] +class IteratorMapping(Mapping[KT, _T], metaclass=ABCMeta): + pass + class IterableView(Container[CT], Iterable[CT], metaclass=ABCMeta): pass diff --git a/src/pip/_vendor/vendor.txt b/src/pip/_vendor/vendor.txt index ab2d6152890..bf8ebcf55fb 100644 --- a/src/pip/_vendor/vendor.txt +++ b/src/pip/_vendor/vendor.txt @@ -14,7 +14,7 @@ requests==2.26.0 chardet==4.0.0 idna==3.2 urllib3==1.26.7 -resolvelib==0.8.0 +resolvelib==0.8.1 setuptools==44.0.0 six==1.16.0 tenacity==8.0.1