diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 3999e5144..b3e81906e 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -312,7 +312,7 @@ pub struct GlobalArgs { /// parent directories, or user configuration directories. /// /// This option is deprecated in favor of `--no-config`. - #[arg(global = true, long, hide = true)] + #[arg(global = true, long, hide = true, env = EnvVars::UV_ISOLATED, value_parser = clap::builder::BoolishValueParser::new())] pub isolated: bool, /// Show the resolved settings for the current command. @@ -3169,7 +3169,7 @@ pub struct RunArgs { /// /// When used with `--with` or `--with-requirements`, the additional dependencies will still be /// layered in a second environment. - #[arg(long)] + #[arg(long, env = EnvVars::UV_ISOLATED, value_parser = clap::builder::BoolishValueParser::new())] pub isolated: bool, /// Prefer the active virtual environment over the project's virtual environment. @@ -4476,7 +4476,7 @@ pub struct ToolRunArgs { pub overrides: Vec>, /// Run the tool in an isolated virtual environment, ignoring any already-installed tools. - #[arg(long)] + #[arg(long, env = EnvVars::UV_ISOLATED, value_parser = clap::builder::BoolishValueParser::new())] pub isolated: bool, /// Load environment variables from a `.env` file. diff --git a/crates/uv-static/src/env_vars.rs b/crates/uv-static/src/env_vars.rs index 42bb7c554..4a1011f29 100644 --- a/crates/uv-static/src/env_vars.rs +++ b/crates/uv-static/src/env_vars.rs @@ -136,6 +136,10 @@ impl EnvVars { /// directories. pub const UV_NO_CONFIG: &'static str = "UV_NO_CONFIG"; + /// Equivalent to the `--isolated` command-line argument. If set, uv will avoid discovering + /// a `pyproject.toml` or `uv.toml` file. + pub const UV_ISOLATED: &'static str = "UV_ISOLATED"; + /// Equivalent to the `--exclude-newer` command-line argument. If set, uv will /// exclude distributions published after the specified date. pub const UV_EXCLUDE_NEWER: &'static str = "UV_EXCLUDE_NEWER"; diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 148cdebb4..b24860531 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -143,7 +143,7 @@ uv run [OPTIONS] [COMMAND]

Usually, the project environment is reused for performance. This option forces a fresh environment to be used for the project, enforcing strict isolation between dependencies and declaration of requirements.

An editable installation is still used for the project.

When used with --with or --with-requirements, the additional dependencies will still be layered in a second environment.

-
--keyring-provider keyring-provider

Attempt to use keyring for authentication for index URLs.

+

May also be set with the UV_ISOLATED environment variable.

--keyring-provider keyring-provider

Attempt to use keyring for authentication for index URLs.

At present, only --keyring-provider subprocess is supported, which configures uv to use the keyring CLI to handle authentication.

Defaults to disabled.

May also be set with the UV_KEYRING_PROVIDER environment variable.

Possible values:

@@ -2034,7 +2034,7 @@ uv tool run [OPTIONS] [COMMAND]

Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.

The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url flag.

May also be set with the UV_INDEX_URL environment variable.

--isolated

Run the tool in an isolated virtual environment, ignoring any already-installed tools

-
--keyring-provider keyring-provider

Attempt to use keyring for authentication for index URLs.

+

May also be set with the UV_ISOLATED environment variable.

--keyring-provider keyring-provider

Attempt to use keyring for authentication for index URLs.

At present, only --keyring-provider subprocess is supported, which configures uv to use the keyring CLI to handle authentication.

Defaults to disabled.

May also be set with the UV_KEYRING_PROVIDER environment variable.

Possible values:

diff --git a/docs/reference/environment.md b/docs/reference/environment.md index 2a5131048..f0a73fce3 100644 --- a/docs/reference/environment.md +++ b/docs/reference/environment.md @@ -191,6 +191,11 @@ in lieu of the default GitHub URL. The directory in which to install uv using the standalone installer and `self update` feature. Defaults to `~/.local/bin`. +### `UV_ISOLATED` + +Equivalent to the `--isolated` command-line argument. If set, uv will avoid discovering +a `pyproject.toml` or `uv.toml` file. + ### `UV_KEYRING_PROVIDER` Equivalent to the `--keyring-provider` command-line argument. If set, uv