Commit Graph

638 Commits

Author SHA1 Message Date
Aria Desires 3cdf50e092 Bump version to 0.11.23 (#19927) 2026-06-19 10:42:39 -07:00
Aria Desires 94988e5e08 Bump version to 0.11.22 (#19917) 2026-06-18 15:06:46 -07:00
Zsolt Dollenstein 14855e023d use let chains in various crates (#19908)
Now that uv’s MSRV is Rust 1.94, use Rust 2024 let chains where they
make nested guards clearer in the parser, configuration, and data-model
crates.

This flattens related pattern matches and predicates while preserving
evaluation order, short-circuiting, borrow scopes, and mutation
behavior. Guards involving effects, staged work, or non-obvious
lifetimes remain nested.
2026-06-18 16:47:27 +00:00
Tomasz Kramkowski 28a98e187a Clean up ImplementationName (#19891)
## Summary

This is a refactor of `uv_python::implementation::ImplementationName`.
It gets rid of the From impls in favour of just having functions which
returns the long and short names for an implementation. I think this is
just strictly cleaner at the call sites, and is less code. It gets rid
of the `long_names` and `short_names` functions in favour of using the
existing `iter_all`. It uses these changes to centralise a bunch of the
information so the short and long names aren't duplicated in various
locations anymore.

The PR becomes most useful for the centralised environments PR but the
refactor seemed helpful stand-alone and is completely isolated from that
PR.

## Test Plan

Relies on existing coverage.
2026-06-17 18:54:02 +01:00
Zsolt Dollenstein 576f28e056 Modernize predicate checks with is_some_and and is_none_or (#19889)
Now that uv’s MSRV is Rust 1.94, use clearer `Option` and `Result`
predicate helpers where it makes sense.

This replaces `map(...).unwrap_or(...)` probes with APIs such as
`is_some_and`, `is_none_or`, and `is_ok_and`, preserving existing
ownership and `None`/`Err` behavior.
2026-06-17 17:21:57 +01:00
Tomasz Kramkowski 9945c92171 Clean up some junction related code (#19829)
## Summary

While centralising the whole environment, I noticed that this code was
unnecessarily complicated so I deleted it.

Using `remove_dir` instead of `junction::delete` also fixes a bug of
sorts if we were to actually encounter a regular directory symlink on
windows.

`junction::get_target` has this weird quirk where it will produce
non-verbatim long paths. This means that prefix comparisons will work
assuming the prefix isn't a verbatim path (so actually this is a bug
disguised as a feature).

To avoid the opposite issue in this case, it's necessary to verbatim
both paths.

## Test Plan

Existing coverage, some augmentations, and a targeted test for a
verbatim_path idiom.
2026-06-15 16:19:19 +01:00
konsti 2b4b589836 Don't capture secrets in tracing (#19826)
These fields aren't logged in uv release builds, but we shouldn't
capture them in the first place.
2026-06-12 21:17:27 +02:00
Zsolt Dollenstein 5aa65dd7ad Bump version to 0.11.21 (#19810) 2026-06-11 17:39:38 +00:00
zaniebot a2916b2758 Avoid panics for Unicode Python version requests (#19797)
## Summary

Prior to this change, a Unicode numeric character in a Python version
request could cause variant parsing to panic. The parser treated the
character's byte offset as though the character were one byte long, then
sliced through the middle of it.

This PR restricts variant detection to ASCII digits, matching Python
version syntax. Malformed Unicode numeric requests now return the
existing invalid-version error.

## Test plan

- `cargo test -p uv-python version_request_from_str`

Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-06-11 16:28:33 +00:00
Jonathan J. Helmus cff9514290 Sync Python 3.13.14 and 3.14.6 (#19787)
## Summary

Pull in metadata from python-build-standalone 20260610 which includes
CPython 3.13.14 and 3.14.6

Note that this includes the change from #19786

---------

Co-authored-by: Tomasz (Tom) Kramkowski <tom@astral.sh>
2026-06-11 14:48:28 +00:00
Jonathan J. Helmus 173ec11f7b parse GraalPy platform information before version (#19786)
## Summary

Fix `fetch-download-metadata.py` by having the GraalPy platform
information be processed before parsing the Python version information.

## Test Plan
* Ran script locally. Without this change it fails.
2026-06-11 09:12:00 +01:00
Zanie Blue ea6de30dd6 Consolidate Python discovery strategies (#19775)
## Summary

Consolidate the sequential and parallel Python discovery paths
introduced in #18684.

Both modes now share a single `PythonRequest` dispatcher and
executable-to-installation pipeline. A private `QueryStrategy` selects
either lazy sequential querying or eager parallel querying while
preserving the existing filtering, ordering, and error-handling
behavior.

No prefetching is introduced here. Sequential discovery still defers
reading and traversing `PATH`, advances candidate executables one at a
time, and stops querying after finding an acceptable installation. The
pre-existing eager behavior for explicit file, directory, and
executable-name requests is unchanged.

## Test Plan

- Added parity coverage across every `PythonRequest` variant, using
independent caches and out-of-order query completion to verify ordered
results and non-critical error handling.
- Added regression coverage proving sequential strategy construction
pulls no candidates, one iteration pulls exactly one candidate, later
`PATH` directories are not inspected early, and later interpreters are
not queried after a match.
- Mutation-checked the laziness tests against candidate collection,
eager interpreter querying, and eager `PATH` directory filtering.
- `cargo test -p uv-python`
- `cargo test -p uv --test python python_list --no-fail-fast`
- `cargo test -p uv --test python python_find --no-fail-fast`
- `cargo +stable clippy -p uv-python --tests --no-deps --locked -- -D
warnings`
- `cargo +stable fmt --all -- --check`
2026-06-10 18:26:03 -05:00
Zanie Blue 0cdd500980 Fix handling of non-critical errors in uv python list with path requests (#19774)
#18684 accidentally regressed handling of non-critical errors when path
and directory Python requests are collected in parallel rather than
sequentially.
2026-06-10 21:54:54 +00:00
Zanie Blue 0f5e199f2e Add parallel discovery of Python versions for uv python list (#18684)
Currently, Python discovery happens sequentially — which is good most of
the time because uv will lazily exit once it finds a satisfactory
version. However, in `uv python list`, uv needs to query all
interpreters on the system which makes sequential discovery quite slow.

Here, we add parallelization to discovery. Annoyingly, it means a fair
amount of code repetition, but I've done my best to minimize that.

In the long-term, we may want to consolidate these code paths such that
uv can do prefetching during normal discovery, since technically if the
interpreter we want is far down the PATH then laziness does not save us
anything.

```
Benchmark 1: main
  Time (mean ± σ):      3.108 s ±  0.026 s    [User: 2.290 s, System: 0.386 s]
  Range (min … max):    3.072 s …  3.157 s    8 runs

Benchmark 2: branch
  Time (mean ± σ):     414.1 ms ±  11.1 ms    [User: 2955.2 ms, System: 743.7 ms]
  Range (min … max):   398.1 ms … 429.5 ms    8 runs

Summary
  branch ran
    7.51 ± 0.21 times faster than main
```
2026-06-10 12:18:37 -05:00
Tim Felgentreff 965ddbbf42 Support newer GraalPy release assets that include the Python version. (#19458)
With https://github.com/oracle/graalpython/pull/810 we will slightly
alter upcoming GraalPy release artifact naming. The name will now
include the compatible CPython version name in the filename. This change
adapts the metadata script to support both the older and newer format.
We can drop the older one once support for GraalPy versions older than
25.1 is removed.

/cc @msimacek
Related:  https://github.com/oracle/graalpython/issues/623
2026-06-10 08:32:47 -05:00
konsti 9252ba6b52 Bump version to 0.11.20 (#19765)
Released on 2026-06-10.

### Enhancements

- Add `--emit-index-url` and `--emit-find-links` to `uv export`
([#18370](https://github.com/astral-sh/uv/pull/18370))
- Add `--find-links` support for `uv pip list`
([#16103](https://github.com/astral-sh/uv/pull/16103))
- Group executable install errors during `uv python install`
([#19691](https://github.com/astral-sh/uv/pull/19691))
- Use ICF in macOS release builds to reduce binary sizes
([#19615](https://github.com/astral-sh/uv/pull/19615))

### Preview features

- Add initial hidden `uv upgrade` command
([#19678](https://github.com/astral-sh/uv/pull/19678))
- Reject Git revisions in `uv upgrade`
([#19742](https://github.com/astral-sh/uv/pull/19742))

### Configuration

- Recognize `UV_NO_INSTALL_PROJECT`, `UV_NO_INSTALL_WORKSPACE`,
`UV_NO_INSTALL_LOCAL`
([#19323](https://github.com/astral-sh/uv/pull/19323))

### Performance

- Speed up discovery of large workspaces
([#18311](https://github.com/astral-sh/uv/pull/18311))

### Bug fixes

- Allow unknown preview flags with a warning again
([#19669](https://github.com/astral-sh/uv/pull/19669))
- Apply dependency exclusions to direct requirements
([#19699](https://github.com/astral-sh/uv/pull/19699))
- Avoid following external symlinks during cache clean
([#19682](https://github.com/astral-sh/uv/pull/19682))
- Avoid following symlinks during cache prune
([#19543](https://github.com/astral-sh/uv/pull/19543))
- Fix Git cache keys for worktrees and packed refs
([#19706](https://github.com/astral-sh/uv/pull/19706))
- Make resolver error handling iterative to avoid stack overflows
([#19695](https://github.com/astral-sh/uv/pull/19695))
- Pass `VIRTUAL_ENV` through `cygpath` inside `fish` on Windows
([#19703](https://github.com/astral-sh/uv/pull/19703))
- Rebuild explicit local directory tool installs
([#19591](https://github.com/astral-sh/uv/pull/19591))
- Validate egg top-level entries as identifiers
([#19679](https://github.com/astral-sh/uv/pull/19679))

### Documentation

- Document `--find-links` caching behavior
([#19585](https://github.com/astral-sh/uv/pull/19585))
- Add a small section for malware checks
([#19680](https://github.com/astral-sh/uv/pull/19680))
2026-06-10 10:12:23 +02:00
Zanie Blue 7b2cff1c31 Bump version to 0.11.19 (#19668) 2026-06-03 17:06:27 -05:00
Tomasz Kramkowski 95507374d8 Use global preview in CondaEnvironmentKind::from_prefix_path (#19649)
## Summary

This expands the usage of global preview in a key area which has
wide-ranging impact.

Key notes:

* uv-dev needs to set up default global preview because of this.
Although it seems like it should technically have been setting it up
earlier?
* A number of tests no longer pass `Preview::default()` but also don't
use the guard. This is because they only call into the preview stuff
when the relevant conda environment variables are present. Which we
assume they're not (otherwise the tests would be invalid for other
reasons). There's really a hermeticity issue here, but I've addressed it
in a separate PR.

## Test Plan

Tests have been modified, but existing coverage should be sufficient.
2026-06-03 20:44:15 +01:00
github-actions[bot] 48548c496e Sync latest Python releases (#19531)
Automated update for Python releases.

Co-authored-by: jjhelmus <1050278+jjhelmus@users.noreply.github.com>
Co-authored-by: Jonathan J. Helmus <jjhelmus@gmail.com>
2026-06-03 13:01:13 -05:00
Charlie Marsh 68ae09e00c Remove unused pub code from workspace (#19565)
## Summary

This PR runs [hawk](https://github.com/astral-sh/hawk) over the uv
codebase to:

1. Remove dead code (i.e., code marked as `pub` that isn't called by any
other crates).
2. Reduce visibility of symbols (i.e., to make code non-`pub` if only
called internally, etc.).

I skimmed through the changes and added exceptions where they felt
warranted (to `hawk.toml`). I've included the `hawk.toml` file in the
prior commit, but am excluding it from being committed, since it's not
at a point that we have automated tooling.
2026-06-03 10:24:28 -04:00
Zsolt Dollenstein 8d28332d1d Preserve historical sysconfig compiler mappings (#19657)
## Summary

Keep the sysconfig generator aware of compiler paths that appeared in
older downloadable `python-build-standalone` releases, so regenerating
the mappings on current `main` does not drop support for previously
shipped aarch64 and riscv64 binaries.


## Context

uv patches compiler paths embedded in managed Python `sysconfig` data to
use portable `cc` and `c++` commands. These mappings are generated from
the current python-build-standalone targets.

Older python-build-standalone releases remain downloadable and retain
the compiler paths used when they were built. When a target changes
toolchains or is removed from the current targets, regenerating the
mappings silently drops support for those releases.

This previously removed the aarch64 GNU mappings. The upcoming
python-build-standalone sync in #19531 would similarly replace the
riscv64 GNU mappings with LLVM mappings.

## Test plan

I've manually verified, that before this patch, on an arm64 linux box:

```
% uvx python3.12.10 -c 'import sysconfig; print(sysconfig.get_config_var("CC"))'
/usr/bin/aarch64-linux-gnu-gcc -pthread
```

and after (after uninstalling the python version using `uv python
uninstall 3.12.10`):

```
% ./target/debug/uvx python3.12.10 -c 'import sysconfig; print(sysconfig.get_config_var("CC"))'
cc -pthread
```
2026-06-03 13:18:11 +01:00
Tomasz Kramkowski 0d75a3a7d9 Make run_with_vars drop more environment variables (#19650)
## Summary

`uv-python` has some unit tests for python discovery. Python discovery
is sensitive to various environment variables. The code tries to be
"hermetic" by dropping some significant ones and setting others to fixed
values, but it misses some conda specific environment variables.

This PR fixes this gap by just using `EnvVars::all_names` to drop all
environment variables that uv cares about eagerly to avoid this and
similar future gaps.

## Test Plan

Existing coverage.
2026-06-02 19:03:51 +01:00
Robin Heinemann fef166b538 Skip Unix-specific installation steps when cross-installing Windows Python distributions (#19424)
## Summary

Previously installing a windows python on linux failed, because the
windows python install does not have a `python` binary and it does not
use a `_sysconfigdata_*` file.

## Test Plan

Manually tested by running `uv python install
cpython-3.12.3-windows-x86_64-none`

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-06-02 13:38:42 +00:00
Gyeongjae Choi c457b9492f Add PyEmscripten platform (PEP 783) (#19629)
<!--
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 PyEmscripten platform, which is standardized in [PEP
783](https://peps.python.org/pep-0783/). This basically replaces the
Pyodide platform. I kept the Pyodide platform for backward
compatibility.

## Test Plan

`cargo test`
2026-06-01 15:46:33 -05:00
Zanie Blue e32666915e Bump version to 0.11.18 (#19639) 2026-06-01 19:05:49 +00:00
Aria Desires a33a629d66 Bump version to 0.11.17 (#19599) 2026-05-28 12:58:35 -07:00
Zsolt Dollenstein 727d2b84f2 Add module owners to workspace metadata (#19122)
## Why

Dependency linting needs to connect imported Python modules back to the
packages in a workspace resolution so it can identify unused
dependencies and imports that are undeclared or only indirect. `uv
workspace metadata` already exposes the resolution graph; this adds the
module ownership data needed to use that graph for linting.

## What changed

- Adds `--sync` to `uv workspace metadata`. When requested, uv syncs the
environment in inexact mode with all extras and dependency groups, then
adds a `module_owners` mapping from importable module names to
resolution package node IDs when mapped modules are present.
- Makes `--sync` conflict with `--dry-run`, since module ownership is
determined from installed distributions after syncing.
- Adds a validated `ModuleName` type and `InstalledDist::read_modules`,
which derives module names from distribution `RECORD` entries.
- Detects Python modules from packages, `.py` files, legacy sourceless
`.pyc` files, and supported extension-module filenames; parent packages
are recorded as owners as well.
- Filters owners through the selected installed resolution, so
distributions outside that resolution and virtual workspace packages do
not produce metadata entries.

A module may be owned by more than one package, for example when two
distributions provide entries under the same namespace package.

## Limitations

Editable installs that only record a `.pth` file do not currently
provide module ownership entries and will require separate handling.
2026-05-28 18:09:04 +01:00
Zanie Blue 67f02f6d12 Improve the error printing API (#19581)
Adds a builder pattern for error printing options so we don't need to
provide noisy default arguments at each callsite.
2026-05-27 19:15:12 +00:00
Zanie Blue b1e02c5aef Add first-party line wrapping (#17535)
Required for https://github.com/astral-sh/uv/pull/17110 to avoid
regressions where miette previously wrapped lines in error messages.
2026-05-27 13:59:07 -05:00
William Woodruff 135a363678 Bump version to 0.11.16 (#19522)
Signed-off-by: William Woodruff <william@yossarian.net>
2026-05-21 17:21:08 -04:00
Zanie Blue 78d8fe93c7 Refactor hint handling (#18090)
This adds abstractions for handing hints, pulling them out of ad-hoc
addendums to error messages and treating them as a first-class concept
so we can render them more consistently.

The key concepts are:

- `Hints`: a wrapper struct for `Vec<Cow<'a, str>>`
- `Hint`: a trait with `hints(&self) -> Hints<'_>`

Error types now `impl Hint` to provide hints. This means errors need to
carry more information to construct the `Hint` lazily instead of ahead
of time. The majority of refactoring around error types is to support
that change.

When displaying errors, we
[downcast](https://github.com/astral-sh/uv/pull/18090/changes#r2935662966)
to each type known to implement the trait and extract hints. We then
display all the hints after the error chain is complete.

The user-facing affect of this is that hints are now always rendered
outside the error chain.

This is a blocker to #17110 and is pulled out of that project. There is
still some weirdness with miette's `help:` prompts that will be removed
entirely in a following change.

---------

Co-authored-by: Codex <noreply@openai.com>
2026-05-20 10:43:52 -07:00
Charlie Marsh c22efa11bf Reduce scope of public interfaces (#19460)
## Summary

This is a Codex-driven PR to remove as many `pub` interfaces as we can,
and then fixing the resulting Clippy violations. (I then read the diff
and reverted some changes.)

We use `pub` to expose members across crates within our workspace, even
though we don't intend each of those `pub` members to be usable API --
we are largely our only caller. (I've explicitly retained pieces that we
added to our API based on prior requests from other users.) As a result,
we can remove >1,000 unused LOC.
2026-05-18 16:14:56 -07:00
Zanie Blue de16a7b1a3 Bump version to 0.11.15 (#19472)
Co-authored-by: Codex <noreply@openai.com>
2026-05-18 12:10:13 -07:00
Gyeongjae Choi d19f1cd498 Fix Pyodide fetch script to handle old releases (#19434)
## Summary

Fixes old Pyodide metadata going away from the download-metadata.json
(See:
https://github.com/astral-sh/uv/pull/19396#discussion_r3239032504).

## Test Plan

`uv run -- fetch-download-metadata.py`
2026-05-16 22:06:28 -07:00
Charlie Marsh 5aba1bde10 Avoid parsing JSON manifest when local Python is available (#19398)
## Summary

Right now, it appears that we parse the JSON manifest for ~every lock
and sync (I _think_ this regressed in b9826778b). By avoiding that work,
this PR improves (warm) `uv lock` from 38.94ms to 24.06ms (38.2%
faster!), and (warm) `uv sync` from 146.96ms to 129.80ms.

Note that we _do_ need to read it if you're using a pre-release, since
we have this dedicated pre-release warning.

Closes https://github.com/astral-sh/uv/issues/19397.
2026-05-14 15:22:38 +00:00
vip892766gma 16302873e4 Fix article grammar in comments (#19394)
Fixes small article/grammar issues in comments and assertion text. No
behavior change.

Co-authored-by: Aiden Park <275402320+vip892766gma@users.noreply.github.com>
2026-05-13 19:45:42 +02:00
github-actions[bot] 3fdfdc7d4a Bump version to 0.11.14 (#19377)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-05-12 12:29:37 -05:00
Zsolt Dollenstein 7d65903131 Add Astral mirror URL override (#19206)
Support UV_ASTRAL_MIRROR_URL for mirrored Astral release metadata and
artifacts, including Ruff, CPython downloads, and self-update. When set,
no GitHub fallback takes place. The more specific env vars override
this.

Closes https://github.com/astral-sh/uv/issues/9134
Closes https://github.com/astral-sh/uv/issues/16519
Closes https://github.com/astral-sh/uv/issues/17255
Closes https://github.com/astral-sh/uv/issues/15970
Closes https://github.com/astral-sh/uv/issues/18525
2026-05-12 08:39:29 -07:00
Jonathan J. Helmus 4512a39319 Bump version to 0.11.13 (#19345)
## Summary
Preps 0.11.13.

## Test Plan
NFC
2026-05-10 17:37:45 -07:00
github-actions[bot] 60017e9d54 Sync latest Python releases (#19342)
Automated update for Python releases.

---------

Co-authored-by: jjhelmus <1050278+jjhelmus@users.noreply.github.com>
Co-authored-by: Jonathan J. Helmus <jjhelmus@gmail.com>
2026-05-10 23:58:26 +00:00
William Woodruff 63c5f57d36 Bump version to 0.11.12 (#19331) 2026-05-08 15:06:22 -07:00
github-actions[bot] 400b137122 Sync latest Python releases (#19322)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2026-05-08 14:28:10 -07:00
Zanie Blue bb8109a3c4 Ensure that all Python downloads do not panic on VersionRequest::from(PythonVersion) (#19288)
Avoids future regressions like #19277

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-06 20:46:22 +00:00
github-actions[bot] ed7b060013 Bump version to 0.11.11 (#19303)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-05-06 12:34:21 -07:00
github-actions[bot] add376fd92 Bump version to 0.11.10 (#19293)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2026-05-05 12:39:52 -07:00
Zanie Blue 2efecdaba3 Allow pre-release Python requests with non-zero patch versions (#19286)
Closes https://github.com/astral-sh/uv/issues/19283
Closes https://github.com/astral-sh/uv/issues/19277
Closes https://github.com/astral-sh/uv/pull/19285

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-05 14:37:25 +00:00
Zanie Blue 7829a03b6c Bump version to 0.11.9 (#19273) 2026-05-05 05:06:19 +00:00
github-actions[bot] 726047a420 Sync latest Python releases (#19268)
Automated update for Python releases.

---------

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2026-05-05 02:33:32 +00:00
Zanie Blue a846497e95 Use symlinks instead of junctions on Wine (#19213)
Integration test coverage added in
https://github.com/astral-sh/uv/pull/19214
Closes https://github.com/astral-sh/uv/issues/19187

On Wine, we're compiled for Windows but junctions are not available.
Here, we switch to symlinks when we can detect Wine.
2026-04-30 09:02:07 -05:00
Zanie Blue e90b90aebe Discover versioned Python executables when requires-python pins a version (#18700)
Closes https://github.com/astral-sh/uv/issues/9695
Follows https://github.com/astral-sh/uv/pull/9697

Consolidates `requires-python` conversion into `PythonRequest` so we can
handle this logic once.
2026-04-29 11:05:04 -05:00