Skip to content

Commit

Permalink
Remove use of --isolated in tool run
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 29, 2024
1 parent f96e87e commit a1b888d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,10 @@ pub struct ToolRunArgs {
#[arg(long, value_parser = parse_maybe_file_path)]
pub with_requirements: Vec<Maybe<PathBuf>>,

/// Run the tool in an isolated virtual environment, ignoring any already-installed tools.
#[arg(long)]
pub isolate: bool,

#[command(flatten)]
pub installer: ResolverInstallerArgs,

Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
args.python,
args.settings,
invocation_source,
globals.isolated,
args.isolate || globals.isolated,
globals.preview,
globals.python_preference,
globals.python_fetch,
Expand Down
3 changes: 3 additions & 0 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ pub(crate) struct ToolRunSettings {
pub(crate) from: Option<String>,
pub(crate) with: Vec<String>,
pub(crate) with_requirements: Vec<PathBuf>,
pub(crate) isolate: bool,
pub(crate) python: Option<String>,
pub(crate) refresh: Refresh,
pub(crate) settings: ResolverInstallerSettings,
Expand All @@ -272,6 +273,7 @@ impl ToolRunSettings {
from,
with,
with_requirements,
isolate,
installer,
build,
refresh,
Expand All @@ -286,6 +288,7 @@ impl ToolRunSettings {
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
isolate,
python,
refresh: Refresh::from(refresh),
settings: ResolverInstallerSettings::combine(
Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/tool_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit a1b888d

Please sign in to comment.