Skip to content

Commit

Permalink
Show resolution diagnostics after pip install
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 5, 2024
1 parent 2ac562b commit 1b29da4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/uv/src/commands/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
28 changes: 28 additions & 0 deletions crates/uv/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down

0 comments on commit 1b29da4

Please sign in to comment.