From 71f59987522575ff67658f97518c66cc97e5b3b7 Mon Sep 17 00:00:00 2001 From: leaf-soba Date: Wed, 28 Aug 2024 23:48:17 +0800 Subject: [PATCH] Avoid showing duplicate paths in `uv python list` (#6740) ## Summary - Resolves issue #6690 ## Test Plan ``` $ cargo run python list ``` --------- Co-authored-by: leaf-soba Co-authored-by: Zanie Blue --- crates/uv/src/commands/python/list.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/uv/src/commands/python/list.rs b/crates/uv/src/commands/python/list.rs index e9d086af0..bde8d249c 100644 --- a/crates/uv/src/commands/python/list.rs +++ b/crates/uv/src/commands/python/list.rs @@ -104,8 +104,16 @@ pub(crate) async fn list( let mut seen_minor = HashSet::new(); let mut seen_patch = HashSet::new(); + let mut seen_paths = HashSet::new(); let mut include = Vec::new(); for (version, os, key, kind, path) in output.iter().rev() { + // Do not show the same path more than once + if let Some(path) = path { + if !seen_paths.insert(path) { + continue; + } + } + // Only show the latest patch version for each download unless all were requested if !matches!(kind, Kind::System) { if let [major, minor, ..] = version.release() {