Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.resolution.legacy.resolver Namespace Reference

Data Structures

class  Resolver
 

Functions

None _check_dist_requires_python (BaseDistribution dist, Tuple[int, int, int] version_info, bool ignore_requires_python=False)
 

Variables

 logger = logging.getLogger(__name__)
 
 DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]]
 

Detailed Description

Dependency Resolution

The dependency resolution in pip is performed as follows:

for top-level requirements:
    a. only one spec allowed per project, regardless of conflicts or not.
       otherwise a "double requirement" exception is raised
    b. they override sub-dependency requirements.
for sub-dependencies
    a. "first found, wins" (where the order is breadth first)

Function Documentation

◆ _check_dist_requires_python()

None _check_dist_requires_python ( BaseDistribution  dist,
Tuple[int, int, int]  version_info,
bool   ignore_requires_python = False 
)
protected
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value.

:param version_info: A 3-tuple of ints representing the Python
    major-minor-micro version to check.
:param ignore_requires_python: Whether to ignore the "Requires-Python"
    value if the given Python version isn't compatible.

:raises UnsupportedPythonVersion: When the given Python version isn't
    compatible.

Definition at line 58 of file resolver.py.

62) -> None:
63 """
64 Check whether the given Python version is compatible with a distribution's
65 "Requires-Python" value.
66
67 :param version_info: A 3-tuple of ints representing the Python
68 major-minor-micro version to check.
69 :param ignore_requires_python: Whether to ignore the "Requires-Python"
70 value if the given Python version isn't compatible.
71
72 :raises UnsupportedPythonVersion: When the given Python version isn't
73 compatible.
74 """
75 # This idiosyncratically converts the SpecifierSet to str and let
76 # check_requires_python then parse it again into SpecifierSet. But this
77 # is the legacy resolver so I'm just not going to bother refactoring.
78 try:
79 requires_python = str(dist.requires_python)
80 except FileNotFoundError as e:
81 raise NoneMetadataError(dist, str(e))
82 try:
83 is_compatible = check_requires_python(
84 requires_python,
85 version_info=version_info,
86 )
87 except specifiers.InvalidSpecifier as exc:
89 "Package %r has an invalid Requires-Python: %s", dist.raw_name, exc
90 )
91 return
92
93 if is_compatible:
94 return
95
96 version = ".".join(map(str, version_info))
97 if ignore_requires_python:
99 "Ignoring failed Requires-Python check for package %r: %s not in %r",
101 version,
102 requires_python,
103 )
104 return
105
106 raise UnsupportedPythonVersion(
107 "Package {!r} requires a different Python: {} not in {!r}".format(
108 dist.raw_name, version, requires_python
109 )
110 )
111
112
for i

References i.

Referenced by Resolver._resolve_one().

Here is the caller graph for this function:

Variable Documentation

◆ DiscoveredDependencies

DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]]

Definition at line 55 of file resolver.py.

◆ logger

logger = logging.getLogger(__name__)

Definition at line 53 of file resolver.py.