diff --git a/crates/uv/src/commands/pip_install.rs b/crates/uv/src/commands/pip_install.rs index 80281a2f31a..af1bb8c326a 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.rs b/crates/uv/tests/pip_install.rs index acfa3c94729..1cace4bf40a 100644 --- a/crates/uv/tests/pip_install.rs +++ b/crates/uv/tests/pip_install.rs @@ -661,6 +661,34 @@ fn reinstall_incomplete() -> Result<()> { Ok(()) } +/// Request an extra that doesn't exist on the specified package. +#[test] +fn missing_registry_extra() -> Result<()> { + let context = TestContext::new("3.12"); + + uv_snapshot!(context.install() + .arg("black[tensorboard]==23.10.1"), @r###" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Resolved 6 packages in [TIME] + warning: The package `black==23.10.1` does not have an extra named `tensorboard`. + Downloaded 6 packages in [TIME] + Installed 6 packages in [TIME] + + black==23.10.1 + + click==8.1.7 + + mypy-extensions==1.0.0 + + packaging==24.0 + + pathspec==0.12.1 + + platformdirs==4.2.0 + "### + ); + + Ok(()) +} + /// Like `pip`, we (unfortunately) allow incompatible environments. #[test] fn allow_incompatibilities() -> Result<()> {