Looking at #17485, I noticed we don't log when a request finishes,
making the log harder to read than necessary.
Example new log message:
```
TRACE Received response for revalidation request with status 304 Not Modified for: https://pypi.org/simple/idna/
```
This reduces the churn when changing test snapshots, as insta updates
the quotes when the contents change. Instead, we decouple it by updating
the quotes in bulk here.
Created by:
```
cargo insta test --accept --force-update-snapshots
```
Prevent concurrent processes from all refreshing the token
simultaneously by using a file lock. When a refresh is needed:
1. Acquire an exclusive file lock (which will block if another process
is refreshing)
3. Re-read the tokens from disk and check if they are fresh enough,
instead of making another request
4. Otherwise, perform the refresh and update the cached tokens
This prevents thundering herd issues when multiple concurrent processes
are invoking `uv auth token` or `uv auth helper` at the same time.
Also, set the tolerance for `uv auth helper` to the same as `uv auth
token` (5 minutes).
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Currently, it's possible to break our test suite by having an env var
set that influences uv, either a `UV_*` var, or something more generic
such as the XDG env vars. We previously fixed them env-var-by-env-var as
we discovered. By clearing uv-specific env var for subcommands, we can
invert this.
We intentionally avoid clearing all env vars as some of them, especially
on Windows, are system env vars required for basic operations.
Notable limitations are that this only affects tests that use
`TestContext::add_shared_env` (default, can be opted-out).
Fixed#9873
<!--
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
Makes it easier to run integration tests in offline environments by
gating four new tests on the `pypi` feature. All of these tests fail in
offline environments when they try to make HTTPS requests to PyPI.
<!-- What's the purpose of the change? What does it do, and why? -->
## Test Plan
<!-- How was it tested? -->
Applied as a patch to Fedora’s [`uv`
package](https://src.fedoraproject.org/rpms/uv); built and ran
integration tests in an offline environment.
## Summary
Suggest using a newer uv version when a managed python installation request
fails with `NoDownloadFound`.
Before:
```
error: No interpreter found for Python ==3.14.* in managed installations or search path
```
After:
```
error: No interpreter found for Python ==3.14.* in managed installations or search path
hint: uv embeds available Python downloads and may require an update to install new versions. Consider retrying on a newer version of uv.
```
## Test Plan
Integration test added for this case.
---------
Co-authored-by: Zanie Blue <contact@zanie.dev>
https://discuss.python.org/t/pep-819-json-package-metadata/105558
Add an experimental JSON format for METADATA and WHEEL files in the uv
build backend to have a reference what it would look like and to
demonstrate that the actual change is just a few lines, how much easier
it is than the existing email header format.
The change is overwhelmingly adding the preview feature as it's the
first preview item in the build backend, writing the actual JSON is only
a couple of lines.
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
Following #16918, mark additional system-level settings as
`uv_toml_only` so they don't appear in the `pyproject.toml`
documentation examples:
- `native-tls`
- `cache-dir`
- `python-install-mirror`
- `pypy-install-mirror`
- `python-downloads-json-url`
Eventually, we'll want to ban these in the `pyproject.toml` without some
opt-in.
Co-authored-by: Claude <noreply@anthropic.com>
<!--
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
Fixes#17210.
## Test Plan
Added a test function.
Co-authored-by: Zanie Blue <contact@zanie.dev>
Resolves https://github.com/astral-sh/uv/issues/16846,
https://github.com/astral-sh/uv/issues/16813
This diff adds support for disabling `exclude-newer` for specific
packages using `<name>=false`. This allows packages
without upload dates (e.g., CPU-only PyTorch wheels from custom indices)
to be resolved when a global `exclude-newer` is set, without disabling
it globally.
---------
Co-authored-by: Zanie Blue <contact@zanie.dev>
## Summary
This changes how the `download-metadata.json` file is generated for
Pyodide.
Previously, if we have a different Pyodide version with a same Python
version, the older Pyodide version is selected.
For example, say we have
- Pyodide 0.29.0 with Python 3.13.2
- Pyodide 0.28.3 with Python 3.13.2
then, pyodide 0.28.3 was stored in `download-metadata.json` as we
iterate in decending order with overwriting the value that was
previously written.
I fixed it by picking up the latest Pyodide version for each Python
version.
## Test Plan
Ran `uv run -- crates/uv-python/fetch-download-metadata.py` locally, and
verified the output:
```
2026-01-09 15:39:23 INFO Fetching Pyodide checksums: 0/4
2026-01-09 15:39:24 INFO Selected cpython-3.13.2-emscripten-wasm32-musl (0.29.1)
2026-01-09 15:39:24 INFO Selected cpython-3.12.7-emscripten-wasm32-musl (0.27.7)
2026-01-09 15:39:24 INFO Selected cpython-3.12.1-emscripten-wasm32-musl (0.26.4)
2026-01-09 15:39:24 INFO Selected cpython-3.11.3-emscripten-wasm32-musl (0.25.1)
```
## Summary
Given `uv run foo/bar.py`, we now detect the workspace starting at
`foo/bar.py`, rather than the current working directory. I think this is
much more intuitive as demonstrated by the new test.
This change is currently in preview, but would ship as a breaking change
in v0.10.
## Summary
Implement #16408.
Currently doesn't avoid recompiling the bytecode when it is already
compiled which should be fine since the compiler script skips things
which are already compiled.
pyodide is currently unsupported due to it using a zip for its standard library
and also because it misreports the location of the standard library.
## Test Plan
Styling of the status report was manually tested, there is a new test
for testing the actual functionality.
## Summary
Closes https://github.com/astral-sh/uv/issues/17331
Certain applications on windows expect to be notified when environment
variables change such as conhost.exe (traditional cmd.exe host).
Without this notification conhost.exe will not pick up changes to
environment variables regardless of how many times conhost.exe is
re-launched after running `uv tool update-shell`.
## Test Plan
Before this change
1. Removed `%USERPROFILE%\.local\bin` from environment variables via UI
(which sends `WM_SETTINGCHANGE`)
2. Launched `%SYSTEMROOT%\System32\conhost.exe` and attempted to run any
tool preivously installed. It fails to find any.
3. Ran `uv tool update-shell`. Confirmed
`HKEY_CURRENT_USER\Environment\Path` was updated in registry.
4. Launched new `%SYSTEMROOT%\System32\conhost.exe` session. **Fails to
find installed tools**.
After this change
1. Removed `%USERPROFILE%\.local\bin` from environment variables via UI
(which sends `WM_SETTINGCHANGE`)
2. Launched `%SYSTEMROOT%\System32\conhost.exe` and attempted to run any
tool preivously installed. It fails to find any.
3. Ran `uv tool update-shell`. Confirmed
`HKEY_CURRENT_USER\Environment\Path` was updated in registry.
4. Launched new `%SYSTEMROOT%\System32\conhost.exe` session. **Finds the
installed tools**.
<!--
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 https://github.com/astral-sh/uv/issues/17174 mentioned the invalid
issues here:
results of diagnostics:
before:
```
--- TRAMPOLINE DIAGNOSTICS: STARTUP ---
STDIN: Handle=184
-> Console Mode: 503
STDOUT: Handle=536
-> Console Mode: 7
STDERR: Handle=540
-> Console Mode: 7
-------------------------------------------
--- TRAMPOLINE DIAGNOSTICS: AFTER CLOSE_HANDLES ---
STDIN: INVALID
STDOUT: INVALID
STDERR: Handle=540
-> Console Mode: 7
```
after:
```
--- TRAMPOLINE DIAGNOSTICS: STARTUP ---
STDIN: Handle=716
-> Console Mode: 503
STDOUT: Handle=580
-> Console Mode: 7
STDERR: Handle=604
-> Console Mode: 7
-------------------------------------------
--- TRAMPOLINE DIAGNOSTICS: AFTER CLOSE_HANDLES ---
STDIN: Handle=716
-> Console Mode: 503
STDOUT: Handle=580
-> Console Mode: 7
STDERR: Handle=604
-> Console Mode: 7
```
the problem was we were closing the handlers whatever they were from
pipes (byte streams) or consoles, this will make sure we close only the
handlers from pipes by using `FILE_TYPE_PIPE`
## Test Plan
<!-- How was it tested? -->
completely manual by adding debug statements and running a simple script
to open the pdb.
## Summary
For pyx, we can allow uploads that bypass the registry and send the file
directly to S3. This is an opt-in feature, enabled via the `--direct`
flag.
<!--
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? -->
This allows users to set the HTTP, HTTPS, and no proxy variables via the
configuration files like ~pyproject.toml~ and uv.toml.
Users can set like so:
`uv.toml`
```toml
https-proxy = "http://my_cool_proxy:10500"
http-proxy = "http://my_cool_proxy:10500"
no-proxy = [
"dontproxyme.com",
"localhost",
]
```
Resolves https://github.com/astral-sh/uv/issues/9472
## Test Plan
<!-- How was it tested? -->
It also adds a new integration test for the proxy support in
`uv-client`.
This was tested on some of our developer machines with our proxy setup
using `~/.config/uv/uv.toml` with values like:
```toml
https-proxy = "http://my_cool_proxy:10500"
http-proxy = "http://my_cool_proxy:10500"
no-proxy = [
"dontproxyme.com",
"localhost",
]
```
---------
Signed-off-by: Eli Uriegas <eliuriegas@meta.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
## Summary
Fixes https://github.com/astral-sh/uv/issues/17232
When `uv build` fails (e.g., due to missing `__init__.py`), partial
distribution
files were being left in the `dist/` directory.
### Changes
- Use `NamedTempFile` to write build output to a temporary file first
- Only persist the file to the final location on successful build
- If build fails, the temporary file is automatically cleaned up
- Added `Error::Persist` variant for handling persistence failures
## Test Plan
Added `no_partial_files_on_build_failure` test that verifies:
1. `build_source_dist` fails when `__init__.py` is missing
2. `build_wheel` fails when `__init__.py` is missing
3. The `dist/` directory remains empty after both failures (no partial
files)
---------
Co-authored-by: Hayashi Reo <reo@wantedly.com>
Formats the generated JSON schema with prettier so it doesn't fail CI
lints immediately after update.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Previously, we had a retry count both on the top level error type, and
on an error variant, and had a conversion step in between. When
reviewing #17274, I noticed we can simplify that.