diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 053e1eb78a06..8714e36c0db9 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2365,8 +2365,8 @@ pub struct VenvArgs { /// Install seed packages (one or more of: `pip`, `setuptools`, and `wheel`) into the virtual environment. /// - /// Note `setuptools` and `wheel` are not included in Python 3.12+ environments. - #[arg(long)] + /// Note that `setuptools` and `wheel` are not included in Python 3.12+ environments. + #[arg(long, value_parser = clap::builder::BoolishValueParser::new(), env = EnvVars::UV_VENV_SEED)] pub seed: bool, /// Preserve any existing files or directories at the target path. diff --git a/crates/uv-static/src/env_vars.rs b/crates/uv-static/src/env_vars.rs index 1bfe16ae0537..c21bd6bd5c65 100644 --- a/crates/uv-static/src/env_vars.rs +++ b/crates/uv-static/src/env_vars.rs @@ -234,6 +234,12 @@ impl EnvVars { /// Distributions can be read from a local directory by using the `file://` URL scheme. pub const UV_PYPY_INSTALL_MIRROR: &'static str = "UV_PYPY_INSTALL_MIRROR"; + /// Install seed packages (one or more of: `pip`, `setuptools`, and `wheel`) into the virtual environment + /// created by `uv venv`. + /// + /// Note that `setuptools` and `wheel` are not included in Python 3.12+ environments. + pub const UV_VENV_SEED: &'static str = "UV_VENV_SEED"; + /// Used to override `PATH` to limit Python executable availability in the test suite. #[attr_hidden] pub const UV_TEST_PYTHON_PATH: &'static str = "UV_TEST_PYTHON_PATH"; diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md index 4b8876b5f5d8..31732a1c0de9 100644 --- a/docs/configuration/environment.md +++ b/docs/configuration/environment.md @@ -341,6 +341,13 @@ Specifies the directory where uv stores managed tools. Used ephemeral environments like CI to install uv to a specific path while preventing the installer from modifying shell profiles or environment variables. +### `UV_VENV_SEED` + +Install seed packages (one or more of: `pip`, `setuptools`, and `wheel`) into the virtual environment +created by `uv venv`. + +Note that `setuptools` and `wheel` are not included in Python 3.12+ environments. + ## Externally defined variables diff --git a/docs/reference/cli.md b/docs/reference/cli.md index c06aba3f148d..b2c296f261c3 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -8072,8 +8072,9 @@ uv venv [OPTIONS] [PATH]
--seed

Install seed packages (one or more of: pip, setuptools, and wheel) into the virtual environment.

-

Note setuptools and wheel are not included in Python 3.12+ environments.

+

Note that setuptools and wheel are not included in Python 3.12+ environments.

+

May also be set with the UV_VENV_SEED environment variable.

--system-site-packages

Give the virtual environment access to the system site packages directory.

Unlike pip, when a virtual environment is created with --system-site-packages, uv will not take system site packages into account when running commands like uv pip list or uv pip install. The --system-site-packages flag will provide the virtual environment with access to the system site packages directory at runtime, but will not affect the behavior of uv commands.