Commit Graph

600 Commits

Author SHA1 Message Date
William Woodruff ceb0058626 uv audit: --ignore and --ignore-until-fixed (#18737)
## Summary

This adds two new options to `uv audit` plus their corresponding config
fields: `--ignore` and `--ignore-until-fixed`. These do pretty much what
they say on the tin:

- `--ignore ID` ignores the given vulnerability by ID, unconditionally.
Any ID (including aliases) can be used, since it's common for people to
use CVE IDs even though we consider PYSEC and OSV "more" canonical.
- `--ignore-until-fixed ID` ignores the given vulnerability by ID
*until* a fix version appears.

Both options are additive, i.e. can be passed multiple times. I've also
implemented a `[tool.uv.audit]` section that these will live under on
the config side.

Please bikeshed the naming, I'm not confident on it!

See https://github.com/astral-sh/uv/issues/18506.

## Test Plan

Added unit tests for both the CLI and config pathways.

---------

Signed-off-by: William Woodruff <william@astral.sh>
2026-03-30 11:03:06 -04:00
Aria Desires 202e0f0831 Expand uv workspace metadata with dependency information from the lock (#18356)
## Summary

This expands `uv workspace metadata` with many of the fields that are
found in `uv.lock` so that we have a format with information about the
dependency graph/resolution that we're willing to call stable and have
people rely upon (rather than `uv.lock` which we'd rather you don't try
to interpret).

To a first approximation you can think of this as "uv.lock but
serialized to json" but with the fields a bit more limited for now (easy
to add later).

The biggest intentional divergence with uv.lock is that we favour
encoding the dependency graph in a form that looks more like our
internal "resolve" graph, in that hopes that it will simplify the work
of anyone doing analysis on the graph (we structure our internal graph
like this for a reason).

Specifically, the `resolve` field contains the entire dependency graph,
with packages desugarred into several different nodes. There are 4 kinds
of nodes (really 3, the build nodes will only be introduced when we
establish build-dependency locking):

* packages: `mypackage==1.0.0 @ registry+https://pypi.org/simple`
* extras: `mypackage[myextra]==1.0.0 @ registry+https://pypi.org/simple`
* groups: `mypackage:mygroup==1.0.0 @ registry+https://pypi.org/simple`
* build:    `mypackage(build)==1.0.0 @ registry+https://pypi.org/simple`

package nodes hold additional metadata about the package itself, and ids
of the associated extra/group/build nodes.

---

A package like this:

```toml
[project]
name = "mypackage"
version = "1.0.0"

dependencies = ["httpx"]

[project.optional-dependencies]
cli = ["rich"]

[dependency-groups]
dev = ["typing-extensions"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```

will get 4 nodes with the following edges (Version and Source omitted
here for brevity):
* `mypackage`
  * `httpx`
* `mypackage(build)`
  * `hatchling`
* `mypackage[cli]`
  * `mypackage`
  * `rich`
* `mypackage:dev`
  * `typing-extensions`
  
Note that `mypackage[cli]` has a dependency edge on `mypackage` while
`mypackage:dev` does not. This is because
`mypackage[cli]` is fundamentally an augmentation of `mypackage` while
`mypackage:dev` is just a list of packages that happens to be defined by
`mypackage`'s pyproject.toml.
 
 The resulting nodes for `mypackage` will look something like:
 
 <details>
 <summary>json blob</summary>
 
```json
{
  "resolve": {
    "mypackage==1.0.0 @ editable+.": {
      "name": "mypackage",
      "version": "1.0.0",
      "source": {
        "editable": "."
      },
      "kind": "package",
      "dependencies": [
        {
          "id": "httpx==3.6 @ registry+https://pypi.org/simple"
          "marker": "sys_platform == 'linux'"
        },
      ],
      "optional_dependencies": [
        {
          "name": "cli",
          "id": "mypackage[cli]==1.0.0 @ editable+."
        },
      ],
      "dependency_groups": [
        {
          "name": "dev",
          "id": "mypackage:dev==1.0.0 @ editable+."
        }
      ]
      "build_system": {
        "build_backend": "hatchling.build",
        "id": "mypackage(build)==1.0.0 @ editable+."
      }
      "sdist": { ... },
      "wheels": [ ... ]
    },
    "mypackage:dev==1.0.0 @ editable+.": {
        "name": "mypackage",
        "version": "1.0.0",
        "source": {
          "editable": "."
        },
        "kind": {
          "group": "dev"
        },
        "dependencies": [
          {
            "id": "typing-extensions==1.2.3 @ registry+https://pypi.org/simple"
          },
        ]
      },
   }
   "mypackage[cli]==1.0.0 @ editable+.": {
      "name": "mypackage",
      "version": "1.0.0",
      "source": {
        "editable": "."
      },
      "kind": {
        "extra": "cli"
      },
      "dependencies": [
        {
          "id": "rich==2.2.3 @ registry+https://pypi.org/simple"
        },
        {
          "id": "mypackage==1.0.0 @ editable+."
        },
      ]
    },
    "mypackage(build)==1.0.0 @ editable+.": {
      "name": "mypackage",
      "version": "1.0.0",
      "source": {
        "editable": "."
      },
      "kind": "build",
      "dependencies": [
        {
          "id": "hatchling==3.2.3 @ registry+https://pypi.org/simple"
        },
      ]
    }
  }
}
```

</details>

## Test Plan

Snapshots
2026-03-27 09:22:03 -04:00
Zanie Blue 02036a8ba5 Bump version to 0.11.2 (#18732) 2026-03-26 20:44:25 +00:00
William Woodruff 25d5549836 Evaluate extras and groups when determining auditable packages (#18511)
## Summary

I've made `uv audit`'s approach to handling extras and groups
(explicitly) subtractive: we don't support flags like `--dev` (since `uv
audit` audits everything by default); instead, we only support flags
like `--no-dev`, `--no-group`, etc., that remove items from the
to-be-audited set.

To accomplish that, I've abstracted the filtering into a new
`Lock::packages_for_audit` API (maybe there's a better location for
it?). Implementation wise, it does a BFS similar to the one used in `uv
tree`. I _think_ there's some room/opportunity for DRYing there but I
wanted to keep the PR small/local 🙂

See https://github.com/astral-sh/uv/issues/18506.

## Test Plan

None yet.

---------

Signed-off-by: William Woodruff <william@astral.sh>
Co-authored-by: konsti <konstin@mailbox.org>
2026-03-26 10:28:00 -04:00
Zanie Blue a6042f67fc Bump version to 0.11.1 (#18704) 2026-03-24 22:18:22 +00:00
Zanie Blue 264b63e8e0 Avoid version commit info build churn when using jj (#18685) 2026-03-24 07:19:32 -05:00
Zanie Blue 1f31f0e9fb Bump version to 0.11.0 (#18683)
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Co-authored-by: Geoffrey Thomas <geofft@ldpreload.com>
2026-03-23 21:13:35 +00:00
Zanie Blue b6854d77bf Upgrade reqwest to 0.13 (#18550)
The following user-facing changes are included here:

- `aws-lc` is used instead of `ring` for a cryptography backend
- Expands our certificate signature algorithm support to include
ECDSA_P256_SHA512, ECDSA_P384_SHA512, ECDSA_P521_SHA256,
ECDSA_P521_SHA384, and ECDSA_P521_SHA512
- `--native-tls` is deprecated in favor of a new `--system-certs` flag,
avoiding confusion with the TLS implementation used (we use `rustls` not
`native-tls`, see prior confusion at
https://github.com/astral-sh/uv/issues/11595)
- NASM is a new build requirement on Windows, it is required by `aws-lc`
on x86-64 and i386
- `rustls-platform-verifier` is used instead of `rustls-native-certs`
for system certificate verification
- On macOS, certificate validation is now delegated to
`Security.framework` (`SecTrust`). Performance when using
`--system-certs` is improved by avoiding exporting and parsing all the
certificates from the keychain at startup.
- On Windows, certificate validation is now delegated to
`CertGetCertificateChain` and `CertVerifyCertificateChainPolicy`
    - On Linux, certificate validation should be approximately unchanged
- Some previously failing chains may succeed, and some previously
accepted chains may fail; generally, this should result in behavior
closer matching browsers and other native applications
- macOS and Windows may now perform live OCSP fetches for early
revocation, which could add latency to some requests
- Empty `SSL_CERT_FILE` values are ignored (for consistency with
`SSL_CERT_DIR`)

The following internal changes are included here:

- Certificate loading has been refactored to use a newtype with helper
methods
- The certificate tests have been rewritten
- We use `webpki-root-certs` instead of `webpki-roots`, see
https://github.com/astral-sh/uv/pull/17543#discussion_r2820187691
- We request `identity` encoding for range requests, see
https://github.com/astral-sh/async_http_range_reader/pull/3#discussion_r2700194798
- Various dependencies (including forks) updates to versions which use
reqwest 0.13+

This is a replacement of #17543 with an updated description. See that
pull request for prior discussion. I've made the following changes from
the initial approach there:

- Previously, the `native-tls` TLS implementation was added which
included an OpenSSL build. We don't currently use the `native-tls`
implementation, but the `--native-tls` flag there was erroneously
updated to enable it.
- Previously, there was a `--tls-backend` flag to toggle between
`native-tls` and `rustls`. Since we currently always use `rustls`, this
is deferred to future work (if we need it at all).
- Previously, there were unintentional breaking changes to
`SSL_CERT_FILE` and `SSL_CERT_DIR` handling, including merging with the
base certificates instead of replacing them, dropping support for
OpenSSL hash-named certificate files, skipping deduplication of
certificates. Here, we retain use of `rustls-native-certs` for loading
certificates from the system as it handles these edge cases.


Closes https://github.com/astral-sh/uv/issues/17427

---------

Co-authored-by: salmonsd <22984014+salmonsd@users.noreply.github.com>
2026-03-23 13:22:19 -05:00
William Woodruff b38bea427c Add --service-format and --service-url to uv audit (#18571)
## Summary

This serves two purposes: 

1. It sets up the scaffolding/structure for future vulnerability service
backends, e.g. PyPI/PYSEC instead of OSV.
2. It unblocks a form of integration testing I want to do here, which is
with a mocked OSV API (using wiremock).

NB: I'm low confidence on the naming of these options, feedback greatly
desired 🙂

See #18506.

## Test Plan

But doctor, I _am_ the test plan.

---------

Signed-off-by: William Woodruff <william@astral.sh>
Co-authored-by: konsti <konstin@mailbox.org>
2026-03-23 14:32:39 +00:00
Zanie Blue 00d72dac7b Bump version to 0.10.12 (#18578) 2026-03-19 21:18:55 +00:00
Zanie Blue bd2e0c9b09 Allow comma separated values in --no-emit-package (#18565)
Closes #18560

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-19 13:23:46 +00:00
Zanie Blue 481d99bf6a Include uv's target triple in version report (#18520)
When looking at https://github.com/astral-sh/uv/issues/18509 I realized
this would be useful

e.g.,

```
$ uv self version
0.0.0 (53b0f5d92 2023-10-19 x86_64-unknown-linux-gnu)
```

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Aria Desires <aria.desires@gmail.com>
2026-03-19 04:11:16 +00:00
William Woodruff 49ad87eb7d Unhide uv audit (#18540)
## Summary

Almost all of the MVP roadmap is done, so this unhides `uv audit`.

See #18506.

## Test Plan

NFC, but will bump the snapshots.

---------

Signed-off-by: William Woodruff <william@astral.sh>
2026-03-18 14:54:12 +00:00
Charlie Marsh 006b56b12d Bump version to 0.10.11 (#18521)
Co-authored-by: Tomasz Kramkowski <tom@astral.sh>
2026-03-16 19:32:39 -04:00
Zanie Blue 8c730aaad6 Bump version to 0.10.10 (#18455) 2026-03-13 14:35:08 -05:00
Charlie Marsh 3b544adc25 Make uv cache clear an alias of uv cache clean (#18420)
## Summary

A common point of confusion.
2026-03-12 11:48:26 -04:00
Charlie Marsh 4af1dc8491 Recreate Python environments under uv tool install --force (#18399)
## Summary

`uv tool install --force` will now always recreate the environment,
which I find more intuitive (and makes it a more reliable escape hatch).

Closes https://github.com/astral-sh/uv/issues/17907.
2026-03-11 12:47:25 +00:00
Mikaël Barbero 499cc82b35 Add --outdated flag to uv tool list (#18318)
## Summary

Add a `--outdated` flag that queries PyPI for the latest version of each
installed tool and filters the output to only show tools with available
updates. Each outdated tool is displayed with its installed version and
a `[latest: X.Y.Z]` annotation.

The implementation reuses the existing `LatestClient` infrastructure
from `pip list --outdated`, fetching versions concurrently with progress
reporting. Up-to-date tools are omitted from the output. A
`--no-outdated` hidden flag is included for flag negation consistency.

Fixes #9309

## Test Plan

A new integration test has been created in
`crates/uv/tests/it/tool_list.rs`, and the feature has also been tested
locally.

Signed-off-by: Mikaël Barbero <mikael.barbero@eclipse-foundation.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 12:20:19 -04:00
Zanie Blue f675560f32 Bump version to 0.10.9 (#18357) 2026-03-06 14:00:59 -06:00
Charlie Marsh eec0c284d0 Add an environment variable for UV_VENV_RELOCATABLE (#18331)
Closes https://github.com/astral-sh/uv/issues/18319.
2026-03-05 18:40:39 -05:00
Zanie Blue c021be36ab Bump version to 0.10.8 (#18277) 2026-03-03 15:08:03 -06:00
William Woodruff 02e804e920 Scaffolding for uv audit (#18119)
## Summary

This provides the scaffolding (CLI and initial `uv-audit` crate) for a
`uv audit` subcommand.

Closes #9189.

Tracking:

- [x] Core CLI scaffolding (this PR)
    - [x] #18185 
- [x] Audit core (probably a new `uv-audit` crate): #18124 
- [ ] Bulk dependency audits with OSV
- [ ] Result presentation
    - [ ] #18193 


Things that also need to be done with the MVP:

- [ ] We should not audit workspace members by default (by definition,
they don't exist on indices and therefore don't have meaningful results
from vulnerability services).
- [ ] I need to ensure groups/etc. are being filtered by correctly,
right now we audit every single package in the lockfile unconditionally.

## Test Plan

Unit and integration tests commensurate with the new functionality.

---------

Signed-off-by: William Woodruff <william@astral.sh>
2026-03-03 11:11:37 -05:00
Zsolt Dollenstein 08ab1a3447 Bump version to 0.10.7 (#18212) 2026-02-27 07:07:47 -05:00
Zanie Blue a91bcf2683 Bump version to 0.10.6 (#18189) 2026-02-24 17:33:36 -06:00
Zanie Blue 7ba594650a Remove verbose documentation from optional dependencies help text (#18180)
This seems a bit much

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-24 06:34:04 -06:00
Zanie Blue e2c05a54e6 Bump version to 0.10.5 (#18172) 2026-02-23 16:16:32 -06:00
Zanie Blue 7ce61d5469 Attempt to use reflinks by default on Linux (#18117)
Copy of https://github.com/astral-sh/uv/pull/17753 which GitHub
auto-closed.

This adds test infrastructure for cross-device links and file systems
with reflink support. In short, we create a few extra file systems on
the CI runners then provide their paths to the test suite using
environment variables to ensure we have coverage. If the variables are
not set, the tests are skipped.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-23 13:53:50 +00:00
Vlad-Stefan Harbuz 9bb9df122b Fix comment about uv export formats (#17900)
## Summary

This corrects a comment in the documentation to match the work done in
#16523, and to match the documentation for `--format`, which states:

```
    /// Supports `requirements.txt`, `pylock.toml` (PEP 751) and CycloneDX v1.5 JSON output formats.
```

## Test Plan

N/A

---------

Co-authored-by: konstin <konstin@mailbox.org>
2026-02-18 20:22:48 +00:00
Nicola Spieser Buiss 4e7991058b Fix UV_NO_DEFAULT_GROUPS rejecting truthy values like 1 (#18057)
## Summary

Fixes #18002.

`UV_NO_DEFAULT_GROUPS=1 uv sync` currently fails with:

```
error: invalid value '1' for '--no-default-groups'
  [possible values: true, false]
```

This is because `--no-default-groups` uses clap's default bool parser,
which only accepts `true`/`false`. Meanwhile, `--no-dev` (and
`UV_NO_DEV`) already uses `BoolishValueParser`, which accepts `1`,
`yes`, `on`, `true` (and their negatives).

## Fix

Add `value_parser = clap::builder::BoolishValueParser::new()` to all
four `--no-default-groups` argument definitions (`SyncArgs`, `RunArgs`,
`ExportArgs`, `TreeArgs`), matching the existing pattern used by
`--no-dev`.

## Test Plan

`UV_NO_DEFAULT_GROUPS=1 uv sync` should now succeed instead of erroring.

Co-authored-by: Ocean <ocean@Mac-mini-von-Ocean.local>
2026-02-18 08:47:04 -06:00
Tomasz Kramkowski 079e3fd059 Bump version to 0.10.4 (#18072) 2026-02-17 21:15:57 +00:00
Tomasz Kramkowski c75a0c625c Bump version to 0.10.3 (#18012) 2026-02-16 10:42:51 +00:00
Zanie Blue e94ea9f371 Use version constraints for default ruff version in uv format (#17977)
Change the default ruff version from a pin at `0.15.0` to a constraint
`>=0.15,<0.16`, allowing patch updates without a uv release. We'll bump
this constraint if there are no breaking formatter changes.
2026-02-13 17:00:21 -06:00
Zanie Blue d07c5cf510 Add support for ruff version constraints and exclude-newer in uv format (#17651)
I'm picking up some pretty old work here prompted by
https://github.com/astral-sh/setup-uv/pull/737 and a desire to be able
to fetch newer `python-build-standalone` versions.

Previously, we only supported a static version which means we can
construct a known GitHub asset URL trivially. However, to support the
"latest" version or version constraints, we need a registry with
metadata. The GitHub API is notoriously rate limited, so we don't want
to use that. It'd be great to use PyPI (and more broadly, the resolver),
but I don't want to introduce it in this code path yet. Instead, this
hits https://github.com/astral-sh/versions in order to determine the
available versions. We stream the NDJSON line by line to avoid
downloading the whole file in order to read one version.

Loosely requires https://github.com/astral-sh/uv/pull/17648 to reach
production and be ported to `ruff`, though it's not a blocker.
2026-02-11 10:54:01 -06:00
Tomasz Kramkowski a788db7e5d Bump version to 0.10.2 (#17958) 2026-02-10 18:21:21 +00:00
konsti b1b14d39ae Bump version to 0.10.1 (#17953) 2026-02-10 11:14:16 +00:00
Zanie Blue 0ba432459a Bump version to 0.10.0 (#17882)
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2026-02-05 20:28:44 +00:00
Zanie Blue d2ab2d0208 Stabilize Python upgrades (#17766)
Includes a few things...

- Drops preview warnings for use of `uv python upgrade` and `uv python
install --upgrade`
- Adds `--resolve-links` to `uv python find`, which I needed in test
cases to retain existing snapshots
- Fixes issues in our "Using environment ..." messages on Windows which
were incorrect
- Refactors `from_executable` for the `PythonMinorVersionLink` type
(https://github.com/astral-sh/uv/pull/17842/commits/28b2ed2525327d94fdf5372a29bbbc476d74680f)
to use the type system to prevent incorrect construction (for above)
- Removes special casing where we only upgrade links if they already
exist, which existed so preview wasn't needed on every invocation
- Fixes a bug with `PythonMinorVersionLink::exists` which returned
`true` even if the link pointed to the wrong Python installation leading
to discovery failures
2026-02-05 11:52:18 -06:00
Zanie Blue ea4560831e Bump version to 0.9.30 (#17865) 2026-02-04 21:18:04 +00:00
Zanie Blue d44e65e9ed Use relocatable virtual environments by default (#17770)
Under the `relocatable-envs-default` preview feature

See #13994
2026-02-04 14:30:34 +00:00
liam 30e2c2b57d Allow comma-separated values in uv sync --extra (#17525)
Resolves (partially) https://github.com/astral-sh/uv/issues/17511

This diff enables comma-separated values for `--extra`, allowing `uv
sync --extra foo,bar` as an alternative to `uv sync --extra foo --extra
bar`.
2026-02-04 11:09:25 +00:00
Zanie Blue 1f1321d842 Bump version to 0.9.29 (#17837) 2026-02-03 13:06:01 -06:00
William Woodruff fc0db7927a Hide a subset of environment variable values in --help (#17745) 2026-01-30 01:58:26 +01:00
Zanie Blue 0e1351e400 Bump version to 0.9.28 (#17738) 2026-01-29 13:51:05 -06:00
Zanie Blue b5797b2ab4 Bump version to 0.9.27 (#17706) 2026-01-26 22:38:10 +00:00
Tomasz Kramkowski 6e3ba2f03d Introduce PreviewFeature to clarify intent throughout the codebase (#17670)
## Summary

This PR replaces `bitflags` in favour of `enumflags2` (which we already
transitively depended on) so that `PreviewFeatures` can be replaced with
`PreviewFeature` which is an enum. This clarifies intent in cases where
we only care about one specific `PreviewFeature`.

To avoid a bunch of boilerplate changes, the `Preview` wrapper has been
kept and creation now involves a `&[PreviewFeature]` in all cases. The
alternative was to have everything which initialises a `Preview` use
`BitFlags` directly and possibly to remove `Preview` entirely but this
keeps things simpler and limits the changes throughout the rest of the
codebase solely to changes which deal with the name changes (ALL_CAPS to
PascalCase) and the impact on `--show-settings` which I don't believe we
care about stability of output for?

The changes to `--show-settings` could be avoided with some custom
`Debug` implementation but that seems excessive.

This PR will impact #16452. But the changes were inspired by trying to
remove the need for that particular PR to add more runtime type
checking.

## Test Plan

Existing tests were adjusted (I also fixed some missing cases). The test
for panicking in cases which are now prevented through the use of type
changes has been dropped. All the rest of the tests were ran, snapshot
changes reviewed and applied.
2026-01-23 17:19:23 +00:00
Zanie Blue 3e22637c93 Use #[expect(clippy::...)] throughout and drop unused supressions (#17537)
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-20 21:52:06 +00:00
Tobias Gårdhus e2095b987a Implement uv pip freeze --exclude flag (#17045)
## Summary

Implements the `--exclude` flag to `uv pip freeze`, which allows to
filter unwanted dependencies from the resulting requirements.txt file.

```bash
uv pip freeze --exclude pandas
```

part of https://github.com/astral-sh/uv/issues/3141


## Test Plan

Unit test with simple exclusion example of command argument(s)
2026-01-17 09:34:32 -06:00
Yusuf Bham 8a02f6352a Add -t shortform for --target to uv pip subcommands (#17501)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This adds `-t` to `uv pip` to preserve drop-in compatibility with pip's
`-t` shortform

Closes #17495

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
Just interactively checked to make sure it works in the same places as
`--test`
```bash
uv pip install -t test ansible
uv pip list -t test
echo 'ansible' > requirements.txt
uv pip sync -t test requirements.txt
```
2026-01-16 07:50:43 -06:00
Zanie Blue ee4f003628 Bump version to 0.9.26 (#17496) 2026-01-15 14:25:54 -06:00
Zanie Blue 490b7f322e Add --no-sources-package (#14910)
I needed this for a test, e.g., to disable a source for an extra build
dependency without disabling the source for a workspace member, and had
also seen some requests for it. I think it makes sense to allow this.

The refactor is fairly mechanical, we go from
`SourceStrategy::Enabled|Disabled` to
`NoSources::All|None|Package(names)` as we do for other options like
`NoBinary`.

Related https://github.com/astral-sh/uv/issues/17441
2026-01-15 13:53:42 -06:00