mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-17 02:52:45 +00:00
Reframe use of --isolated in tool run (#5470)
## Summary This PR gets rid of the global `--isolated` flag (which serves a bunch of independent responsibilities right now) on `uv tool run` in favor of a dedicated `--isolated` flag, which tells uv to avoid re-using an existing tool environment for this invocation. We'll add the same thing to `uv run`, to avoid using the base project environment. This will become a bit clearer in #5466, when we deprecate the `--isolated` flag on the preview APIs.
This commit is contained in:
parent
8545ae2312
commit
ff3bcbb639
3 changed files with 8 additions and 1 deletions
|
|
@ -2291,6 +2291,10 @@ pub struct ToolRunArgs {
|
||||||
#[arg(long, value_parser = parse_maybe_file_path)]
|
#[arg(long, value_parser = parse_maybe_file_path)]
|
||||||
pub with_requirements: Vec<Maybe<PathBuf>>,
|
pub with_requirements: Vec<Maybe<PathBuf>>,
|
||||||
|
|
||||||
|
/// Run the tool in an isolated virtual environment, ignoring any already-installed tools.
|
||||||
|
#[arg(long)]
|
||||||
|
pub isolated: bool,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
pub installer: ResolverInstallerArgs,
|
pub installer: ResolverInstallerArgs,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -654,7 +654,7 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
|
||||||
args.python,
|
args.python,
|
||||||
args.settings,
|
args.settings,
|
||||||
invocation_source,
|
invocation_source,
|
||||||
globals.isolated,
|
args.isolated || globals.isolated,
|
||||||
globals.preview,
|
globals.preview,
|
||||||
globals.python_preference,
|
globals.python_preference,
|
||||||
globals.python_fetch,
|
globals.python_fetch,
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,7 @@ pub(crate) struct ToolRunSettings {
|
||||||
pub(crate) from: Option<String>,
|
pub(crate) from: Option<String>,
|
||||||
pub(crate) with: Vec<String>,
|
pub(crate) with: Vec<String>,
|
||||||
pub(crate) with_requirements: Vec<PathBuf>,
|
pub(crate) with_requirements: Vec<PathBuf>,
|
||||||
|
pub(crate) isolated: bool,
|
||||||
pub(crate) show_resolution: bool,
|
pub(crate) show_resolution: bool,
|
||||||
pub(crate) python: Option<String>,
|
pub(crate) python: Option<String>,
|
||||||
pub(crate) refresh: Refresh,
|
pub(crate) refresh: Refresh,
|
||||||
|
|
@ -276,6 +277,7 @@ impl ToolRunSettings {
|
||||||
from,
|
from,
|
||||||
with,
|
with,
|
||||||
with_requirements,
|
with_requirements,
|
||||||
|
isolated,
|
||||||
show_resolution,
|
show_resolution,
|
||||||
installer,
|
installer,
|
||||||
build,
|
build,
|
||||||
|
|
@ -291,6 +293,7 @@ impl ToolRunSettings {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(Maybe::into_option)
|
.filter_map(Maybe::into_option)
|
||||||
.collect(),
|
.collect(),
|
||||||
|
isolated,
|
||||||
show_resolution,
|
show_resolution,
|
||||||
python,
|
python,
|
||||||
refresh: Refresh::from(refresh),
|
refresh: Refresh::from(refresh),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue