Add UV_OVERRIDE environment variable for --override (#4836)

Closes https://github.com/astral-sh/uv/issues/4827
This commit is contained in:
Charlie Marsh 2024-07-05 17:03:17 -04:00 committed by GitHub
parent 3fa09a3972
commit f450b45780
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 6 deletions

View file

@ -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 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 - `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. 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 - `UV_LINK_MODE`: Equivalent to the `--link-mode` command-line argument. If set, uv will use this
as a link mode. as a link mode.
- `UV_NO_BUILD_ISOLATION`: Equivalent to the `--no-build-isolation` command-line argument. If set, - `UV_NO_BUILD_ISOLATION`: Equivalent to the `--no-build-isolation` command-line argument. If set,

View file

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

View file

@ -684,7 +684,10 @@ impl PipCompileSettings {
.into_iter() .into_iter()
.filter_map(Maybe::into_option) .filter_map(Maybe::into_option)
.collect(), .collect(),
r#override, r#override: r#override
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
overrides_from_workspace, overrides_from_workspace,
refresh: Refresh::from(refresh), refresh: Refresh::from(refresh),
settings: PipSettings::combine( settings: PipSettings::combine(
@ -890,7 +893,10 @@ impl PipInstallSettings {
.into_iter() .into_iter()
.filter_map(Maybe::into_option) .filter_map(Maybe::into_option)
.collect(), .collect(),
r#override, r#override: r#override
.into_iter()
.filter_map(Maybe::into_option)
.collect(),
dry_run, dry_run,
overrides_from_workspace, overrides_from_workspace,
refresh: Refresh::from(refresh), refresh: Refresh::from(refresh),