Commit Graph

5803 Commits

Author SHA1 Message Date
Zanie Blue c0801e35ae Show workspace dependencies in `uv workspace metadata` 2025-11-07 11:53:38 -05:00
Zanie Blue 052b89d733 Add `uv workspace metadata` 2025-10-30 18:40:04 -04:00
Zanie Blue a1610c794e
Add Windows x86-32 emulation support to interpreter architecture checks (#13475)
Closes https://github.com/astral-sh/uv/issues/13471

Refactors the logic there a bit too.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-10-30 10:50:26 -04:00
Clemens Brunner c7aaa8b7ef
Improve readability of progress bars (#16509)
<!--
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

Improve readability of progress bars by drawing the right portions in
dimmed black instead of dimmed green. This makes it much easier to
distinguish from the left (finished) part, which is drawn in green.

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

## Test Plan

Tested locally, looks as follows:

<img width="1100" height="731" alt="white"
src="https://github.com/user-attachments/assets/2a396e96-27ef-41ed-8b03-a0de2061af12"
/>
<img width="1100" height="731" alt="black"
src="https://github.com/user-attachments/assets/85d03a3a-a1dc-4389-9e51-fd486e60e067"
/>
2025-10-30 14:16:28 +00:00
Zanie Blue 2652244655
Bump version to 0.9.6 (#16500)
Signed-off-by: William Woodruff <william@astral.sh>
Co-authored-by: William Woodruff <william@astral.sh>
2025-10-29 14:08:49 -05:00
konsti de96aa13f2
Use std `home_dir` instead of `home` crate (#16483)
The `home_dir` function in std was deprecated for some years for reading
`HOME` on Windows. It has recently been fixed and undeprecated:
https://github.com/rust-lang/rust/pull/132515

Conversely, the Cargo maintainers want us to move away from the home
crate (https://github.com/rust-lang/cargo/tree/master/crates/home):

> Note: This has been fixed in Rust 1.85 to no longer use the HOME
environment variable on Windows. If you are still using this crate for
the purpose of getting a home directory, you are strongly encouraged to
switch to using the standard library's home_dir instead. It is planned
to have the deprecation notice removed in 1.87.
>
> This crate further provides two functions, cargo_home and rustup_home,
which are the canonical way to determine the location that Cargo and
rustup store their data.
>
> See rust-lang/rust#43321.
>
> > This crate is maintained by the Cargo team, primarily for use by
Cargo and Rustup and not intended for external use. This crate may make
major changes to its APIs or be deprecated without warning.

When https://github.com/lunacookies/etcetera/pull/36 merges, we can
remove the home crate from our dependency tree.
2025-10-29 18:49:08 +01:00
twilligon db1d34e91b
Support GitHub Gist URLs via HTTP redirects in `uv run` (#16451)
## Summary

Extend the existing GitHub Gist URL support from #15058 to handle URLs
that redirect to Gists.

`reqwest` already handled generic URL redirects for us (note this
redirects directly to the `.py` on `gist.githubusercontent.com`):

~/git/uv $ uv run
c28a4bf0cb/hello.py
    hello world!

But running a URL that redirected to a Gist's "main page" (a bit.ly link
leading to a Gist, etc.) did not:

~/git/uv $ uv run
https://httpbin.org/redirect-to?url=https://gist.github.com/twilligon/4d878a4d9550a4f1df258cde1f058699
      File "/tmp/scriptNodt3Q.py", line 87
        <title>hello.py · GitHub</title>

But if we have `reqwest` follow redirects *before* `resolve_gist_url`,
we can handle this fine:

~/git/uv $ target/debug/uv run
https://httpbin.org/redirect-to?url=https://gist.github.com/twilligon/4d878a4d9550a4f1df258cde1f058699
    hello world!

## Test Plan

I'd write an automated test but that'd require network access since
wiremock doesn't seem to support mocking specific hostnames like
`gist.github.com`. As manual tests go, I basically did the above,
testing with several redirectors to both generic and Gist URLs.
2025-10-29 12:30:22 -04:00
William Woodruff c6d0b412a0
Limit `uv auth login pyx.dev` retries to 60s (#16498)
## Summary

Without this, a user who does `uv auth login ...` will retry against the
service's status endpoint forever. This probably isn't what they
intended (they probably walked away from their machine), so we end their
login initiation session after 60 retries. Since we do a retry every
second, this gives them no less than a minute to complete a login (which
should be more than enough).

## Test Plan

We don't have browser-negotiated login tests at the moment in CI, but
I've tested this locally:

```console
% ./target/debug/uv auth login pyx.dev
Logging in with https://api.pyx.dev/auth/cli/login/REDACTED
error: Login session timed out
```

(That took well over a minute, so 60s is a lower bound assuming a very
optimal network roundtrip on each poll.)

---------

Signed-off-by: William Woodruff <william@astral.sh>
2025-10-29 10:39:23 -05:00
William Woodruff 2d54f329e5
Fix a small clippy warning (#16499)
## Summary

Missed this with another PR.

## Test Plan

NFC.

Signed-off-by: William Woodruff <william@astral.sh>
2025-10-29 10:38:27 -05:00
Charlie Marsh c4f5741e7d
Add an empty group with `uv add -r` (#16490)
## Summary

`uv add -r requirements.txt --group foo` will now create `foo` even if
`requirements.txt` is empty.

Closes https://github.com/astral-sh/uv/issues/16361.
2025-10-29 11:31:03 -04:00
William Woodruff da659fee48
Merge commit from fork
* feat: reject ZIP archives with improbable filenames

Signed-off-by: William Woodruff <william@astral.sh>

* use my PR for async_zip temporarily

Signed-off-by: William Woodruff <william@astral.sh>

* update snapshot

Signed-off-by: William Woodruff <william@astral.sh>

* two more tests

Signed-off-by: William Woodruff <william@astral.sh>

* update rev

Signed-off-by: William Woodruff <william@astral.sh>

---------

Signed-off-by: William Woodruff <william@astral.sh>
2025-10-29 11:11:06 -04:00
github-actions[bot] 41cd3d1926
Sync latest Python releases (#16486)
Automated update for Python releases.

Co-authored-by: jjhelmus <1050278+jjhelmus@users.noreply.github.com>
2025-10-29 10:10:49 -05:00
Charlie Marsh a759612bc8
Show package list with `pip freeze --quiet` (#16491)
## Summary

Closes https://github.com/astral-sh/uv/issues/16178.
2025-10-29 11:00:00 -04:00
konsti cfa1de311e
Add `--no-create-gitignore` to `uv build` (#16369)
Fixes #16332
2025-10-28 07:25:31 -05:00
konsti c279b4ab54
Only run debug assertion tests when debug assertions are active (#16479)
These tests currently fail when running tests in release mode.
2025-10-28 12:21:58 +00:00
liam 3fb3c9af03
Clarify system Python discovery logging order (#16463)
Resolves https://github.com/astral-sh/uv/issues/16453

When `--system` is used, the debug log now reports interpreter discovery
sources in the same order they are probed, prioritising the PATH ahead
of managed installs on every platform. I also added a few unit tests
that use `DiscoveryPreferences::sources`, ensuring the log strings stay
aligned with the actual discovery sequence for both System and
OnlySystem preferences.
2025-10-28 07:18:13 -05:00
konsti 804f1ff808
Add `--clear` to `uv build` to remove old build artifacts (#16371)
Add `uv build --clear` that behaves like `rm -r ./dist && uv build` to
clear artifacts from previous builds. This avoids accidentally
publishing the wrong artifacts and removes accumulated old builds.

See https://github.com/astral-sh/uv/issues/10293#issuecomment-3405904013
Fixes #10293
2025-10-27 18:15:17 +00:00
elle fe5d944afa
Change reporter length to `Option` (#16448)
## Summary

Changes the `length` parameter to `PythonDownloadReporter::new` to an
`Option<u64>` to resolve the issue of setting a single-item reporter
length.

Resolves: #15404

## Test Plan

- build test
- ran test suite
2025-10-27 17:17:14 +01:00
Matthijs Kok 85c01b29d5
Update maturin build backend init template (#16449)
## Summary

Upgrades to the latest Rust edition and pyo3 version. 
Change initialized module to "Inline Declaration" format.
https://pyo3.rs/v0.27.1/module.html#inline-declaration

The output of `maturin new` is also updating to the new declarative
format

342239a95a

## Test Plan

Updated the relevant snapshot tests and to confirm ran
`cargo nextest run --all-features --no-fail-fast maturin`

Also used the updated template to generate a library in a different
project with
```
cargo run -- init --lib --build-backend maturin --name try-template ../_OTHER_PROJECT_/backend/try-template
```
and the generated workspace member functioned as expected.
2025-10-27 10:58:17 +01:00
Zanie Blue e2eea6d7db
Fix root of `uv tree` when `--package` is used with circular dependencies (#15908)
Closes #15907

Best viewed with
https://github.com/astral-sh/uv/pull/15908/files?diff=unified&w=1

When `--package` is used, just use those as the roots rather than
calculating them. I'm not sure if there will be undesirable
side-effects, but it's the naive solution.
2025-10-26 22:01:00 -04:00
liam ae6607d5dc
Deterministically order `--find-links` distributions (#16446)
Made to address this comment:
https://github.com/astral-sh/uv/pull/16103#discussion_r2437498249

This PR sorts the distributions collected by
`FlatIndexClient::read_from_directory` (used for `--find-links`) so
results are ordered deterministically by filename and index.
2025-10-26 21:53:32 -04:00
Zanie Blue 17181fef07
Do not error when a virtual environment directory cannot be removed due to a busy error (#16394)
Closes https://github.com/astral-sh/uv/issues/16218

This occurs when using a mounted file system in Docker.

We're almost always removing a virtual environment to replace it, and
removing the parent directory isn't necessary for that.
2025-10-23 15:08:53 -05:00
konsti 491293362f
Don't panic in `uv export --frozen` when the lockfile is outdated (#16407)
Provide a good error message when the discovered workspace members
mismatch with the locked workspace members in `uv export --frozen`,
instead of panicking.

Fixes #16406
2025-10-23 15:07:14 -05:00
Zanie Blue 940a3f63ce
Use the Python download cache during `python_upgrade` tests (#16421) 2025-10-23 10:48:45 -05:00
Zanie Blue 1fbc1c7ff4
Check for matching Python implementation during `uv python upgrade` (#16420)
Closes https://github.com/astral-sh/uv/issues/16416
2025-10-23 10:48:34 -05:00
github-actions[bot] 00bf80bfda
Upgrade GraalPy to 25.0.1 (#16401)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-10-23 15:16:37 +00:00
Zanie Blue 0959763a82
Improve hint on `pip install --system` when externally managed (#16392)
I had some qualms with https://github.com/astral-sh/uv/pull/16318

1. The snapshot was specific to uv's managed interpreter due to
inclusion of the externally-managed output. This will break downstream
distros. We either need to filter the message, or, as done here, install
a managed interpreter.
2. It had a custom filter for the interpreter path, which we shouldn't
need. If needed, we should fix that in the test context.
3. We already had an implicit hint to create a virtual environment. The
change in styling of the new hint hint following it is confusing. It's
also confusing to hint creating a virtual environment when `--system`
was used.
4. There were unresolved requested changes to the language for the
message / it didn't fit stylistic with our existing ones.
5. The message was also very confusing for a uv-managed interpreter,
which is both a "system" Python interpreter (in that it's global) and
the opposite of a "system" interpreter per UV_PYTHON_PREFERENCE.

Also problematic, but not addressed here, is that there are other
commands that display an externally-managed message, e.g., `uv pip
sync`, but #16318 was just limited to `pip install`. We should not just
implement this in one place — I'll open a tracking issue to consolidate
and reuse the logic.
2025-10-21 17:59:01 +00:00
Charles-Meldhine Madi Mnemoi 225bffbb6c
Running `uv lock --check` with outdated lockfile will print that `--check` was passed, instead of `--locked` (#16322)
Hello,

# Summary

This PR fixes the confusing error message when running `uv lock --check`
with an outdated lockfile.

Previously, the error message incorrectly stated that `--locked` was
provided, even when the user used `--check`.

Now, the error message correctly indicates which flag was used: either
`--check` or `--locked`.

This closes #14105.

# Test plan

- I updated the existing integration test (`check_outdated_lock` in
`lock.rs`) to verify the new error message includes the correct flag.
- I ran existing tests to ensure I have no introduced regressions for
other commands.
2025-10-21 12:46:10 -05:00
William Woodruff d5f39331a7
Bump version to 0.9.5 (#16389) 2025-10-21 12:14:22 -04:00
Samuel Rigaud 2fc5fe2ac0
fix small typos (#16357)
## Summary

I tried to fix minor typos in the project

---------

Co-authored-by: Samuel Rigaud <rigaud@gmail.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-10-21 12:11:59 +00:00
Jordan Borean 17155c4cca
Fix backtick escaping for PowerShell (#16307)
## Summary
Fixes the logic for escaping a double quoted string in PowerShell by not
escaping a backslash but escaping the Unicode double quote variants that
PowerShell treats the same as the ASCII double quotes.

<img width="685" height="99" alt="image"
src="https://github.com/user-attachments/assets/ac1368c2-d915-4e49-b67f-ac71ee0f7d46"
/>

## Test Plan
There does not seem to be any tests for this. I'm fairly new to rust but
happy to add some if someone can point me in the right direction.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-10-21 10:16:21 +00:00
Andrei Berenda 51e8da2d1c
Move parsing http retries to EnvironmentOptions (#16284)
## Summary
- Move  parsing `UV_HTTP_RETRIES` to `EnvironmentOptions`

Relates https://github.com/astral-sh/uv/issues/14720

## Test Plan

- Tests with existing tests
2025-10-21 11:14:37 +02:00
Charles-Meldhine Madi Mnemoi 29cec24d5c
fix: Add a hint on `uv pip install` failure if the `--system` flag is used to select an externally managed interpreter (#16318)
Hello,

# Summary
This PR makes the error message clearer when you try to install packages
into an externally managed Python environment with the `--system` flag.
Now, instead of just failing, the error explains that you're hitting
this because you explicitly used `--system`.

This closes #15639.

# Test plan

- I added a new integration test (`install_with_system_interpreter` in
`pip_install.rs`) that checks the error message includes the hint.
- I tried to run `uv pip install --system -r requirements.txt` to see
the actual error message in action, but had permission issues.
2025-10-21 07:46:39 +00:00
github-actions[bot] ed65c2482c
Sync latest Python releases (#16246)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-10-21 00:41:53 +00:00
eun2ce e0fe38eabb
Improve 403 Forbidden error message to indicate package may not exist (#16353)
Fixes #16340

## Summary

Some package registries (PyTorch, corporate PyPI mirrors) return `403
Forbidden` when a package is not found, instead of `404 Not Found`. The
previous error message incorrectly suggested this was always an
authentication issue, causing confusion for users.

This PR updates the error hint to clarify that a 403 error could
indicate either missing authentication credentials OR that the package
doesn't exist on the index.

## Test Plan

- Updated existing snapshot test in `crates/uv/tests/it/edit.rs` to
reflect the new error message
- The change is purely a message improvement with no behavioral changes

## Changes

### Before

hint: An index URL (https://example.com/simple) could not be queried due
to a lack of valid authentication credentials (403 Forbidden).

### After

hint: An index URL (https://example.com/simple) returned a 403 Forbidden
error. This could indicate missing authentication credentials, or the
package may not exist on this index.


## Files Changed

- `crates/uv-resolver/src/pubgrub/report.rs` - Updated error message
- `crates/uv/tests/it/edit.rs` - Updated snapshot test expectation

---------

Co-authored-by: eun2ce <eun2ce@eun2ceui-MacBookPro.local>
Co-authored-by: konstin <konstin@mailbox.org>
2025-10-20 11:43:18 +00:00
Parham MohammadAlizadeh ed3f99a119
Add required environment marker example to hint (#16244)
## Summary
fixes issue #15938 
- show platform wheel hint with a concrete
`tool.uv.required-environments` example so users know how to configure
compatibility
- add `WheelTagHint::suggest_environment_marker` to pick a sensible
environment marker based on the available wheel tags
- update the `sync_required_environment_hint` integration snapshot to
expect the new multi-line hint

## Test Plan

cargo test --package uv --test it --
sync::sync_required_environment_hint
2025-10-20 13:08:10 +02:00
Björn Dahlgren 57f56467d9
Fix typo in MissingTopLevel warning (#16351)
<!--
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? -->
The warning shown when `egg-info` lacks `top_level.txt` incorrectly
warns about missing `top-level.txt`

ee2649feaa/crates/uv-install-wheel/src/uninstall.rs (L179-L188)

ee2649feaa/crates/uv/src/commands/pip/operations.rs (L687-L693)

The non fatal warning with incorrect filename was introduced in
https://github.com/astral-sh/uv/pull/6881 which changed previous fatal
error https://github.com/astral-sh/uv/issues/6872 with correct
`top_level.txt` output.

## Test Plan

<!-- How was it tested? -->
Updated unit test to reflect change in warning
2025-10-19 11:32:50 +02:00
Zanie Blue ee2649feaa
Bump version to 0.9.4 (#16347) 2025-10-17 16:02:02 -05:00
Zanie Blue 7b3a9c2859
Avoid obfuscating pyx tokens in `uv auth token` output (#16345) 2025-10-17 19:19:05 +00:00
Yu, Guangye de9f299b80
Add auto-detection for Intel GPU on Windows (#16280)
This PR enables `--torch-backend=auto` to automatically detect Intel
GPUs. It follows up on
[#14386](https://github.com/astral-sh/uv/pull/14386).
On Windows, detection is implemented by querying the
`Win32_VideoController` class via the [WMI
crate](https://github.com/ohadravid/wmi-rs/tree/v0.16.0).

Currently, Intel GPUs (XPU) do not depend on specific driver or toolkit
versions to determine which PyTorch wheel to use.
2025-10-16 16:56:07 -04:00
Mark Dodgson c12e8bb343
Implement RFC9457 compliant messaging (#16199)
<!--
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

HTTP1.1 [RFC 9112 -
HTTP/1.1](https://www.rfc-editor.org/rfc/rfc9112.html#name-status-line)
section 4 defines the response status code to optionally include a text
description (human readable) of the reason for the status code.

[RFC9113 - HTTP/2](https://www.rfc-editor.org/rfc/rfc9113) is the HTTP2
protocol standard and the response status only considers the [status
code](https://www.rfc-editor.org/rfc/rfc9113#name-response-pseudo-header-fiel)
and not the reason phrase, and as such important information can be lost
in helping the client determine a route cause of a failure.

As per discussion on this
[PR](https://github.com/astral-sh/uv/pull/15979) the current feeling is
that implementing the RFC9457 standard might be the preferred route.
This PR makes those changes to aid the discussion which has also been
moved to the [PEP
board](https://discuss.python.org/t/block-download-of-components-when-violating-policy/104021/1)

## Test Plan

Pulling components that violate our policy over HTTP2 and without any
RFC9457 implementation the following message is presented to the user:
<img width="1482" height="104" alt="image"
src="https://github.com/user-attachments/assets/0afcd0d8-ca67-4f94-a6c2-131e3b6d8dcc"
/>


With the RFC9457 standard implemented, below you can see the advantage
in the extra context as to why the component has been blocked:
<img width="2171" height="127" alt="image"
src="https://github.com/user-attachments/assets/25bb5465-955d-4a76-9f30-5477fc2c866f"
/>

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-10-16 19:53:49 +00:00
Charlie Marsh bf81a5bf0c
Add CUDA 13.0 support (#16321)
## Summary

Closes https://github.com/astral-sh/uv/issues/16319.
2025-10-15 15:10:08 -04:00
konsti 766bd951cb
Use `uv_build` in `make_project` tests (#16298)
Skip downloading and running setuptools.
2025-10-15 20:45:32 +02:00
konsti 52cc3c8b94
Add missing `UV_TEST_NO_HTTP_RETRY_DELAY` check and better logging (#16313)
The `install_http_retries` test goes from 15s to 0.3s. Additionally, we
log the retry delay.
2025-10-15 20:45:21 +02:00
Zanie Blue 9db7d38cf7
Bump version to 0.9.3 (#16305) 2025-10-14 18:19:49 -05:00
Zanie Blue d1413a60d8
Add CPython 3.15.0a1 and 3.13.9 (#16304) 2025-10-14 18:05:44 -05:00
Mark Dodgson b151e0ea3d
Fix workspace with relative pathing (#16296)
<!--
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 #16285 

## Test Plan

<!-- How was it tested? -->
2025-10-14 19:15:19 +02:00
Geoffrey Thomas 8eada1685c
Fix comments on python_no_transparent_upgrade_with_venv_patch_specification (#16294)
I think this was originally intended to behave as the comments
specified, but the behavior changed in discussions in #13312 somewhere.
2025-10-14 07:32:47 -05:00
Zanie Blue 15829bb30a
Obfuscate Bearer Token values in logs (#16164)
Sometimes a credential's `Debug` formatted value appears in tracing logs
- make sure the credential doesn't appear there.

## Test plan

Added a test case + ran
```
uv pip install --default-index $PYX_API_URL/$SOME_INDEX $SOME_PACKAGE -vv
```
With an authenticated uv client and confirmed the tokens are obfuscated.

---------

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2025-10-13 08:28:20 -05:00
Andrei Berenda c7d3d549e2
Move parsing concurrency env variable to EnvironmentOptions (#16223)
## Summary
- Move parsing `UV_CONCURRENT_INSTALLS`, `UV_CONCURRENT_BUILDS` and
`UV_CONCURRENT_DOWNLOADS` to `EnvironmentOptions`

Relates https://github.com/astral-sh/uv/issues/14720

## Test Plan

- Tests with existing tests
- Add test with invalid parsing
2025-10-12 21:22:30 -04:00