Skip to content

Commit

Permalink
Merge pull request #9249 from uranusjr/new-resolver-setuptools-last
Browse files Browse the repository at this point in the history
Intentionally delay resolving setuptools
  • Loading branch information
pradyunsg authored Dec 9, 2020
2 parents 643217b + 5252383 commit 27d8687
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/9249.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a mechanism to delay resolving certain packages, and use it for setuptools.
13 changes: 12 additions & 1 deletion src/pip/_internal/resolution/resolvelib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,18 @@ def _get_restrictive_rating(requirements):
restrictive = _get_restrictive_rating(req for req, _ in information)
transitive = all(parent is not None for _, parent in information)
key = next(iter(candidates)).name if candidates else ""
return (restrictive, transitive, key)

# HACK: Setuptools have a very long and solid backward compatibility
# track record, and extremely few projects would request a narrow,
# non-recent version range of it since that would break a lot things.
# (Most projects specify it only to request for an installer feature,
# which does not work, but that's another topic.) Intentionally
# delaying Setuptools helps reduce branches the resolver has to check.
# This serves as a temporary fix for issues like "apache-airlfow[all]"
# while we work on "proper" branch pruning techniques.
delay_this = (key == "setuptools")

return (delay_this, restrictive, transitive, key)

def find_matches(self, requirements):
# type: (Sequence[Requirement]) -> Iterable[Candidate]
Expand Down

0 comments on commit 27d8687

Please sign in to comment.