diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index abb6cc571..c229c13bd 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2291,6 +2291,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 isolated: bool, + #[command(flatten)] pub installer: ResolverInstallerArgs, diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 686213390..4fbd2ba38 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -654,7 +654,7 @@ async fn run(cli: Cli) -> Result { args.python, args.settings, invocation_source, - globals.isolated, + args.isolated || 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 e242377c7..71482dc7e 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -261,6 +261,7 @@ pub(crate) struct ToolRunSettings { pub(crate) from: Option, pub(crate) with: Vec, pub(crate) with_requirements: Vec, + pub(crate) isolated: bool, pub(crate) show_resolution: bool, pub(crate) python: Option, pub(crate) refresh: Refresh, @@ -276,6 +277,7 @@ impl ToolRunSettings { from, with, with_requirements, + isolated, show_resolution, installer, build, @@ -291,6 +293,7 @@ impl ToolRunSettings { .into_iter() .filter_map(Maybe::into_option) .collect(), + isolated, show_resolution, python, refresh: Refresh::from(refresh),