Skip to content

Commit

Permalink
Add UV_VENV_SEED environment variable (#10715)
Browse files Browse the repository at this point in the history
## Summary

Closes #7655.
  • Loading branch information
charliermarsh authored Jan 17, 2025
1 parent 8111650 commit 1f29165
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions crates/uv-static/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
7 changes: 7 additions & 0 deletions docs/configuration/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8072,8 +8072,9 @@ uv venv [OPTIONS] [PATH]

</dd><dt><code>--seed</code></dt><dd><p>Install seed packages (one or more of: <code>pip</code>, <code>setuptools</code>, and <code>wheel</code>) into the virtual environment.</p>

<p>Note <code>setuptools</code> and <code>wheel</code> are not included in Python 3.12+ environments.</p>
<p>Note that <code>setuptools</code> and <code>wheel</code> are not included in Python 3.12+ environments.</p>

<p>May also be set with the <code>UV_VENV_SEED</code> environment variable.</p>
</dd><dt><code>--system-site-packages</code></dt><dd><p>Give the virtual environment access to the system site packages directory.</p>

<p>Unlike <code>pip</code>, when a virtual environment is created with <code>--system-site-packages</code>, uv will <em>not</em> take system site packages into account when running commands like <code>uv pip list</code> or <code>uv pip install</code>. The <code>--system-site-packages</code> 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.</p>
Expand Down

0 comments on commit 1f29165

Please sign in to comment.