Skip to content

Commit

Permalink
Merge pull request #9101 from uranusjr/new-resolver-error-message-dedup
Browse files Browse the repository at this point in the history
Use set to dedup package list in error message
  • Loading branch information
pradyunsg authored Nov 14, 2020
2 parents 7aef258 + bf55229 commit c09549c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/9101.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New resolver: Show each requirement in the conflict error message only once to reduce cluttering.
6 changes: 3 additions & 3 deletions src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,19 @@ def describe_trigger(parent):
# type: (Candidate) -> str
ireq = parent.get_install_requirement()
if not ireq or not ireq.comes_from:
return "{} {}".format(parent.name, parent.version)
return "{}=={}".format(parent.name, parent.version)
if isinstance(ireq.comes_from, InstallRequirement):
return str(ireq.comes_from.name)
return str(ireq.comes_from)

triggers = []
triggers = set()
for req, parent in e.causes:
if parent is None:
# This is a root requirement, so we can report it directly
trigger = req.format_for_error()
else:
trigger = describe_trigger(parent)
triggers.append(trigger)
triggers.add(trigger)

if triggers:
info = text_join(sorted(triggers))
Expand Down

0 comments on commit c09549c

Please sign in to comment.