diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 4fb33b032..6fd824cc7 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2865,7 +2865,7 @@ pub struct RunArgs { /// Install any editable dependencies, including the project and any workspace members, as /// non-editable. - #[arg(long)] + #[arg(long, value_parser = clap::builder::BoolishValueParser::new(), env = EnvVars::UV_NO_EDITABLE)] pub no_editable: bool, /// Do not remove extraneous packages present in the environment. @@ -3146,7 +3146,7 @@ pub struct SyncArgs { /// Install any editable dependencies, including the project and any workspace members, as /// non-editable. - #[arg(long)] + #[arg(long, value_parser = clap::builder::BoolishValueParser::new(), env = EnvVars::UV_NO_EDITABLE)] pub no_editable: bool, /// Do not remove extraneous packages present in the environment. diff --git a/crates/uv-static/src/env_vars.rs b/crates/uv-static/src/env_vars.rs index 4a640e5fa..e66c6581c 100644 --- a/crates/uv-static/src/env_vars.rs +++ b/crates/uv-static/src/env_vars.rs @@ -158,6 +158,11 @@ impl EnvVars { /// will compile Python source files to bytecode after installation. pub const UV_COMPILE_BYTECODE: &'static str = "UV_COMPILE_BYTECODE"; + /// Equivalent to the `--no-editable` command-line argument. If set, uv + /// installs any editable dependencies, including the project and any workspace members, as + /// non-editable + pub const UV_NO_EDITABLE: &'static str = "UV_NO_EDITABLE"; + /// Equivalent to the `--no-binary` command-line argument. If set, uv will install /// all packages from source. The resolver will still use pre-built wheels to /// extract package metadata, if available. diff --git a/crates/uv/tests/it/sync.rs b/crates/uv/tests/it/sync.rs index 2d2e97757..fb5b3fe04 100644 --- a/crates/uv/tests/it/sync.rs +++ b/crates/uv/tests/it/sync.rs @@ -5392,6 +5392,16 @@ fn sync_no_editable() -> Result<()> { + root==0.1.0 (from file://[TEMP_DIR]/) "###); + uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_NO_EDITABLE, "1"), @r" + success: true + exit_code: 0 + ----- stdout ----- + + ----- stderr ----- + Resolved 2 packages in [TIME] + Audited 2 packages in [TIME] + "); + // Remove the project. fs_err::remove_dir_all(&child)?; diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md index ee018a234..b93016c5d 100644 --- a/docs/configuration/environment.md +++ b/docs/configuration/environment.md @@ -225,6 +225,12 @@ Equivalent to the `--no-config` command-line argument. If set, uv will not read any configuration files from the current directory, parent directories, or user configuration directories. +### `UV_NO_EDITABLE` + +Equivalent to the `--no-editable` command-line argument. If set, uv +installs any editable dependencies, including the project and any workspace members, as +non-editable + ### `UV_NO_ENV_FILE` Ignore `.env` files when executing `uv run` commands. diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 5916ab7ba..5b93708e9 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -345,6 +345,7 @@ uv run [OPTIONS] [COMMAND]
--no-editableInstall any editable dependencies, including the project and any workspace members, as non-editable
+May also be set with the UV_NO_EDITABLE environment variable.
--no-env-fileAvoid reading environment variables from a .env file
May also be set with the UV_NO_ENV_FILE environment variable.
--no-editableInstall any editable dependencies, including the project and any workspace members, as non-editable
+May also be set with the UV_NO_EDITABLE environment variable.
--no-extra no-extraExclude the specified optional dependencies, if --all-extras is supplied.
May be provided multiple times.