Skip to content

Commit

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

Requested here: #2988. Seems
reasonable to me given that pip supports it and we already have
`UV_SYSTEM_PYTHON`.

Closes #2988
  • Loading branch information
charliermarsh authored Apr 11, 2024
1 parent 8e5a40e commit d03e9f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,17 @@ uv accepts the following command-line arguments as environment variables:
`lowest-direct`, uv will install the lowest compatible versions of all direct dependencies.
- `UV_PRERELEASE`: Equivalent to the `--prerelease` command-line argument. For example, if set to
`allow`, uv will allow pre-release versions for all dependencies.
- `UV_SYSTEM_PYTHON`: Equivalent to the `--system` command-line argument. If set to `true`, uv
- `UV_SYSTEM_PYTHON`: Equivalent to the `--system` command-line argument. If set to `true`, uv
will use the first Python interpreter found in the system `PATH`.
WARNING: `UV_SYSTEM_PYTHON=true` is intended for use in continuous integration (CI) environments and
should be used with caution, as it can modify the system Python installation.
WARNING: `UV_SYSTEM_PYTHON=true` is intended for use in continuous integration (CI) or
containerized environments and should be used with caution, as modifying the system Python
can lead to unexpected behavior.
- `UV_BREAK_SYSTEM_PACKAGES`: Equivalent to the `--break-system-packages` command-line argument. If
set to `true`, uv will allow the installation of packages that conflict with system-installed
packages.
WARNING: `UV_BREAK_SYSTEM_PACKAGES=true` is intended for use in continuous integration (CI) or
containerized environments and should be used with caution, as modifying the system Python
can lead to unexpected behavior.
- `UV_NATIVE_TLS`: Equivalent to the `--native-tls` command-line argument. If set to `true`, uv
will use the system's trust store instead of the bundled `webpki-roots` crate.
- `UV_INDEX_STRATEGY`: Equivalent to the `--index-strategy` command-line argument. For example, if
Expand Down
6 changes: 3 additions & 3 deletions crates/uv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ struct PipSyncArgs {
/// environments, when installing into Python installations that are managed by an external
/// package manager, like `apt`. It should be used with caution, as such Python installations
/// explicitly recommend against modifications by other package managers (like `uv` or `pip`).
#[clap(long, requires = "discovery")]
#[clap(long, env = "UV_BREAK_SYSTEM_PACKAGES", requires = "discovery")]
break_system_packages: bool,

/// Use legacy `setuptools` behavior when building source distributions without a
Expand Down Expand Up @@ -941,7 +941,7 @@ struct PipInstallArgs {
/// environments, when installing into Python installations that are managed by an external
/// package manager, like `apt`. It should be used with caution, as such Python installations
/// explicitly recommend against modifications by other package managers (like `uv` or `pip`).
#[clap(long, requires = "discovery")]
#[clap(long, env = "UV_BREAK_SYSTEM_PACKAGES", requires = "discovery")]
break_system_packages: bool,

/// Use legacy `setuptools` behavior when building source distributions without a
Expand Down Expand Up @@ -1086,7 +1086,7 @@ struct PipUninstallArgs {
/// environments, when installing into Python installations that are managed by an external
/// package manager, like `apt`. It should be used with caution, as such Python installations
/// explicitly recommend against modifications by other package managers (like `uv` or `pip`).
#[clap(long, requires = "discovery")]
#[clap(long, env = "UV_BREAK_SYSTEM_PACKAGES", requires = "discovery")]
break_system_packages: bool,

/// Run offline, i.e., without accessing the network.
Expand Down

0 comments on commit d03e9f2

Please sign in to comment.