From 2f386ef440a331af4f160bc807da4cea2bd9b314 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 4 Apr 2024 23:13:01 -0400 Subject: [PATCH] Show resolution diagnostics after `pip install` (#2829) ## Summary These are shown in `pip compile`, but absent from `pip install`. See: #2828. --- crates/uv/src/commands/pip_install.rs | 11 +++++++++++ crates/uv/tests/pip_install_scenarios.rs | 2 ++ 2 files changed, 13 insertions(+) diff --git a/crates/uv/src/commands/pip_install.rs b/crates/uv/src/commands/pip_install.rs index 80281a2f31ac..af1bb8c326af 100644 --- a/crates/uv/src/commands/pip_install.rs +++ b/crates/uv/src/commands/pip_install.rs @@ -595,6 +595,17 @@ async fn resolve( .dimmed() )?; + // Notify the user of any diagnostics. + for diagnostic in resolution.diagnostics() { + writeln!( + printer.stderr(), + "{}{} {}", + "warning".yellow().bold(), + ":".bold(), + diagnostic.message().bold() + )?; + } + Ok(resolution) } diff --git a/crates/uv/tests/pip_install_scenarios.rs b/crates/uv/tests/pip_install_scenarios.rs index f79a30d196e0..54d3bb677c6e 100644 --- a/crates/uv/tests/pip_install_scenarios.rs +++ b/crates/uv/tests/pip_install_scenarios.rs @@ -708,6 +708,7 @@ fn missing_extra() { ----- stderr ----- Resolved 1 package in [TIME] + warning: The package `package-a==1.0.0` does not have an extra named `extra`. Downloaded 1 package in [TIME] Installed 1 package in [TIME] + package-a==1.0.0 @@ -1080,6 +1081,7 @@ fn extra_does_not_exist_backtrack() { ----- stderr ----- Resolved 1 package in [TIME] + warning: The package `package-a==3.0.0` does not have an extra named `extra`. Downloaded 1 package in [TIME] Installed 1 package in [TIME] + package-a==3.0.0