From fd28a93222859e895fc34023e568c2df0a63d5c1 Mon Sep 17 00:00:00 2001 From: Damian Shaw Date: Wed, 23 Oct 2024 18:56:39 -0400 Subject: [PATCH] Very verbose resolution --- .../resolution/resolvelib/reporter.py | 42 +++++-------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/src/pip/_internal/resolution/resolvelib/reporter.py b/src/pip/_internal/resolution/resolvelib/reporter.py index 0594569d850..566ab55a280 100644 --- a/src/pip/_internal/resolution/resolvelib/reporter.py +++ b/src/pip/_internal/resolution/resolvelib/reporter.py @@ -10,39 +10,17 @@ class PipReporter(BaseReporter): - def __init__(self) -> None: - self.reject_count_by_package: DefaultDict[str, int] = defaultdict(int) - - self._messages_at_reject_count = { - 1: ( - "pip is looking at multiple versions of {package_name} to " - "determine which version is compatible with other " - "requirements. This could take a while." - ), - 8: ( - "pip is still looking at multiple versions of {package_name} to " - "determine which version is compatible with other " - "requirements. This could take a while." - ), - 13: ( - "This is taking longer than usual. You might need to provide " - "the dependency resolver with stricter constraints to reduce " - "runtime. See https://pip.pypa.io/warnings/backtracking for " - "guidance. If you want to abort this run, press Ctrl + C." - ), - } + def adding_requirement(self, requirement: Requirement, parent: Requirement) -> None: + if parent: + logger.info("Adding requirement %s (from %s)", requirement, parent) + else: + logger.info("Adding requirement %s", requirement) - def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: - self.reject_count_by_package[candidate.name] += 1 - - count = self.reject_count_by_package[candidate.name] - if count not in self._messages_at_reject_count: - return - - message = self._messages_at_reject_count[count] - logger.info("INFO: %s", message.format(package_name=candidate.name)) + def pinning(self, candidate: Candidate) -> None: + logger.info("Pinning %s %s", candidate.name, candidate.version) - msg = "Will try a different candidate, due to conflict:" + def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: + msg = f"Rejecting {candidate.name} {candidate.version}, due to conflict:" for req_info in criterion.information: req, parent = req_info.requirement, req_info.parent # Inspired by Factory.get_installation_error @@ -52,7 +30,7 @@ def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: else: msg += "The user requested " msg += req.format_for_error() - logger.debug(msg) + logger.info(msg) class PipDebuggingReporter(BaseReporter):