Skip to content

Commit

Permalink
Expose the --exclude-newer flag
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Mar 4, 2024
1 parent c525fdf commit e35149e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-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

uv has Tier 1 support for the following platforms:
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 @@ -404,7 +404,7 @@ struct PipCompileArgs {
///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// 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>>,

/// Specify a package to omit from the output resolution. Its dependencies will still be
Expand Down Expand Up @@ -789,7 +789,7 @@ struct PipInstallArgs {
///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// 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>>,
}

Expand Down Expand Up @@ -1011,7 +1011,7 @@ struct VenvArgs {
///
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
/// 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>>,

#[command(flatten)]
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ optional-dependencies.bar = [
----- stderr -----
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'.
"###
Expand Down

0 comments on commit e35149e

Please sign in to comment.