astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
21.31k stars 624 forks source link

Show the source of conflicting dependencies #1854

Open zanieb opened 7 months ago

zanieb commented 7 months ago

When dependencies directly conflict, we should show which file we loaded them from.

e.g.

× No solution found when resolving dependencies:
╰─▶ Because you require filelock==1.0.0 and you require filelock==3.8.0, we
    can conclude that the requirements are unsatisfiable.

from compile_constraints_incompatible_version could say

× No solution found when resolving dependencies:
╰─▶ Because you require filelock==1.0.0 (from requirements.txt) and you require filelock==3.8.0 (from constraints.txt), we
    can conclude that the requirements are unsatisfiable.

Originally mentioned at https://github.com/astral-sh/uv/pull/1796/files#r1498258800

telamonian commented 1 month ago

@zanieb I need this functionality for for an app installer tool that I'm writing. If you're willing to point out the files and rough line numbers that need to change, I would be happy to contribute a fix for this.