Commit Graph

7177 Commits

Author SHA1 Message Date
Charlie Marsh 64991b8d16 Fix settings rendering for extra-build-dependencies 2025-08-08 11:50:58 +01:00
konsti 1843c90e74
Warn when two packages write to the same module (#13437)
We regularly get confusing bug reports where a package sometimes works
and sometimes doesn't and it's not clear to the user why. Ultimately, it
turns out that two packages contain the same module and there is a race
condition when installing the two packages. Usually, it's one of the
opencv-python distributions, but recently it's been z3, too. These error
are completely inscrutable to users.

* https://github.com/astral-sh/uv/issues/10708
* https://github.com/astral-sh/uv/issues/11806
* https://github.com/astral-sh/uv/issues/11659
* https://github.com/astral-sh/uv/issues/13435
* https://github.com/astral-sh/uv/issues/13550
* https://github.com/astral-sh/uv/issues/14030

We now warn for top-level modules (pattern: `<identifier>/__init__.py`)
that collide in a single installation, naming the offending wheels.
Checking for `__init__.py` excludes namespace packages.

Test script:

```
uv venv -q && cargo run -q --profile fast-build pip install --no-progress --link-mode clone opencv-python opencv-contrib-python --no-build --no-deps
uv venv -q && cargo run -q --profile fast-build pip install --no-progress --link-mode copy opencv-python opencv-contrib-python --no-build --no-deps
uv venv -q && cargo run -q --profile fast-build pip install --no-progress --link-mode hardlink opencv-python opencv-contrib-python --no-build --no-deps
uv venv -q && cargo run -q --profile fast-build pip install --no-progress --link-mode symlink opencv-python opencv-contrib-python --no-build --no-deps
```

We currently only catch conflicts in a single installation. Should we
prime the lock database with the site-packages contents, and would that
carry overhead?
2025-08-08 09:01:13 +00:00
Zanie Blue 8968d783de
Add support for `--prefix` and `--with` installations in `find_uv_bin` (#14184)
Follows #14182

Adds support for the case described at
https://github.com/astral-sh/uv/issues/10194#issuecomment-2993544346

This also happens to fix both `--with` requirement test cases, which
should close https://github.com/tox-dev/pre-commit-uv/issues/70
2025-08-07 16:48:07 -05:00
William Woodruff 554f06c595
chore(ci): fix linting findings in ci.yml (#15152) 2025-08-07 17:47:34 -04:00
Zanie Blue 9425350478
Fix regression where `--require-hashes` applied to build dependencies in `uv pip install` (#15153)
Closes https://github.com/astral-sh/uv/issues/15146
2025-08-07 21:43:24 +00:00
Michael Šimáček e5eec05783
Ignore GraalPy devtag (#15013)
Allows [development builds of
GraalPy](https://github.com/graalvm/graal-languages-ea-builds) to work
with uv.

CC @timfel
2025-08-07 15:53:37 -05:00
Lars Grams d73edb019d
replace manual venv removal with remove_virtualenv (#15007)
<!--
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? -->
At some places the virtualenv directory was manually removed instead of
using `remove_virtualenv`.
I also adjusted the error type.
#14985 

## Test Plan

<!-- How was it tested? -->
2025-08-07 15:52:57 -05:00
Yury Fedotov 7b1fb5b50b
Add missing periods (`.`) to list elements in `Features` docs page (#15138)
The [**Features**](https://docs.astral.sh/uv/getting-started/features/)
page of docs contains a lot of markdown lists, elements of which end
with `.`.

For example:

<img width="571" height="267" alt="image"
src="https://github.com/user-attachments/assets/b485f310-fece-4da4-acb9-ebc68b9df7d3"
/>

---

Out of tens of list elements, just two are outliers and do not use `.`
at the end.

So this small PR fixes this little inconsistency :)
2025-08-07 15:42:50 -05:00
William Woodruff 0165337732
chore(ci): add zizmor workflow (#15148) 2025-08-07 16:30:18 -04:00
Zanie Blue b1a036ccf5
Refactor `find_uv_bin` and add a better error message (#14182)
Follows https://github.com/astral-sh/uv/pull/14181

Two goals here

- Remove duplicated logic and make the search order clear
- Resolve user confusion around the searched directories; we previously
only displayed the last attempt, which we rarely expect to be relevant
2025-08-07 15:10:38 -05:00
Zanie Blue a7c4634243
Add a regression test for `--require-hashes` with unpinned build requirements (#15147)
Test case for https://github.com/astral-sh/uv/issues/15146
2025-08-07 20:04:18 +00:00
William Woodruff 16cb6af605
chore(ci): fix lint findings in build-docker (#15145)
## Summary

Addresses zizmor findings in `build-docker.yml`.

Key changes: primarily removing template expansions and restricting some
permissions.

## Test Plan

Let the CI run.

Signed-off-by: William Woodruff <william@astral.sh>
2025-08-07 14:58:13 -05:00
Zanie Blue ceb610c047
Update `find_uv_bin` to locate uv in the base prefix (#14181)
Closes https://github.com/astral-sh/uv/issues/10194
2025-08-07 13:40:57 -05:00
Zanie Blue 0011e91774
Add links to CHANGELOG (#15140) 2025-08-07 16:33:51 +00:00
Zanie Blue 9defbce7bd
Fixes to the 0.8.6 changelog (#15139) 2025-08-07 10:21:11 -05:00
Charlie Marsh 329a6b446a
Bump version to v0.8.6 (#15137) 2025-08-07 16:17:14 +01:00
samypr100 abc68fc7c1
Consider pythonw when copying entrypoints in uv run (#15134)
## Summary

Follow up from
https://github.com/astral-sh/uv/pull/15068#discussion_r2258586926

It seems when copying entrypoints we're ignoring whether it was pythonw
vs not.

## Test Plan

Updated existing test.
2025-08-07 10:06:03 -05:00
Charlie Marsh 7f1eaf48c1
Harden ZIP streaming to reject repeated entries and other malformed ZIP files (#15136)
## Summary

uv will now reject ZIP files that meet any of the following conditions:

- Multiple local header entries exist for the same file with different
contents.
- A local header entry exists for a file that isn't included in the
end-of-central directory record.
- An entry exists in the end-of-central directory record that does not
have a corresponding local header.
- The ZIP file contains contents after the first end-of-central
directory record.
- The CRC32 doesn't match between the local file header and the
end-of-central directory record.
- The compressed size doesn't match between the local file header and
the end-of-central directory record.
- The uncompressed size doesn't match between the local file header and
the end-of-central directory record.
- The reported central directory offset (in the end-of-central-directory
header) does not match the actual offset.
- The reported ZIP64 end of central directory locator offset does not
match the actual offset.

We also validate the above for files with data descriptors, which we
previously ignored.

Wheels from the most recent releases of the top 15,000 packages on PyPI
have been confirmed to pass these checks, and PyPI will also reject ZIPs
under many of the same conditions (at upload time) in the future.

In rare cases, this validation can be disabled by setting
`UV_INSECURE_NO_ZIP_VALIDATION=1`. Any validations should be reported to
the uv issue tracker and to the upstream package maintainer.
2025-08-07 15:31:48 +01:00
github-actions[bot] 038bf56366
Sync latest Python releases (#15135)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-08-07 13:59:02 +00:00
konsti 84d57f2ee9
Ensure symlink warning is shown (#15126)
Fixes #15115, see also https://github.com/clap-rs/clap/discussions/6092

<img width="1079" height="1030" alt="image"
src="https://github.com/user-attachments/assets/05b003a6-9ca0-4f2b-8a74-078aa155ce6d"
/>
2025-08-07 15:56:59 +02:00
Zanie Blue 9c634d9b13
Upgrade h2 again (#15111)
Closes https://github.com/astral-sh/uv/issues/15056

Following https://github.com/hyperium/h2/pull/858 I'm hoping the
defaults there are more robust and no longer cause the problems reported
in the above issue.

As @konstin noted at
https://github.com/hyperium/h2/issues/856#issuecomment-3160720671, we
may want to tweak the h2 settings during prefetches if we encounter this
problem again.
2025-08-07 08:53:12 -05:00
Zanie Blue 278295ef02
Add test cases for `find_uv_bin` (#15110)
Adds test cases to unblock

- https://github.com/astral-sh/uv/pull/14181
- https://github.com/astral-sh/uv/pull/14182
- https://github.com/astral-sh/uv/pull/14184
- https://github.com/astral-sh/uv/pull/14184
- https://github.com/tox-dev/pre-commit-uv/issues/70

We use a package with a symlink to the Python module to get a mock
installation of uv without building (or packaging) the uv binary. This
lets us test real patterns like `uv pip install --prefix` without
encoding logic about where things are placed during those installs.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-08-07 07:14:01 -05:00
Zanie Blue aec90f0a3c
Fix warnings when running tests with a subset of features (#15120)
We were getting dead code warnings on Windows tests because these were
not properly feature gated.
2025-08-07 01:28:26 +00:00
Charlie Marsh 3c1844ca4a
Add support for per-project build-time environment variables (#15095)
## Summary

E.g., you can now do:

```toml
[tool.uv.extra-build-variables]
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
```
2025-08-06 18:01:55 -05:00
William Woodruff fb518380ab
chore(ci): address linting findings in sync-python-releases.yml (#15117)
## Summary

Continuing to burn these down, one at a time.

This eliminates some implicit credentials, moves a permission block to
its minimum scope of effect, and removes an (unexploitable) template
expansion.

@konstin to answer your earlier question: I tried `permissions:` this
time and got a syntax warning, so I suspect it _needs_ to be an empty
mapping object here 🙂

## Test Plan

I will manually dispatch this workflow once the PR is open.

Edit: Dispatched:
https://github.com/astral-sh/uv/actions/runs/16787049700/job/47540074086

Signed-off-by: William Woodruff <william@astral.sh>
2025-08-06 15:45:19 -05:00
Charlie Marsh 371502df62
Upgrade `cargo-dist` to add `UV_INSTALLER_URL` to PowerShell installer (#15114)
## Summary

This ensures that `UV_INSTALLER_URL` is present in the PowerShell
installer.
2025-08-06 21:23:34 +01:00
konsti 59558b13c1
Respect `UV_HTTP_RETRIES` in `uv publish` (#15106)
Previously, publish would always use the default retries, now it
respects `UV_HTTP_RETRIES`

Some awkward error handling to avoid pulling anyhow into uv-publish.
2025-08-06 17:59:17 +02:00
William Woodruff aa758ae402
Address linter findings in build-binaries.yml (#15019)
## Summary

Addresses (mostly minor) findings in `build-binaries.yml`. This is 99%
replacing template expansions with shell-interpolated variables, plus
adding `persist-credentials: false` to every checkout.

## Test Plan

See what happens in CI.

---------

Signed-off-by: William Woodruff <william@astral.sh>
2025-08-06 10:52:10 -05:00
konsti 52771476f4
Support `UV_NO_EDITABLE` where `--no-editable` is supported (#15107)
Specifically, support `UV_NO_EDITABLE=1 uv export`. It's now also
supported in `uv add`, though it's default there anyway and the env var
exists only for completeness.

Fixes #15103
2025-08-06 13:06:49 +00:00
samypr100 d2330615c4
Update trampoline to ~1.87 nightly (#15052)
## Summary

1. Given the upcoming 1.89 update, this bumps uv-trampoline to "~1.87"
(closest nightly) from "~1.86" (closest nightly).
2. Adds additional CI check for arm builds now that runners are
available.

I wasn't sure the MSRV policy applies to uv-trampoline, so I didn't go
for higher than ~1.87 nightly.
This PR also fixes a build issue starting after 1.87 where fma and fmaf
symbols were missing.
Temporarily dded `#[allow(clippy::ptr_eq)]` to `close_handles` as this
lint should not trigger anymore in 1.88 and above.

## Test Plan

Existing tests and local build process. I did not commit the built
binaries for security purposes.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-08-06 12:45:04 +00:00
konsti 91653f5fee
Avoid invalid simplification with conflict markers (#15041)
Previously, `simplify_conflict_markers` assumed that it can remove all
conflict set together, when we need to look at each conflict set
individually. Specifically, `(platform_machine == 'x86_64' and extra ==
'extra-5-foo-b') or extra == 'extra-5-foo-a'` can't be reduced
`platform_machine == 'x86_64'` only because it reduces to true when both
conflict extras are activated.

This case applied in https://github.com/astral-sh/uv/issues/14805, where
a jax 0.5.3 version was used for `platform_machine != 'aarch64' or
sys_platform != 'linux'` and the conflict extra `cu128`, but jax 0.7.0
for the conflict extra `cpu`.

Only removing the faulty inference regresses lockfiles to much more
verbose markers. To balance the much more conservative inference, I
added `unify_inference_sets` to simplify cases where all conflict
branches reduce to the same marker.

This still regresses some markers. For example `sys_platform == 'win32'`
regresses to `sys_platform == 'win32' or (extra == 'extra-3-pkg-x1' and
extra == 'extra-3-pkg-x2')` in `extra_inferences`, even through x1 and
x2 conflict and the second conjunction could be simplified away.

Fixes https://github.com/astral-sh/uv/issues/14805
2025-08-06 09:26:26 +00:00
Zanie Blue ce37286814
Bump version to 0.8.5 (#15093) 2025-08-05 20:21:00 +00:00
adamnemecek 3d3856ffd5
additional use of Self, remove * and & where not needed (#15091)
continuation of #15074.
2025-08-05 15:19:56 -05:00
Charlie Marsh bda9ea957a
Support `match-runtime = true` in the `uv pip` CLI (#15087)
## Summary

Pretty straightforward, a ~one line change plus recreating the
`BuildDispatch` (which I tried to avoid, but ran into lifetime issues).
2025-08-05 20:03:10 +00:00
Zanie Blue 1fb0fa045c
Add Python versions to markers implied from wheels (#14913)
Looking into  https://github.com/astral-sh/uv/issues/14836

This does resolve the issue, if the user adds `python_version ==
'3.8.*'` to the `required-environments`.
2025-08-05 14:52:32 -05:00
Zanie Blue b2e7b2b279
Improve HTTP response caching log messages (#15067)
"Cached request ... is not storable" doesn't make sense from a user
perspective, it's leaking our internal `CachedClient` abstraction. I
think it makes more sense to talk about this as "Response from ... is
not storable"
2025-08-05 14:34:12 -05:00
adamnemecek 3f83390e34
Make the use of `Self` consistent. (#15074)
## Summary

Make the use of `Self` consistent. Mostly done by running `cargo clippy
--fix -- -A clippy::all -W clippy::use_self`.

## Test Plan

<!-- How was it tested? -->
No need.
2025-08-05 20:17:12 +01:00
Charlie Marsh 57f900ad0d
Take a build constraints reference in `BuildDispatch` (#15090)
## Summary

This is just more consistent with the other fields.
2025-08-05 18:28:02 +00:00
Charlie Marsh 089b6d5538
Use "option" instead of "setting" in `pylock` warning (#15089)
## Summary

We use "option" everywhere else (though I don't have a strong opinion on
which is "better").
2025-08-05 18:17:30 +00:00
Charlie Marsh 327af017ae
Remove duplicate `extra-build-dependencies` warnings for `uv pip` (#15088)
## Summary

These are repeated for all the `uv pip` commands.
2025-08-05 19:14:58 +01:00
Charlie Marsh 8ef3b2eb8e
Enable extra build dependencies to 'match runtime' versions (#15036)
## Summary

This is an alternative to https://github.com/astral-sh/uv/pull/14944
that functions a little differently. Rather than adding separate
strategies, you can instead say:

```toml
[tool.uv.extra-build-dependencies]
child = [{ requirement = "anyio", match-runtime = true }]
```

Which will then enforce that `anyio` uses the same version as in the
lockfile.
2025-08-05 19:00:44 +01:00
Charlie Marsh b2c382f7c1
Revert h2 upgrade (#15079)
## Summary

While we figure out what's going on in
https://github.com/hyperium/h2/issues/856.

Closes https://github.com/astral-sh/uv/issues/15056.
2025-08-05 06:55:58 -05:00
Zanie Blue 8db61abb50
Prefer system Python installations over managed ones when `--system` is used (#15061)
This fixes a regression from 0.8.0 from
https://github.com/astral-sh/uv/pull/7934 and follows
https://github.com/astral-sh/uv/pull/15059

The regression is from [this
change](https://github.com/astral-sh/uv/pull/7934/files#diff-c7a660ac39628d5e12f388b0cacc7360affa3d7bb21191184d7ee78489675e83),
which was made because we'd otherwise (with the other changes in that
pull request) _filter out_ managed Python interpreters found in virtual
environments.

When `--system` is used we'll convert the default Python preference of
`managed` to `system` which avoids things like `uv pip install --system`
targeting a managed Python installation.

The basic test is

```
uv python install
uv pip install --system anyio
```

Prior to this change, we'd read a managed interpreter from our managed
installation directory and target that. After this change, without
#15059, we'd read a managed interpreter from the PATH and target that.
Both of those experiences are bad, because the managed interpreters are
marked as externally managed. After this change, with #15059, we
properly target the system interpreter.

Since we use `system` instead of `only-system`, if there is not a system
interpreter we'll still retain our existing behavior and use a managed
interpreter. This should limit breakage from the change. Given the
source of the regression, we could probably use `only-system` here. I
don't feel strongly. I think the main benefit of doing so would be that
we'd omit the check for managed installations in error messages when an
interpreter cannot be found?

We can't really add test coverage here because the test suite always has
externally managed interpreters :)
2025-08-04 19:53:59 -05:00
Charlie Marsh c77cb2023f
Show wheel tag hints in install plan (#15066)
## Summary

If we fail to install a wheel in `uv pip install` that's provided via
direct URL, we should explain why, just like in the lockfile.
2025-08-04 23:43:33 +00:00
Charlie Marsh 3b15da3c5d
Enable `uv run` with a GitHub Gist (#15058)
## Summary

You can now run `uv run
https://gist.github.com/charliermarsh/ea9eab7f56b1b3d41e51960001cae31d`
to execute a single-file Gist without having to go in and copy the raw
URL.
2025-08-05 00:38:20 +01:00
Charlie Marsh a28c3fb7d9
Preserve lowered extra build dependencies (#15038)
## Summary

I should've noticed this during review -- my bad -- but it looks like
after lowering, we're converting back to `uv_pep508::Requirement`. This
is mostly okay, but it's lossy for some lowerings. For example, we lose
index pinning. With this PR, we now preserve the lowered types
(`Requirement`).

Closes https://github.com/astral-sh/uv/issues/15037.
2025-08-04 22:42:11 +01:00
Zanie Blue 64e91a7e87
Fix handling of `python-preference = system` when managed interpreters are on the PATH (#15059)
This is the first part of fixing a 0.8.0 regression from
https://github.com/astral-sh/uv/pull/7934

There, we added handling for skipping managed interpreters on the PATH
when `only-system` is used, but did not update the logic to prefer
system interpreters over managed ones when `system` is used. Here, we
fix that by skipping managed interpreters when `system` is used unless
_only_ managed interpreters are available. While this logic is applied
during in a general discovery method, it's only relevant for the PATH
(and the Windows registry) because we already change the _order_ that we
inspect installations in when `system` is used, so the managed
installation directory is inspected last.

This behavior did not regress in 0.8, it's always been this way,
however, I need this change in order to fix a different bug.
2025-08-04 16:02:42 +00:00
Zanie Blue 8186aa963f
Remove test case that does not include global exclude newer (#15062)
Of course, this would flake over time.

Follows https://github.com/astral-sh/uv/pull/15054
2025-08-04 15:03:10 +00:00
renovate[bot] 60ddaddc9c
Update google-github-actions/auth digest to b7593ed (#15044)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| google-github-actions/auth | action | digest | `140bb51` -> `b7593ed`
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-04 10:26:13 +00:00
renovate[bot] 58d34e7f6d
Update Rust crate rkyv to v0.8.11 (#15049)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [rkyv](https://redirect.github.com/rkyv/rkyv) | workspace.dependencies
| patch | `0.8.10` -> `0.8.11` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [x] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/uv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-04 10:14:20 +00:00