diff --git a/crates/uv/src/commands/tool/install.rs b/crates/uv/src/commands/tool/install.rs index 768892f2a..4b985a17f 100644 --- a/crates/uv/src/commands/tool/install.rs +++ b/crates/uv/src/commands/tool/install.rs @@ -10,7 +10,7 @@ use tracing::debug; use distribution_types::Name; use pypi_types::Requirement; use uv_cache::Cache; -use uv_client::Connectivity; +use uv_client::{BaseClientBuilder, Connectivity}; use uv_configuration::{Concurrency, PreviewMode, Reinstall}; #[cfg(unix)] use uv_fs::replace_symlink; @@ -40,7 +40,7 @@ pub(crate) async fn install( settings: ResolverInstallerSettings, preview: PreviewMode, toolchain_preference: ToolchainPreference, - _toolchain_fetch: ToolchainFetch, + toolchain_fetch: ToolchainFetch, connectivity: Connectivity, concurrency: Concurrency, native_tls: bool, @@ -51,16 +51,19 @@ pub(crate) async fn install( warn_user_once!("`uv tool install` is experimental and may change without warning."); } - // TODO(zanieb): Use `find_or_fetch` here - let interpreter = Toolchain::find( - &python - .as_deref() - .map(ToolchainRequest::parse) - .unwrap_or_default(), + let client_builder = BaseClientBuilder::new() + .connectivity(connectivity) + .native_tls(native_tls); + + let interpreter = Toolchain::find_or_fetch( + python.as_deref().map(ToolchainRequest::parse), EnvironmentPreference::OnlySystem, toolchain_preference, + toolchain_fetch, + &client_builder, cache, - )? + ) + .await? .into_interpreter(); // Initialize any shared state. diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index ddd4e2622..65bd0f2fa 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -36,7 +36,7 @@ pub(crate) async fn run( _isolated: bool, preview: PreviewMode, toolchain_preference: ToolchainPreference, - _toolchain_fetch: ToolchainFetch, + toolchain_fetch: ToolchainFetch, connectivity: Connectivity, concurrency: Concurrency, native_tls: bool, @@ -77,17 +77,15 @@ pub(crate) async fn run( debug!("Syncing ephemeral environment."); // Discover an interpreter. - // Note we force preview on during `uv tool run` for now since the entire interface is in preview - // TODO(zanieb): We should use `find_or_fetch` here - let interpreter = Toolchain::find( - &python - .as_deref() - .map(ToolchainRequest::parse) - .unwrap_or_default(), + let interpreter = Toolchain::find_or_fetch( + python.as_deref().map(ToolchainRequest::parse), EnvironmentPreference::OnlySystem, toolchain_preference, + toolchain_fetch, + &client_builder, cache, - )? + ) + .await? .into_interpreter(); // Create a virtual environment.