Commit Graph

5524 Commits

Author SHA1 Message Date
Charlie Marsh 9a4251104e Use separate rules 2025-08-22 12:42:14 +01:00
Charlie Marsh 849071e86b Merge branch 'main' into fix/sync-no-sources-editable-switch 2025-08-22 11:50:08 +01:00
Charlie Marsh b826c8db04
Bump MSRV to 1.87 (#15441)
## Summary

Per our N-2 policy (1.89 is latest).
2025-08-22 10:21:24 +01:00
Charlie Marsh 35a8dd514e
Import `PackageName` from `uv-normalize` (#15439)
## Summary

This might be unintentional? `PackageName` is re-exported from
`uv-pep508`, so some crates import it from there.
2025-08-21 23:15:40 +00:00
Charlie Marsh 91d66e0bd8
Add file-to-CLI overrides for build isolation configuration (#15437)
## Summary

Like #15395, but `--no-build-isolation`.
2025-08-21 23:54:39 +01:00
Charlie Marsh d1e0c26678
Add an environment variable for `UV_ISOLATED` (#15428)
Closes https://github.com/astral-sh/uv/issues/15427.
2025-08-21 23:39:04 +01:00
Pepe Osca c4f2da729c
fix(tests): Ensure show_settings tests don't load user config (#15434)
## Summary

Ensure show_settings tests set XDG_CONFIG_HOME to avoid loading user
configuration

Closes #15403
2025-08-21 17:10:11 -05:00
Zanie Blue f210db0907
Fix format doc mistake (#15433) 2025-08-21 21:12:06 +00:00
Charlie Marsh 330b54b173
Add file-to-CLI overrides for reinstall configuration (#15426)
## Summary

This is like #15395, but for `--reinstall` and `--reinstall-package`.
2025-08-21 19:03:03 +00:00
Zanie Blue ede75fe628
Bump version to 0.8.13 (#15423) 2025-08-21 13:52:39 -05:00
Charlie Marsh e4de538dae
Remove `UpgradeSelection` struct (#15422)
## Summary

After #15395, I realized that we didn't actually need a separate struct
for this since we now pass it around as an `Option`. (The key change
from #15395 is that when combining, we treat the options as a single
unit.)
2025-08-21 18:35:07 +00:00
Zsolt Dollenstein 11633549fd
extra-build-dependencies: Allow version specifiers if match-runtime is explicitly false (#15420)
## Summary

`match-runtime` can be explicitly specified, and if it's `false` it
should behave the same way as if it's omitted.

## Test Plan

Added snapshot test
2025-08-21 17:50:15 +01:00
konsti 25bedeadea
Stop leaking strings in Python downloads (#15418)
We should not unnecessarily leak memory. Instead, we follow the general
patterns and use `Cow` for strings that can be from either a static or a
dynamic source.
2025-08-21 17:54:39 +02:00
Charlie Marsh 0397595e53
Treat `--upgrade-package` on the command-line as overriding `upgrade = false` in configuration (#15395)
## Summary

Right now, if you put `upgrade = false` in a `uv.toml`, then pass
`--upgrade-package numpy` on the CLI, we won't upgrade NumPy. This PR
fixes that interaction by ensuring that when we "combine", we look at
those arguments holistically (i.e., we bundle `upgrade` and
`upgrade-package` into a single struct, which then goes through the
`.combine` logic), rather than combining `upgrade` and `upgrade-package`
independently.

If approved, I then need to add the same thing for `no-build-isolation`,
`reinstall`, `no-build`, and `no-binary`.
2025-08-21 16:20:55 +01:00
youkaichao b950453891
Add CUDA 12.9 backend (#15416)
## Summary

Add torch cuda 12.9 backend

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

## Test Plan

<!-- How was it tested? -->

---------

Signed-off-by: youkaichao <youkaichao@gmail.com>
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-08-21 16:01:02 +01:00
Charlie Marsh 61e2308806
Add `triton` to `torch-backend` manifest (#15405)
## Summary

The PyTorch team publishes ARM Linux wheels for `triton` to the PyTorch
index, which aren't available on PyPI.

## Test Plan

```
echo "torch" | cargo run pip compile - --torch-backend=cu128 --python-platform aarch64-unknown-linux-gnu --python-version 3.13
```

Previously failed because it couldn't find a compatible `triton` wheel.
2025-08-21 13:23:12 +00:00
Zanie Blue e31f000da7
Add an experimental `uv format` command (#15017)
As a frontend to Ruff's formatter.

There are some interesting choices here, some of which may just be
temporary:

1. We pin a default version of Ruff, so `uv format` is stable for a
given uv version
2. We install Ruff from GitHub instead of PyPI, which means we don't
need a Python interpreter or environment
3. We do not read the Ruff version from the dependency tree

See https://github.com/astral-sh/ruff/pull/19665 for a prototype of the
LSP integration.
2025-08-21 06:33:18 -05:00
Anuraag (Rag) Agrawal 8d6ea3f2ea
Fix uv_build wheel hashes (#15400)
<!--
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

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

Currently record hashes are the hex encoded sha-256 sum. However,
they're supposed to be urlsafe-base64-nopad.


https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file

Fixes #15398 

## Test Plan

<!-- How was it tested? -->

Build any wheel

```
uv build --wheel
```

Unpack the wheel

```
uvx wheel unpack dist/*.whl
```

Before this change, it will fail with a hash mismatch. I could confirm
with a local build that now the wheel can be unpacked with the `wheel`
command. While I don't enable hash checking when syncing, presumably it
would also currently fail.
2025-08-21 10:54:21 +02:00
github-actions[bot] f1a023d384
Update Pyodide to 0.28.2 (#15385)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-08-21 01:04:15 +00:00
Charlie Marsh fcc8cfc0bc
Add `uv sync` tests for upgrade CLI interaction (#15396)
Like #15393 but for `uv sync`, since the settings logic is a bit
different than `uv pip`.
2025-08-20 18:31:18 +01:00
Charlie Marsh 1176e5e00c
Retain IO error source in extraction (#15388)
## Summary

This was accidentally lost in 4f4492dd53.
2025-08-20 16:27:26 +01:00
Charlie Marsh 02e7a8216b
Add tests to track `upgrade` and `upgrade-package` interactions (#15393)
## Summary

There are some non-ideal behaviors here, but want to start by tacking
them.
2025-08-20 16:27:18 +01:00
Charlie Marsh 08233c2ac7
Avoid panicking when resolver returns stale distributions (#15389)
## Summary

I've written a reasonably-long comment to explain what's going on here.
We should fix this, but it's better to continue using a
potentially-stale distribution than to panic.

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

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-08-20 14:04:39 +00:00
Charlie Marsh 68f33e8fef
Add `--no-install-*` arguments to `uv add` (#15375)
## Summary

Closes https://github.com/astral-sh/uv/issues/15369.
2025-08-19 15:32:56 +01:00
Charlie Marsh c58192eebe
Initialize Git prior to reading author (#15377)
## Summary

Closes https://github.com/astral-sh/uv/issues/15372.
2025-08-19 08:37:20 -05:00
Michał Górny ec27ab6033
Mark `find_uv_bin_py38` test as requiring `python-eol` (#15379)
## Summary

Mark `find_uv_bin_py38` test as requiring `python-eol`. Resolves one of
the issues reported in #15368.

## Test Plan

```
cargo test --profile=dev --features git --features pypi --features python --no-default-features
```

(without Python 3.8 installed)

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-08-19 13:06:03 +00:00
konsti 7a9e07a98e
Block `tokio::fs` symbols (#15374)
Inspired by #15017, mirror the blocking of `std::fs` symbols in favor of
`fs_err` and block `tokio::fs` symbols in favor of `fs_err::tokio`.
2025-08-19 13:13:46 +02:00
Zanie Blue f784c334cf
Bump version to 0.8.12 (#15364) 2025-08-18 22:14:51 +00:00
konsti 4f4492dd53
Add hint for venv in source distribution error (#15202)
Venvs should not be in source distributions, and on Unix, we now reject
them for having a link outside the source directory. This PR adds a hint
for that since users were confused (#15096).

In the process, we're differentiating IO errors for format error for
uncompression generally.

Fixes #15096
2025-08-18 22:07:57 +00:00
github-actions[bot] 724e4c7e5e
Sync latest Python releases (#15363)
Automated update for Python releases.

---------

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-08-18 21:49:00 +00:00
Ed Rogers 4b88b1379a
Add fallback parent process detection to `uv tool update-shell` (#15356)
## Summary

Closes #15355

This PR adds a fallback mechanism to `Shell::from_env()` that inspects
the parent process when shell environment variables are not available on
Unix-like systems.

Currently, `uv tool update-shell` fails with "the current shell could
not be determined" when environment variables like `ZSH_VERSION`,
`BASH_VERSION`, or `SHELL` are not exported. This commonly occurs in
automated environments such as GitHub Actions runners.

The fallback approach:
1. Uses `nix::unistd::getppid()` to get the parent process ID
2. Reads `/proc/<ppid>/exe` to determine the parent executable path
3. Falls back to `/proc/<ppid>/comm` if the exe symlink fails  
4. Uses existing `parse_shell_from_path()` to identify the shell type

This maintains full backward compatibility - the fallback only activates
when environment variables are unavailable and an error would otherwise
occur.

## Test Plan

Tested locally with:

```bash
env -u ZSH_VERSION -u SHELL PATH="/usr/bin:/bin" $(which cargo) run -- tool update-shell --verbose
```
```text
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.30s
     Running `target/debug/uv tool update-shell --verbose`
DEBUG uv 0.8.11
DEBUG Ensuring that the executable directory is in PATH: /home/user/.local/bin
DEBUG Detected parent process ID: 4147396
DEBUG Parent process executable: /usr/bin/zsh
Updated configuration file: /home/user/.zshenv
Restart your shell to apply changes
```
2025-08-18 13:48:34 -05:00
Zanie Blue 242214c546
Add an `aarch64-pc-windows-msvc` target (#15347)
I needed this and was surprised it didn't exist!

---------

Co-authored-by: konsti <konstin@mailbox.org>
2025-08-18 17:57:27 +00:00
Zanie Blue a4d14710d4
Skip all generated content checks when in CI (#15354) 2025-08-18 16:09:14 +00:00
Zanie Blue 00e888098f
Skip interpreters that are not found on query (#15315)
Closes https://github.com/astral-sh/uv/issues/12155

We already throw this error earlier if we cannot find the interpreter
c318e8860e/crates/uv-python/src/interpreter.rs (L1039)

Why the pyenv-win shim _exists_ but fails to run with a not found error
is beyond me. I think I'll take the incremental improvement here by just
ignoring it. We can try to support their shims later?

#15317 confirms the fix.
2025-08-18 10:42:48 -05:00
Charlie Marsh 0243f91c9b
Add retries to tests that download from R2 (#15322)
Closes https://github.com/astral-sh/uv/issues/15318.
2025-08-16 00:31:22 +01:00
Charlie Marsh d8f3f03198
Move `--no-build-isolation-package` into `pyproject.toml` in tests (#15319) 2025-08-15 23:16:07 +01:00
Charlie Marsh 7ba6d50767
Install non-build-isolation packages in a second phase (#15306)
## Summary

This PR productionizes an idea I saw in
https://github.com/astral-sh/uv/issues/15248, which was added in Pixi:
https://github.com/prefix-dev/pixi/pull/4247. The core of the idea is
that if we install all build isolation-enabled packages first, and the
build isolation-disabled packages in a second phase, the sync is more
likely to "just work", because if all the build dependencies of the
build isolation-disabled packages are included as dependencies (as is
the case for `flash-attn`, at least), they'll be present.

This isn't really a silver bullet, because it requires that all the
build dependencies are included as first-party dependencies, and if you
have packages that want build isolation to be disabled but rely on other
packages that also require build isolation disabled, that won't work
either. I think `extra-build-dependencies` will be more robust and have
much better caching behavior, but this will get more cases right than
our current behavior, and I don't see any downsides.

Closes https://github.com/astral-sh/uv/issues/15301.
2025-08-15 22:00:55 +00:00
Chris Hughes 9346b4d0f6
fix: Handle dotted package names in script path resolution (#15300)
<!--
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

Fix WindowsRunnable::from_script_path to correctly append extensions
instead of replacing them when resolving executable paths. This resolves
https://github.com/astral-sh/uv/issues/15165#issue-3304086689.

- Add add_extension_to_path helper that appends extensions properly
- Update extension resolution to use the new helper
- Add tests

## Test Plan

Added unit tests for the new and existing functionality that the change
touches. Tested manually locally on Windows.
<!-- How was it tested? -->

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-08-15 16:44:59 -05:00
NewDestinyDan 191c9175fe
Update cli.md to use proper uv cache subcommand "clean" (#15313)
Correct typo. "uv cache clear" is not a command.

<!--
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

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

## Test Plan

<!-- How was it tested? -->
2025-08-15 21:06:37 +00:00
Charlie Marsh 58c7cc0e0f
Reject already-installed wheels built with outdated settings (#15289)
## Summary

With this PR, we track the settings that were used to build a wheel
(`--config-settings`, plus any `extra-build-dependencies` or
`extra-build-variables`) and write those to the `.dist-info` directory
upon install. This then allows us to "reject" already-installed wheels,
if the user changes the build dependencies or `--config-settings` (or,
crucially, if they use `match-runtime = true` and the resolution
changes).

Closes https://github.com/astral-sh/uv/issues/15218.
2025-08-15 15:15:55 +00:00
John Mumm 880eb286e8
Add new `uv-keyring` crate that vendors the `keyring-rs` crate (#14725)
This PR is a first step toward support for storing credentials in the
system keyring. The `keyring-rs` crate is the best option for system
keyring integration, but the latest version (v4) requires either that
Linux users have `libdbus` installed or that it is built with `libdbus`
vendored in. This is because v4 depends on
[dbus-secret-service](https://github.com/open-source-cooperative/dbus-secret-service),
which was created as an alternative to
[secret-service](https://github.com/open-source-cooperative/secret-service-rs)
so that users are not required to use an async runtime. Since uv does
use an async runtime, this is not a good tradeoff for uv.

This PR:
* Vendors `keyring-rs` crate into a new `uv-keyring` workspace crate
* Moves to the async `secret-service` crate that does not require
clients on Linux to have `libdbus` on their machines. This includes
updating `CredentialsAPI` trait (and implementations) to use async
methods.
* Adds `uv-keyring` tests to `cargo test` jobs. For `cargo test |
ubuntu`, this meant setting up secret service and priming gnome-keyring
as an earlier step.
* Removes iOS code paths
* Patches in @oconnor663 's changes from his [`keyring-rs`
PR](https://github.com/open-source-cooperative/keyring-rs/pull/261)
* Applies many clippy-driven updates
2025-08-15 15:57:56 +02:00
Zanie Blue 77fe8d2e60
Move python bin filtering into test that needs it (#15305)
Closes #15188
2025-08-15 08:06:52 -05:00
Charlie Marsh d75ab0c316
Avoid `&String` in installer (#15299)
## Summary

Not sure why this is here.
2025-08-15 11:05:11 +01:00
Charlie Marsh 627c062cab
Reject `match-runtime = true` for dynamic packages (#15292)
## Summary

If `match-runtime = true`, but we can't resolve a package's metadata
statically, then we can't _know_ what the runtime version of the package
will be -- because we can't resolve without building it. This PR makes
that footgun clearer by raising an error.

Closes https://github.com/astral-sh/uv/issues/15264.
2025-08-15 10:18:11 +01:00
Charlie Marsh 7eb076aaef
Force cache indexes to set hash digests and cache info (#15291)
## Summary

Making it harder to accidentally omit these.
2025-08-14 22:28:56 +00:00
Charlie Marsh bcfa8443da
Rename `InstalledDist` methods to reflect read operation (#15290)
## Summary

I found it surprising that these don't "just" return fields from the
struct.
2025-08-14 22:39:40 +01:00
Zanie Blue f892276ac8
Bump version to 0.8.11 (#15287) 2025-08-14 14:21:10 -05:00
github-actions[bot] 42beb20b90
Add Python 3.14.0rc2 (#15285)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-08-14 13:18:36 -05:00
Ahmed Ilyas e7b55fefbf
Add `extra-build-dependencies` hint for any missing module on build failure (#15252)
Alternative to https://github.com/astral-sh/uv/pull/15251.

As suggested in
https://github.com/astral-sh/uv/issues/15118#issuecomment-3175735416

## Test Plan

`cargo test`

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-08-14 12:00:57 -05:00
Nils Koch 4bc6c77f02
Allow passing custom reqwest client to RegistryClient (#15281)
<!--
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

<!-- What's the purpose of the change? What does it do, and why? -->
We are using UV as a library and we would like to provide an custom
reqwest client to the `RegistryClient`/`BaseClient`. We have a central
place in our repo where we configure the reqwest client to our needs
(certs, proxy, ...) and it is safer for us to just pass the same client
to UV rather than trying to reproduce the same client config with the
APIs that UV exposes.

Are you ok with that change?


## Test Plan

<!-- How was it tested? -->
2025-08-14 12:00:09 -05:00