From a1b888d88895d7ab98f896e3de5407317b916109 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 25 Jul 2024 20:23:54 -0400 Subject: [PATCH] Remove use of --isolated in tool run --- crates/uv-cli/src/lib.rs | 4 ++++ crates/uv/src/lib.rs | 2 +- crates/uv/src/settings.rs | 3 +++ crates/uv/tests/tool_run.rs | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index d6159b789abf..a1e1c9b66894 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2287,6 +2287,10 @@ pub struct ToolRunArgs { #[arg(long, value_parser = parse_maybe_file_path)] pub with_requirements: Vec>, + /// Run the tool in an isolated virtual environment, ignoring any already-installed tools. + #[arg(long)] + pub isolate: bool, + #[command(flatten)] pub installer: ResolverInstallerArgs, diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 3746d87ed878..45e8d77cd4af 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -649,7 +649,7 @@ async fn run(cli: Cli) -> Result { args.python, args.settings, invocation_source, - globals.isolated, + args.isolate || globals.isolated, globals.preview, globals.python_preference, globals.python_fetch, diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 72b90fe7cf0d..115d42cb2ea2 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -258,6 +258,7 @@ pub(crate) struct ToolRunSettings { pub(crate) from: Option, pub(crate) with: Vec, pub(crate) with_requirements: Vec, + pub(crate) isolate: bool, pub(crate) python: Option, pub(crate) refresh: Refresh, pub(crate) settings: ResolverInstallerSettings, @@ -272,6 +273,7 @@ impl ToolRunSettings { from, with, with_requirements, + isolate, installer, build, refresh, @@ -286,6 +288,7 @@ impl ToolRunSettings { .into_iter() .filter_map(Maybe::into_option) .collect(), + isolate, python, refresh: Refresh::from(refresh), settings: ResolverInstallerSettings::combine( diff --git a/crates/uv/tests/tool_run.rs b/crates/uv/tests/tool_run.rs index 939ea1235b9a..a36640562e70 100644 --- a/crates/uv/tests/tool_run.rs +++ b/crates/uv/tests/tool_run.rs @@ -347,9 +347,9 @@ fn tool_run_from_install() { warning: `uv tool run` is experimental and may change without warning "###); - // Verify that `--isolated` uses an isolated environment. + // Verify that `--isolate` uses an isolated environment. uv_snapshot!(context.filters(), context.tool_run() - .arg("--isolated") + .arg("--isolate") .arg("black") .arg("--version") .env("UV_TOOL_DIR", tool_dir.as_os_str())