uv/crates/uv
liam d51a1e7456
Deduplicate marker-specific dependencies in uv pip tree output (#16078)
Resolves https://github.com/astral-sh/uv/issues/16067

When we build the dependency graph we add an edge per `Requires-Dist`.
If a package publishes multiple marker-guarded requirements (like
pylint’s `dill>=…` for different Python versions), more than one marker
can evaluate to true at runtime, which gives us several edges pointing
to the same installed package node.

To avoid printing the package multiple times, we gather all edges
targeting that node, pass them through a `Cursor`, and aggregate their
requirement details before we print the dependency line. That
aggregation does two things:
  1. If any edge carries a URL, we return that URL immediately.
2. Otherwise we merge all version specifiers into one canonical PEP 440
string.

I've added an integration test, namely `cargo test -p uv --test it
--features pypi -- no_duplicate_dependencies_with_markers` exercises the
new snapshot that installs pylint (with the real dill duplication
scenario present in the original issue) and asserts the tree output,
both with and without `--show-version-specifiers`, now shows a single
dill entry with the merged constraint.
2025-10-01 11:01:41 -05:00
..
src Deduplicate marker-specific dependencies in uv pip tree output (#16078) 2025-10-01 11:01:41 -05:00
tests/it Deduplicate marker-specific dependencies in uv pip tree output (#16078) 2025-10-01 11:01:41 -05:00
Cargo.toml Use a global flags instance for wheel check (#16047) 2025-09-30 00:10:11 +00:00