Expose the `--exclude-newer` flag (#2166)

Closes https://github.com/astral-sh/uv/issues/2088
This commit is contained in:
Zanie Blue 2024-03-04 11:51:19 -06:00 committed by GitHub
parent c525fdf2b5
commit ffb69e3f48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View File

@ -348,6 +348,18 @@ command line argument. For example, if you're running uv on Python 3.9, but want
Python 3.8, you can run `uv pip compile --python-version=3.8 requirements.in` to produce a Python 3.8, you can run `uv pip compile --python-version=3.8 requirements.in` to produce a
Python 3.8-compatible resolution. Python 3.8-compatible resolution.
### Reproducible resolution
uv supports an `--exclude-newer` option to limit resolution to distributions published before a specific
date, allowing reproduction of installations regardless of new package releases. The date may be specified
as a RFC 3339 timestamp (e.g., `2006-12-02T02:07:43Z`) or UTC date in the same format (e.g., `2006-12-02`).
Note the package index must support the `upload-time` field as specified in [`PEP 700`](https://peps.python.org/pep-0700/).
If the field is not present for a given distribution, the distribution will be treated as unavailable.
To ensure reproducibility, messages for unsatisfiable resolutions will not mention that distributions were excluded
due to the `--exclude-newer` flag — newer distributions will be treated as if they do not exist.
## Platform support ## Platform support
uv has Tier 1 support for the following platforms: uv has Tier 1 support for the following platforms:

View File

@ -404,7 +404,7 @@ struct PipCompileArgs {
/// ///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same /// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// format (e.g., `2006-12-02`). /// format (e.g., `2006-12-02`).
#[arg(long, value_parser = date_or_datetime, hide = true)] #[arg(long, value_parser = date_or_datetime)]
exclude_newer: Option<DateTime<Utc>>, exclude_newer: Option<DateTime<Utc>>,
/// Specify a package to omit from the output resolution. Its dependencies will still be /// Specify a package to omit from the output resolution. Its dependencies will still be
@ -789,7 +789,7 @@ struct PipInstallArgs {
/// ///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same /// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// format (e.g., `2006-12-02`). /// format (e.g., `2006-12-02`).
#[arg(long, value_parser = date_or_datetime, hide = true)] #[arg(long, value_parser = date_or_datetime)]
exclude_newer: Option<DateTime<Utc>>, exclude_newer: Option<DateTime<Utc>>,
} }
@ -1011,7 +1011,7 @@ struct VenvArgs {
/// ///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same /// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// format (e.g., `2006-12-02`). /// format (e.g., `2006-12-02`).
#[arg(long, value_parser = date_or_datetime, hide = true)] #[arg(long, value_parser = date_or_datetime)]
exclude_newer: Option<DateTime<Utc>>, exclude_newer: Option<DateTime<Utc>>,
#[command(flatten)] #[command(flatten)]

View File

@ -1613,7 +1613,7 @@ optional-dependencies.bar = [
----- stderr ----- ----- stderr -----
error: the argument '--all-extras' cannot be used with '--extra <EXTRA>' error: the argument '--all-extras' cannot be used with '--extra <EXTRA>'
Usage: uv pip compile --cache-dir [CACHE_DIR] --all-extras <SRC_FILE>... Usage: uv pip compile --cache-dir [CACHE_DIR] --exclude-newer <EXCLUDE_NEWER> --all-extras <SRC_FILE>...
For more information, try '--help'. For more information, try '--help'.
"### "###