diff --git a/Cargo.lock b/Cargo.lock index 44101f6cc..10e724de1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4934,6 +4934,7 @@ dependencies = [ "install-wheel-rs", "itertools 0.13.0", "once_cell", + "owo-colors", "pep440_rs", "pep508_rs", "platform-tags", diff --git a/crates/uv-python/Cargo.toml b/crates/uv-python/Cargo.toml index 54e10215e..9bb55e88a 100644 --- a/crates/uv-python/Cargo.toml +++ b/crates/uv-python/Cargo.toml @@ -34,6 +34,7 @@ fs-err = { workspace = true, features = ["tokio"] } futures = { workspace = true } itertools = { workspace = true } once_cell = { workspace = true } +owo-colors = { workspace = true } regex = { workspace = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } diff --git a/crates/uv-python/src/downloads.rs b/crates/uv-python/src/downloads.rs index 0ef50096a..45bf71ae3 100644 --- a/crates/uv-python/src/downloads.rs +++ b/crates/uv-python/src/downloads.rs @@ -6,6 +6,7 @@ use std::str::FromStr; use std::task::{Context, Poll}; use futures::TryStreamExt; +use owo_colors::OwoColorize; use thiserror::Error; use tokio::io::{AsyncRead, ReadBuf}; use tokio_util::compat::FuturesAsyncReadCompatExt; @@ -30,9 +31,9 @@ pub enum Error { IO(#[from] io::Error), #[error(transparent)] ImplementationError(#[from] ImplementationError), - #[error("Invalid python version: {0}")] + #[error("Invalid Python version: {0}")] InvalidPythonVersion(String), - #[error("Invalid request key, too many parts: {0}")] + #[error("Invalid request key (too many parts): {0}")] TooManyParts(String), #[error("Download failed")] NetworkError(#[from] WrappedReqwestError), @@ -48,7 +49,7 @@ pub enum Error { expected: String, actual: String, }, - #[error("Invalid download url")] + #[error("Invalid download URL")] InvalidUrl(#[from] url::ParseError), #[error("Failed to create download directory")] DownloadDirError(#[source] io::Error), @@ -64,12 +65,9 @@ pub enum Error { #[source] err: io::Error, }, - #[error("Failed to parse managed Python directory name: {0}")] - NameError(String), #[error("Failed to parse request part")] InvalidRequestPlatform(#[from] platform::Error), - // TODO(zanieb): Implement display for `PythonDownloadRequest` - #[error("No download found for request: {0:?}")] + #[error("No download found for request: {}", _0.green())] NoDownloadFound(PythonDownloadRequest), } diff --git a/crates/uv/src/commands/python/install.rs b/crates/uv/src/commands/python/install.rs index 1a37129f4..181368634 100644 --- a/crates/uv/src/commands/python/install.rs +++ b/crates/uv/src/commands/python/install.rs @@ -91,7 +91,7 @@ pub(crate) async fn install( .find(|installation| download_request.satisfied_by_key(installation.key())) { if matches!(request, PythonRequest::Any) { - writeln!(printer.stderr(), "Found: {}", installation.key().green(),)?; + writeln!(printer.stderr(), "Found: {}", installation.key().green())?; } else { writeln!( printer.stderr(),