Skip to content

Commit

Permalink
Add UV_OVERRIDE environment variable for --override
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 5, 2024
1 parent 3fa09a3 commit 991e79f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ uv accepts the following command-line arguments as environment variables:
uv will require that all dependencies have a hash specified in the requirements file.
- `UV_CONSTRAINT`: Equivalent to the `--constraint` command-line argument. If set, uv will use this
file as the constraints file. Uses space-separated list of files.
- `UV_OVERRIDE`: Equivalent to the `--override` command-line argument. If set, uv will use this
file as the overrides file. Uses space-separated list of files.
- `UV_LINK_MODE`: Equivalent to the `--link-mode` command-line argument. If set, uv will use this
as a link mode.
- `UV_NO_BUILD_ISOLATION`: Equivalent to the `--no-build-isolation` command-line argument. If set,
Expand Down
8 changes: 4 additions & 4 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ pub struct PipCompileArgs {
/// While constraints are _additive_, in that they're combined with the requirements of the
/// constituent packages, overrides are _absolute_, in that they completely replace the
/// requirements of the constituent packages.
#[arg(long, value_parser = parse_file_path)]
pub r#override: Vec<PathBuf>,
#[arg(long, env = "UV_OVERRIDE", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
pub r#override: Vec<Maybe<PathBuf>>,

/// Include optional dependencies from the extra group name; may be provided more than once.
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
Expand Down Expand Up @@ -906,8 +906,8 @@ pub struct PipInstallArgs {
/// While constraints are _additive_, in that they're combined with the requirements of the
/// constituent packages, overrides are _absolute_, in that they completely replace the
/// requirements of the constituent packages.
#[arg(long, value_parser = parse_file_path)]
pub r#override: Vec<PathBuf>,
#[arg(long, env = "UV_OVERRIDE", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
pub r#override: Vec<Maybe<PathBuf>>,

/// Include optional dependencies from the extra group name; may be provided more than once.
/// Only applies to `pyproject.toml`, `setup.py`, and `setup.cfg` sources.
Expand Down
10 changes: 8 additions & 2 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ impl PipCompileSettings {
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
r#override,
r#override: r#override
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
overrides_from_workspace,
refresh: Refresh::from(refresh),
settings: PipSettings::combine(
Expand Down Expand Up @@ -890,7 +893,10 @@ impl PipInstallSettings {
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
r#override,
r#override: r#override
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
dry_run,
overrides_from_workspace,
refresh: Refresh::from(refresh),
Expand Down

0 comments on commit 991e79f

Please sign in to comment.