From b328c03847faae0a82b73eb0aa414e604363c24a Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Wed, 9 Dec 2020 11:27:51 +0800 Subject: [PATCH] Intentionally delay resolving setuptools --- src/pip/_internal/resolution/resolvelib/provider.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 3883135f12b..d198a90ccfa 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -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 project would request a narrow, + # non-recent version range of it since that would break a lot packages. + # (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-prunning techniques. + delay_this = (key == "setuptools") + + return (delay_this, restrictive, transitive, key) def find_matches(self, requirements): # type: (Sequence[Requirement]) -> Iterable[Candidate]