Skip to content

Commit 7c82696

Browse files
committed
Present found conflicts when discarding some criterion
Fixes gh-9254. Closes gh-10258. See #10258 (comment) for inspiration.
1 parent 61e85bf commit 7c82696

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None:
4242
message = self._messages_at_reject_count[count]
4343
logger.info("INFO: %s", message.format(package_name=candidate.name))
4444

45+
msg = "Will try a different candidate, due to conflict:"
46+
for req_info in criterion.information:
47+
req, parent = req_info.requirement, req_info.parent
48+
# Inspired by Factory.get_installation_error
49+
msg += "\n "
50+
if parent:
51+
msg += f"{parent.name} {parent.version} depends on "
52+
else:
53+
msg += "The user requested "
54+
msg += req.format_for_error()
55+
logger.debug(msg)
56+
4557

4658
class PipDebuggingReporter(BaseReporter):
4759
"""A reporter that does an info log for every event it sees."""

0 commit comments

Comments
 (0)