Fetch managed toolchains in uv run (#4143)

This commit is contained in:
Zanie Blue 2024-06-10 10:20:44 -04:00 committed by GitHub
parent 45df889fe4
commit a2e6aaa0ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,7 @@ use tokio::process::Command;
use tracing::debug; use tracing::debug;
use uv_cache::Cache; use uv_cache::Cache;
use uv_client::Connectivity; use uv_client::{BaseClientBuilder, Connectivity};
use uv_configuration::{ExtrasSpecification, PreviewMode, Upgrade}; use uv_configuration::{ExtrasSpecification, PreviewMode, Upgrade};
use uv_distribution::{ProjectWorkspace, Workspace}; use uv_distribution::{ProjectWorkspace, Workspace};
use uv_normalize::PackageName; use uv_normalize::PackageName;
@ -40,6 +40,8 @@ pub(crate) async fn run(
cache: &Cache, cache: &Cache,
printer: Printer, printer: Printer,
) -> Result<ExitStatus> { ) -> Result<ExitStatus> {
let client_builder = BaseClientBuilder::new().connectivity(connectivity);
if preview.is_disabled() { if preview.is_disabled() {
warn_user!("`uv run` is experimental and may change without warning."); warn_user!("`uv run` is experimental and may change without warning.");
} }
@ -110,12 +112,14 @@ pub(crate) async fn run(
project_env.interpreter().clone() project_env.interpreter().clone()
} else { } else {
// Note we force preview on during `uv run` for now since the entire interface is in preview // Note we force preview on during `uv run` for now since the entire interface is in preview
Toolchain::find( Toolchain::find_or_fetch(
python.as_deref(), python.as_deref(),
SystemPython::Allowed, SystemPython::Allowed,
PreviewMode::Enabled, PreviewMode::Enabled,
client_builder,
cache, cache,
)? )
.await?
.into_interpreter() .into_interpreter()
}; };