Skip to content

Commit b3b468f

Browse files
uranusjrichard26
andcommitted
Emit Requires-Python dependency first
This makes the resolver always inspect Requires-Python first when checking a candidate's consistency, ensuring that no other candidates are prepared if the Requires-Python check fails. Co-authored-by: Richard Si <[email protected]>
1 parent ce6d8a4 commit b3b468f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

news/11142.bugfix.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a regression that causes dependencies to be checked *before* ``Requires-Python``
2+
project metadata is checked, leading to wasted cycles when the Python version is
3+
unsupported.

src/pip/_internal/resolution/resolvelib/candidates.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ def dist(self) -> BaseDistribution:
249249
return dist
250250

251251
def iter_dependencies(self, with_requires: bool) -> Iterable[Optional[Requirement]]:
252+
yield self._factory.make_requires_python_requirement(self.dist.requires_python)
252253
requires = self.dist.iter_dependencies() if with_requires else ()
253254
for r in requires:
254255
yield from self._factory.make_requirements_from_spec(str(r), self._ireq)
255-
yield self._factory.make_requires_python_requirement(self.dist.requires_python)
256256

257257
def get_install_requirement(self) -> Optional[InstallRequirement]:
258258
return self._ireq

0 commit comments

Comments
 (0)