diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 039ad985c..c57522ac4 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2534,7 +2534,7 @@ pub struct RunArgs { /// /// Implies `--frozen`, as the project dependencies will be ignored (i.e., the lockfile will not /// be updated, since the environment will not be synced regardless). - #[arg(long, conflicts_with = "frozen")] + #[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")] pub no_sync: bool, /// Assert that the `uv.lock` will remain unchanged. @@ -2850,7 +2850,7 @@ pub struct AddArgs { pub extra: Option>, /// Avoid syncing the virtual environment. - #[arg(long, conflicts_with = "frozen")] + #[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")] pub no_sync: bool, /// Assert that the `uv.lock` will remain unchanged. @@ -2919,7 +2919,7 @@ pub struct RemoveArgs { pub optional: Option, /// Avoid syncing the virtual environment after re-locking the project. - #[arg(long, conflicts_with = "frozen")] + #[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")] pub no_sync: bool, /// Assert that the `uv.lock` will remain unchanged. diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md index f744bfa1b..917ebd164 100644 --- a/docs/configuration/environment.md +++ b/docs/configuration/environment.md @@ -71,6 +71,8 @@ uv accepts the following command-line arguments as environment variables: set, uv will use this username for publishing. - `UV_PUBLISH_PASSWORD`: Equivalent to the `--password` command-line argument in `uv publish`. If set, uv will use this password for publishing. +- `UV_NO_SYNC`: Equivalent to the `--no-sync` command-line argument. If set, uv will skip updating + the environment. In each case, the corresponding command-line argument takes precedence over an environment variable. diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 9e92c6d84..4b0c56f30 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -283,6 +283,7 @@ uv run [OPTIONS]

Implies --frozen, as the project dependencies will be ignored (i.e., the lockfile will not be updated, since the environment will not be synced regardless).

+

May also be set with the UV_NO_SYNC environment variable.

--offline

Disable network access.

When disabled, uv will only use locally cached data and locally available files.

@@ -796,6 +797,7 @@ uv add [OPTIONS] >
--no-sync

Avoid syncing the virtual environment

+

May also be set with the UV_NO_SYNC environment variable.

--offline

Disable network access.

When disabled, uv will only use locally cached data and locally available files.

@@ -1112,6 +1114,7 @@ uv remove [OPTIONS] ...
--no-sync

Avoid syncing the virtual environment after re-locking the project

+

May also be set with the UV_NO_SYNC environment variable.

--offline

Disable network access.

When disabled, uv will only use locally cached data and locally available files.