Commit Graph

5369 Commits

Author SHA1 Message Date
konsti d9b76b97c2
Remove unreachable pub function (#14032)
Not sure how this landed on main, but rustc complained.
2025-06-13 18:04:13 +00:00
konsti da2eca4e2c
Make wiremock filter a default filter (#14024)
Make `127.0.0.1:<PORT>` -> ``[LOCALHOST]`` a general test filter, it
simplifies using wiremock and I'm not aware of any false positives.
2025-06-13 08:51:17 -05:00
Zanie Blue 881e17600f
Filter managed Python distributions by platform before querying when included in request (#13936)
In the case where we have platform information in a Python request, we
should filter managed Python distributions by it prior to querying them.

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

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-06-13 08:50:44 -05:00
konsti e10881d49c
Add tests for IO Error retries (#13627)
Often, HTTP requests don't fail due to server errors, but from spurious
network errors such as connection resets. reqwest surfaces these as
`io::Error`, and we have to handle their retrying separately.

Companion PR: https://github.com/LukeMathWalker/wiremock-rs/pull/159
2025-06-13 09:57:45 +00:00
Zanie Blue 62ed17b230
Bump version to 0.7.13 (#14002) 2025-06-12 14:33:31 -05:00
konsti 7316bd01a3
Build backend: Support namespace packages (#13833)
Unlike regular packages, specifying all `__init__.py` directories for a
namespace package would be very verbose There is e.g.
https://github.com/python-poetry/poetry/tree/main/src/poetry, which has
18 modules, or https://github.com/googleapis/api-common-protos which is
inconsistently nested. For both the Google Cloud SDK, there are both
packages with a single module and those with complex structures, with
many having multiple modules due to versioning through `<module>_v1`
versioning. The Azure SDK seems to use one module per package (it's not
explicitly documented but seems to follow from the process in
https://azure.github.io/azure-sdk/python_design.html#azure-sdk-distribution-packages
and
ccb0e03a3d/doc/dev/packaging.md).

For simplicity with complex projects, we add a `namespace = true` switch
which disabled checking for an `__init__.py`. We only check that there's
no `<module_root>/<module_name>/__init__.py` and otherwise add the whole
`<module_root>/<module_name>` folder. This comes at the cost of
`namespace = true` effectively creating an opt-out from our usual checks
that allows creating an almost entirely arbitrary package.

For simple projects with only a single module, the module name can be
dotted to point to the target module, so the build still gets checked:

```toml
[tool.uv.build-backend]
module-name = "poetry.core"
```

## Alternatives

### Declare all packages

We could make `module-name` a list and allow or require declaring all
packages:

```toml
[tool.uv.build-backend]
module-name = ["cloud_sdk.service.storage", "cloud_sdk.service.storage_v1", "cloud_sdk.billing.storage"]
```

Or for Poetry:

```toml
[tool.uv.build-backend]
module-name = [
    "poetry.config",
    "poetry.console",
    "poetry.inspection",
    "poetry.installation",
    "poetry.json",
    "poetry.layouts",
    "poetry.masonry",
    "poetry.mixology",
    "poetry.packages",
    "poetry.plugins",
    "poetry.publishing",
    "poetry.puzzle",
    "poetry.pyproject",
    "poetry.repositories",
    "poetry.toml",
    "poetry.utils",
    "poetry.vcs",
    "poetry.version"
]
```

### Support multiple namespaces

We could also allow namespace packages with multiple root level module:

```toml
[tool.uv.build-backend]
module-name = ["cloud_sdk.my_ext", "local_sdk.my_ext"]
```

For lack of use cases, we delegate this to creating a workspace with one
package per module.

## Implementation

Due to the more complex options for the module name, I'm moving
verification on deserialization later, dropping the source span we'd get
from serde. We also don't show similarly named directories anymore.

---------

Co-authored-by: Andrew Gallant <andrew@astral.sh>
2025-06-12 17:23:58 +00:00
github-actions[bot] d9c34259b3
Sync latest Python releases (#13996)
Automated update for Python releases.

---------

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-06-12 09:47:28 -05:00
Ahmed Ilyas a1f9f28762
Do not allow `uv add --group ... --script` (#13997)
## Summary

Closes #13988 

## Test Plan

`cargo test`
2025-06-12 10:45:12 -04:00
Zanie Blue 806cc5cad9
Debug `sync_dry_run` flake by panicking with verbose output on failure (#13817)
Investigating #13744 

I tried reproducing here by running the test in a loop, but could not. I
presume it's an interaction with other tests.

This drops the snapshot, but I think it's worth it to try to examine the
flake?
2025-06-12 08:05:25 -05:00
Zanie Blue 87ab57e902
Update the CLI help and reference to include references to the Python bin directory (#13978)
Closes https://github.com/astral-sh/uv/issues/13977
2025-06-12 10:02:51 +00:00
konsti b3d7f79770
Universal sync_required_environment_hint test (#13975)
Use the packse case `no-sdist-no-wheels-with-matching-platform` for a
platform independent `sync_required_environment_hint` test.

Fixes #13890
2025-06-11 22:47:40 -04:00
Charlie Marsh 81aebf921d
Add `zstd` and `deflate` to `Accept-Encoding` (#13982)
## Summary

We already pull in these dependencies, so it costs us nothing.
2025-06-11 22:42:47 -04:00
Zanie Blue f530565323
Use TTY detection to determine if SIGINT forwarding is enabled (#13925)
Use TTY detection to determine when we should forward SIGINT instead of
counting signals, which can lead to various problems where multiple
SIGINTs are sent to a child after the first signal. Counting does not
make sense in interactive situations that do not exit on interrupt,
e.g., the Python REPL.

Closes https://github.com/astral-sh/uv/issues/13919
Closes https://github.com/astral-sh/uv/issues/12108
2025-06-11 13:28:34 +00:00
github-actions[bot] 357fc91c3c
Sync latest Python releases (#13956)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-06-10 21:13:32 -05:00
Zanie Blue 4c877b7dc6
Fix generated file change (#13957)
Regressed in https://github.com/astral-sh/uv/pull/13620

ref failure at
https://github.com/astral-sh/uv/actions/runs/15570991822/job/43846587900?pr=13956
2025-06-10 22:03:01 +00:00
Zanie Blue 21986c3fc9
Bump timeout on Python download release fetch (#13955)
Failing with a 504 at
https://github.com/astral-sh/uv/actions/runs/15569590779

Successful at
https://github.com/astral-sh/uv/actions/runs/15570896150/job/43846260252
2025-06-10 16:54:42 -05:00
Zanie Blue f20a25f91f
Download versions in `uv python pin` if not found (#13946)
As another follow-up in the vein of
https://github.com/astral-sh/uv/pull/13944, I noticed `uv python pin`
doesn't download Python versions, which is a bit weird because we'll
warn it's not found.
2025-06-10 10:56:22 -05:00
Zanie Blue 1b82a3ac99
Ignore Python discovery errors during `uv python pin` (#13944)
See https://github.com/astral-sh/uv/issues/13935#issuecomment-2957300516
where we fail to write a pin file because we encounter an unusable
interpreter. This is actually a special case where `MissingPython` is
not raised because we want to show why we failed to find a usable
interpreter, which is useful in commands where you _need_ an interpreter
to use, but here we don't actually need it. Here, we just log the
failure and move on.

Related https://github.com/astral-sh/uv/pull/13936
2025-06-10 09:52:23 -05:00
konsti c54f131500
Add basic network error tests (#13585)
Add basic tests for error messages on retryable network errors.

This test mod is intended to grow to ensure that we handle retryable
errors correctly and that we show the appropriate error message if we
failed after retrying.

The starter tests show some common cases we've seen download errors in:
simple and find links indexes, file downloads and Python installs.

For `io::Error` fault injection to test the reqwest `Err` path besides
the HTTP status code `Ok` path, see
https://github.com/LukeMathWalker/wiremock-rs/issues/149.
2025-06-10 12:00:04 +02:00
Jack O'Connor 9129d2a9a3 avoid fetching an exact, cached commit, even if it isn't locked
Fixes #13513 and #12746.
2025-06-09 23:50:36 +00:00
Jack O'Connor 619132bd8a make GitOid strict about parsing exactly 40 hex characters 2025-06-09 23:50:36 +00:00
Jack O'Connor 9ff07c113f add a snapshot test for `uv pip install` with an exact Git commit 2025-06-09 23:50:36 +00:00
Jack O'Connor dc455bfc26 add UV_NO_GITHUB_FAST_PATH 2025-06-09 23:50:36 +00:00
John Mumm 2a66349e96
Check if relative URL is valid directory before treating as index (#13917)
As per #13874, passing a relative URL like `test` to `--index` for `uv
add` causes unexpected behavior if the directory does not exist. The
non-existent index is effectively ignored and uv falls back to PyPI. If
a package is found there, the spurious index is then written to
`pyproject.toml`. This doesn't happen for `--default-index` since
resolution will fail without fallback to PyPI.

This PR adds a validation step for indexes provided on the command line.
If a directory does not exist, uv will fail with an error.

Closes #13874
2025-06-09 19:28:39 +02:00
Zanie Blue 619a0eafa1
Fix use of deprecated `black_box` function (#13926) 2025-06-09 16:57:27 +00:00
Zanie Blue dc3fd46472
Bump version to 0.7.12 (#13892) 2025-06-06 19:42:06 +00:00
konsti 5b0133c0ec
Hint at `tool.uv.required-environments` (#13575)
For the case where there was no matching wheel on sync, we previously
added a note about which wheels are available vs. on which platform you
are on. We extend this error message to link directly towards
`tool.uv.required-environments`, which otherwise has a discovery
problem.

On Linux (Setting `tool.uv.required-environments` doesn't help here
either, but it's a clear example):

```
[project]
name = "debug"
version = "0.1.0"
requires-python = "==3.10.*"
dependencies = ["tensorflow-macos>=2.13.1"]
```

```
Resolved 41 packages in 24ms
error: Distribution `tensorflow-macos==2.16.2 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform

hint: You're on Linux (`manylinux_2_39_x86_64`), but there are no wheels for the current platform, consider configuring `tool.uv.required-environments`.
hint: `tensorflow-macos` (v2.16.2) only has wheels for the following platform: `macosx_12_0_arm64`.
```


![image](https://github.com/user-attachments/assets/b6b49461-10d6-4e1d-bc0a-5d35d98e33d0)

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-06-06 19:15:52 +00:00
konsti 7aefbe8dc5
Don't hint at versions removed by excluded-newer (#13884)
General small hint false positives that shows up as CI failure in our
snapshots.

Fixes #13867
2025-06-06 18:35:18 +00:00
konsti 0109af1aa5
Hint at `tool.uv.environments` on resolution error (#13455)
Users are not (yet) properly familiar with the concept of universal
resolution and its implication that we need to resolve for all possible
platforms and Python versions. Some projects only target a specific
platform or Python version, and users experience resolution errors due
to failures for other platforms. Indicated by the number of questions we
get about it, `tool.uv.environments` for restricting environments is not
well discoverable.

We add a special hint when resolution failed on a fork disjoint with the
current environment, hinting the user to constrain `requires-python` and
`tool.uv.environments` respectively.

The hint has false positives for cases where the resolution failed on a
different platform, but equally fails on the current platform, in cases
where the non-current fork was tried earlier. Given that conflicts can
be based on `requires-python`, afaik we can't parse whether the current
platform would also be affected from the derivation tree.

Two cases not covered by this are build errors as well as install errors
that need `tool.uv.required-environments`.
2025-06-06 14:17:52 +00:00
Yury Fedotov 8a88ab2c70
Minor internal README enhancement for Markdown list in PEP440 (#13880)
- Define all list elements using `-`: it used to be a mix of `*` and
`-`. `-` is what Prettier linter formats it to by default.
- Removed unnecessary blank line between 2 list elements. Other elements
were stitched together without blank lines in between.
- Only the first list element started in sentence case (capital letter
first) - I made all start like so.
2025-06-06 08:45:37 -05:00
konsti bf96c60e3e
Lock during `uv sync`, `uv add` and `uv remove` to avoid race conditions (#13869)
Surprisingly, we weren't locking during `uv sync` so far, so running `uv
sync` in parallel could cause errors in filesystem races.

I've also added locks to `uv add` and `uv remove` which concurrently
modify `pyproject.toml`. These locks only apply after we determined the
interpreter, so they don't actually prevent computing the same thing
twice when running `uv add` in parallel.

All other subcommands that I checked were already locking (with no claim
to exhaustiveness)

Fixes #12751

# Test Plan

I don't have CI-sized reproducer for this.

```toml
[project]
name = "debug"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
  "boto3>=1.38.30",
  "fastapi>=0.115.12",
  "numba>=0.61.2",
  "polars>=1.30.0",
  "protobuf>=6.31.1",
  "pyarrow>=20.0.0",
  "pydantic>=2.11.5",
  "requests>=2.32.3",
  "urllib3>=2.4.0",
  "scikit-learn>=1.6.1",
  "jupyter>=1.1.1",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```

```
rm -rf .venv && parallel -n0 "uv sync -q" ::: {1..10}
```
2025-06-06 14:16:40 +02:00
Micha Reiser b865f76b78
Change `GlobDirFilter` fallback to `true` (#13882)
## Summary

I think `GlobDirFilter::match_directory` should return `true` if it
failed to construct a DFA
to force a full directory traversal. Returning `false` means that the
build backend excludes all files which
is unlikely what we want in that situation.
2025-06-06 14:07:34 +02:00
samypr100 a68fb53c4b
PEP 751 uv export supports --no-editable (#13852)
## Summary

When trying out `uv export --no-editable --format pylock.toml` the
exported contents would still retain `editable = true` regardless.

## Test Plan

Added additional test. Tested locally on few projects where I was
previously using `uv export --no-editable --format requirements.txt` to
ensure the output aligns.
2025-06-06 07:52:14 -04:00
Zanie Blue 7dd564d3d0
Improve `python pin` error messages (#13862)
Addresses https://github.com/astral-sh/uv/issues/13854
2025-06-05 21:48:34 +00:00
Zanie Blue b1a50c33cf
Fix `lock_requires_python` test case (#13866)
Tracking https://github.com/astral-sh/uv/issues/13867
2025-06-05 17:27:52 +00:00
Zanie Blue 262ca73965
Remove the configuration section in favor of concepts / reference (#13842)
Extends https://github.com/astral-sh/uv/pull/13841 — I'll drop that
commit later after that pull request merges but it's small.

I find the split into a "Configuration" section awkward and don't think
it's helping us. Everything moved into the "Concepts" section, except
the "Environment variables" page which definitely belongs in the
reference and the "Installer" page which is fairly niche and seems
better in the reference.

Before / After


<img
src="https://github.com/user-attachments/assets/80d8304b-17da-4900-a5f4-c3ccac96fcc5"
width="400">
2025-06-05 17:09:49 +00:00
Zanie Blue 062b6ab743
Add `uv python pin --rm` to remove `.python-version` pins (#13860)
I realized it is non-trivial to delete the global Python version pin,
and that we were missing this simple functionality
2025-06-05 12:05:42 -05:00
github-actions[bot] cd89a592ea
Update tag for Python sysconfig metadata (#13851)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-06-05 11:21:35 -05:00
Michał Górny 3a29bb0986
Switch `sync_dry_run` test to Python 3.9 (#13858)
## Summary

Switch the `sync_dry_run` test to use Python 3.9 instead of Python 3.8.
I didn't previously catch it since it was marked as `python_managed`.

## Test Plan

`cargo test --no-default-features --features git,pypi,python` without
Python 3.8 installed.
2025-06-05 08:15:00 -05:00
Michał Górny 042e8a448b
Make `requirements_txt_ssh_git_username` not write into homedir (#13857)
## Summary

Modify `requirements_txt_ssh_git_username` test to pass `-o
UserKnownHostsFile=/dev/null` to OpenSSH, in order to prevent it from
trying to write into the known-hosts in user's home directory. To add
insult to the injury, OpenSSH ignores `HOME` and writes into the actual
home when it is explicitly overridden for the purpose of testing.

## Test Plan

`cargo test --no-default-features --features=git,pypi,python` in an
environment where the user can't write to `pw_home` (but can to
`${HOME}`). Previously the test would fail:

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: requirements_txt_ssh_git_username
Source: crates/uv/tests/it/export.rs:1252
────────────────────────────────────────────────────────────────────────────────
Expression: snapshot
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
    7     7 │   ├─▶ failed to clone into: [PATH]
    8     8 │   ├─▶ failed to fetch branch, tag, or commit `d780faf0ac91257d4d5a4f0c5a0e4509608c0071`
    9     9 │   ╰─▶ process didn't exit successfully: [GIT_COMMAND_ERROR]
   10    10 │       --- stderr
         11 │+      Could not create directory '/var/lib/portage/home/.ssh' (Permission denied).
         12 │+      Failed to add the host to the list of known hosts (/var/lib/portage/home/.ssh/known_hosts).
   11    13 │       Load key "[TEMP_DIR]/fake_deploy_key": [ERROR]
   12    14 │       git@github.com: Permission denied (publickey).
   13    15 │       fatal: Could not read from remote repository.
   14    16 │ 
────────────┴───────────────────────────────────────────────────────────────────
```

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-06-05 10:35:21 +00:00
Jack O'Connor 90a4416ab8
Bump version to 0.7.11 (#13844) 2025-06-04 12:35:56 -07:00
github-actions[bot] 8e8b7449dc
Sync latest Python releases (#13848)
https://github.com/astral-sh/python-build-standalone/releases/tag/20250604

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-06-04 19:07:04 +00:00
Aria Desires d8636a4088
Prefer the binary's version when checking if it's up to date (#13840)
Fixes #13741
2025-06-04 11:32:59 -04:00
konsti a748336a09
Follow-up #13814, git+ssh test case (#13839)
Follow-ups to review on #13814
2025-06-04 15:02:26 +00:00
konsti e7c066cf16
Test case: Don't redact username `git` for SSH (#13814) 2025-06-04 09:57:24 +02:00
Zanie Blue 3ca8d074a4
Use "terminal driver" instead of "shell" in SIGINT docs (#13787)
Addressing the comment at
https://github.com/astral-sh/uv/issues/12108#issuecomment-2925703719
2025-06-03 22:07:03 +00:00
Jacob Woliver f5c3601445
Better error message for version specifier with missing operator (#13803)
## Summary

When missing an operator for version parsing, it would give an error
that was hard to know how to fix if you were not familiar with version
specifiers / PEP-440:

```
Unexpected end of version specifier, expected operator
```

Now, it will attempt to provide a more useful hint if it can parse the
version from the remaining scanner:

```
Unexpected end of version specifier, expected operator (did you mean "==3.12"?)
```
## Test Plan

Unit tests in `version_specifier.rs` were added/updated for the
following cases:
- `test_parse_specifier_missing_operator_error`
- `test_parse_specifier_missing_operator_invalid_version_error`
- `test_invalid_word`
- `test_invalid_specifier`
- `error_message_version_specifiers_parse_error`

A test in `edit.rs` for failing to parse the `pyproject.toml` when using
`add` was also included to match the request in the original issue:
- `add_invalid_requires_python`

I didn't add cases where no version specifier is provided because it
seemed like it doesn't get to the point of parsing in that case, so it
should not happen.


## Reference

Fixes #13126

---------

Co-authored-by: Jacob Woliver <jacob@jmw.sh>
Co-authored-by: konstin <konstin@mailbox.org>
2025-06-03 19:18:19 +00:00
Hood Chatham f9d3f24728
Add Pyodide support (#12731)
This includes some initial work on adding Pyodide support (issue
#12729). It is enough to get
```
uv pip compile -p /path/to/pyodide --extra-index-url file:/path/to/simple-index
```
to work which should already be quite useful.

## Test Plan

* added a unit test for `pyodide_platform`
* integration tested manually with:
```
cargo run pip install \
-p /home/rchatham/Documents/programming/tmp/pyodide-venv-test/.pyodide-xbuildenv-0.29.3/0.27.4/xbuildenv/pyodide-root/dist/python \
--extra-index-url file:/home/rchatham/Documents/programming/tmp/pyodide-venv-test/.pyodide-xbuildenv-0.29.3/0.27.4/xbuildenv/pyodide-root/package_index \
--index-strategy unsafe-best-match --target blah --no-build \
numpy pydantic
```

---------

Co-authored-by: konsti <konstin@mailbox.org>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-06-03 12:01:26 -05:00
Zanie Blue 37e22e4da6
Remove `python-managed` marker from `sync_dry_run` test (#13816)
Not sure why this is present, it does not seem to use a managed
interpreter
2025-06-03 11:08:09 -05:00
Zanie Blue 1e5120e15c
Bump version to 0.7.10 (#13821) 2025-06-03 11:07:21 -05:00
John Mumm 90aefe4a4a
Display ssh git username in `Debug` implementation (#13806)
This updates the `Debug` implementation of `DisplaySafeUrl` to display
the git username in a case like `git+ssh://git@github.com/org/repo`. It
also factors out the git username check into a shared function and adds
related unit tests to `DisplaySafeUrl`.
2025-06-03 14:52:51 +00:00
Zanie Blue a96e766b55
Retain credentials for direct URLs in `uv export` (#13809)
Reverts unintended breaking change from #13560 

Test case from https://github.com/astral-sh/uv/pull/13808
2025-06-03 14:23:07 +00:00
konsti 63ba5e9f9e
Add data locations to logging (#13797)
`trace!`-log the locations of data directories used by a wheel. These
paths are queried from sysconfig, i.e. they are mostly Python
interpreter defined instead of being computed by uv.
2025-06-03 09:22:18 -05:00
konsti eb9ad6c8c0
Don't redact username `git` for SSH (#13799)
Fixes #13795 specifically by not redacting the username convention `git`
for SSH URLs, though we should never write stars in `uv export`
generally (#13791).
2025-06-03 09:18:18 -05:00
Zanie Blue 99a4b78af2
Add comment to `lock_redact_url_sources` indicating that we do not redact the credentials (#13813)
This was previously present, but got removed at some point.


https://github.com/astral-sh/uv/pull/8307/files#diff-82edd36151736f44055f699a34c8b19a63ffc4cf3c86bf5fb34d69f8ac88a957R6544
2025-06-03 14:15:46 +00:00
Zanie Blue c8448815ef
Add `uv export` test cases for PEP 751 format with credentials (#13810)
Same as the following, but for `pylock.toml` instead of
`requirements.txt`

- #13808
- #13792
2025-06-03 09:11:53 -05:00
Zanie Blue 4cdac77fe9
Add test case for HTTPS credentials on direct URL in `uv export` (#13808)
Related to 

- #13799 
- #13792
2025-06-03 14:11:13 +00:00
Zanie Blue 98c708149a
Add `uv export` test case with credentials in `pyproject.toml` (#13792)
Testing reported case in https://github.com/astral-sh/uv/issues/13791

I cherry-picked this commit onto 0.7.0, and saw no change.
2025-06-03 07:47:05 -05:00
samypr100 d65c146b21
feat: add dynamically generated sysconfig replacement mappings (#13441)
## Summary

Implementation referenced in
https://github.com/astral-sh/uv/pull/12239#issuecomment-2744880003

Closes #12919 #12901

This makes the sysconfig replacements mappings dynamically generated
from
https://github.com/astral-sh/python-build-standalone/blob/main/cpython-unix/targets.yml

## Test Plan

cargo dev tests, and tested scenario from
https://github.com/astral-sh/uv/issues/12901#issuecomment-2822107454
2025-06-02 10:58:30 -05:00
konsti 73eb2dfb1f
Remove winsafe (#13779)
We've been using a number of different winapi crates. This PR removes
winsafe in favor of the official windows-* crates, so all of uv's own
winapi calls go through the official windows-* crates.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-06-02 17:53:03 +02:00
Tobias Gårdhus 459c902425
add `--show-extras` to `uv tool list` to list extra requirements installed with tools (#13783)
## Summary

Implemented as suggested in #13761 

eg.

```
$ uv tool install 'harlequin[postgres]'
$ uv tool list --show-extras
harlequin v2.1.2 [extras: postgres]
- harlequin
```

## Test Plan

Added a new test with the argument along with the others from the `uv
tool list` cli.
2025-06-02 14:59:40 +00:00
Michał Górny b5e7ad2c6d
Update `lock::lock_requires_python` not to require Python 3.8 (#13780)
## Summary

Update `lock::lock_requires_python` not to require Python 3.8.

Fixes #13676

## Test Plan

`cargo test --no-default-features --features git,pypi,python` after
removing Python 3.8.
2025-06-02 09:10:51 +00:00
Ben Beasley 73829f3bf4
Conditionalize more tests that require PyPI (#13699)
<!--
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? -->
Use the existing `pypi` feature to conditionalize a number of tests that
attempt to access https://pypi.org and/or
https://files.pythonhosted.org. See
https://github.com/astral-sh/uv/issues/8970#issuecomment-2466794088.

There is no reason to believe that these are *all* of the tests that
need to be conditionalized on the `pypi` feature, but this should be a
solid step in the right direction.

## Test Plan

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

This allows me to build and run the integration tests in [Fedora’s `uv`
package](https://src.fedoraproject.org/rpms/uv) without having to
manually skip tests that try to access PyPI. I confirmed that this
appears to accomplish that goal.

Otherwise, this should be tested by building and running the tests as
usual. As mentioned in
https://github.com/astral-sh/uv/issues/8970#issuecomment-2516181501, a
more complete solution would include CI tests that confirm these
features are working as intended. I’m not in a position to offer that.
2025-06-02 09:57:03 +02:00
renovate[bot] b112baccff
Update Rust crate tempfile to v3.20.0 (#13776)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tempfile](https://stebalien.com/projects/tempfile-rs/)
([source](https://redirect.github.com/Stebalien/tempfile)) |
workspace.dependencies | minor | `3.19.1` -> `3.20.0` |

---

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

---

### Release Notes

<details>
<summary>Stebalien/tempfile (tempfile)</summary>

###
[`v3.20.0`](https://redirect.github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md#3200)

[Compare
Source](https://redirect.github.com/Stebalien/tempfile/compare/v3.19.1...v3.20.0)

This release mostly unifies the behavior/capabilities around "keeping"
temporary files:

- Rename `Builder::keep(bool)` (via deprecation) to
`Builder::disable_cleanup(bool)` to make it clear that behaves
differently from `NamedTempFile::keep()`. The former disables automatic
cleanup while the latter *consumes* the `NamedTempFile` object entirely
and unsets the "temporary file" attribute (on Windows).
- Rename `TempDir::into_path` (via deprecation) to `TempDir::keep` to
mirror `NamedTempFile::keep`.
- Add `TempDir::disable_cleanup`, `NamedTempFile::disable_cleanup`, and
`TempPath::disable_cleanup` making it possible to disable automatic
cleanup in-place *after* creating a temporary file/directory (equivalent
to calling `Builder::disable_cleanup` before creating the
file/directory).

Additionally, it adds a few spooled temporary file features:

- Add `SpooledTempFile::into_file` for turning a `SpooledTempFile` into
a regular unnamed temporary file, writing it to the backing storage
("rolling" it) if it was still stored in-memory.
- Add `spooled_tempfile_in` and `SpooledTempFile::new_in` methods for
creating spooled temporary files in a specific directory. This makes it
possible to choose the backing device for your spooled temporary file
which is rather important on Linux where the default temporary directory
is likely backed by memory (defeating the entire point of having a
spooled temporary file).

Finally, this release improves documentation, especially the top-level
documentation explaining which temporary file type to use.

**BREAKING** for those with `deny(warnings)`:

-   `Builder::keep` deprecated in favor of `Builder::disable_cleanup`.
-   `TempDir::into_path` is deprecated in favor of `TempDir::keep`.

**BREAKING**:

</details>

---

### 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:eyJjcmVhdGVkSW5WZXIiOiI0MC4zMy42IiwidXBkYXRlZEluVmVyIjoiNDAuMzMuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-06-02 07:47:08 +00:00
Michał Górny 59efe06aaf
Update more tests not to use Python 3.8 (#13755)
## Summary

Update a few more tests to avoid using Python 3.8 unnecessarily. From
what I can see, neither of these really need that specific Python
version, so just update them to use 3.9 instead.

Bug #13676

## Test Plan

Uninstall Python 3.8 and run: `cargo test --no-default-features
--features git,pypi,python`

One test failure remains.
2025-06-02 09:22:35 +02:00
renovate[bot] e0821176a4
Update Rust crate criterion to 0.6.0 (#13771) 2025-06-01 21:57:25 -04:00
Zanie Blue 691a4f1379
Propagate credentials to files on devpi indexes ending in `/+simple` (#13743)
Closes https://github.com/astral-sh/uv/issues/13737

Not much to say here — devpi is common enough that we should support
their weird `/+simple` URL format.
2025-06-01 20:20:56 -04:00
Zanie Blue 13a86a23b3
Bump version to 0.7.9 (#13739) 2025-05-30 14:30:37 -05:00
konsti 483b4c82e8
Don't fail direct URL hash checking with dependency metadata (#13736)
Fixes #12512
2025-05-30 19:39:40 +02:00
Aria Desires 891fe524d9
update python build standalone, unblocklist linux updates (#13732) 2025-05-30 12:33:21 -04:00
Jack O'Connor 7310ea75da
allow running non-default Python interpreters directly via uvx (#13583)
Previously if you wanted to run e.g. PyPy via `uvx`, you had to spell it
like `uvx -p pypy python`. Now we reuse some of the
`PythonRequest::parse` machinery to handle the executable, so all of the
following examples work:

- `uvx python3.8`
- `uvx 'python>3.7,<3.9'`
- `uvx --from python3.8 python` (or e.g. `bash`)
- `uvx pypy38`
- `uvx graalpy@38`

The `python` (and on Windows only, `pythonw`) special cases are
retained, which normally aren't allowed values of `-p`/`--python`.

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

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
Co-authored-by: konsti <konstin@mailbox.org>
2025-05-30 09:12:39 -07:00
Zanie Blue 4cc5291c08
Allow discovery of x86-64 managed Python builds on macOS (#13722)
Replacement for https://github.com/astral-sh/uv/pull/13474 (clobbered by
a changed base)

Once these are explicitly installed, they should be discoverable and
usable. Currently, they are not.
2025-05-29 17:55:21 -05:00
Zanie Blue 0c5ae1f25c
Differentiate between implicit vs explicit architecture requests (#13723)
In https://github.com/astral-sh/uv/pull/13721#issuecomment-2920530601 I
presumed that all the installation problems in
https://github.com/astral-sh/uv/pull/13722 were solved by
https://github.com/astral-sh/uv/pull/13709 but they were not because we
don't differentiate between implicit and explicit architecture requests
so a request for `aarch64` is considered satisfied by an existing
`x86-64` installation even if the user explicitly requested that
architecture.

Now, we track if it was explicit or implicit, requiring an exact match
in the former case, and a `supports` in the latter.

We considered doing this for other items in the request, like the
operating system but we don't have a `supports()` concept there. It
might make sense for libc in the future.
2025-05-29 22:04:57 +00:00
Aria Desires 067b03cc9a
Only show the first match per platform (and architecture) by default in `uv python list` (#13721)
This is an alternative to #13701
2025-05-29 17:38:44 -04:00
Zanie Blue dfc85336f8
Implement ordering for Python architectures to prefer native installations (#13709)
Resolves
https://github.com/astral-sh/uv/pull/13474#discussion_r2112586405

This kind of dynamic ordering freaks me out a little, but I think it's
probably the best solution and is static at compile-time.

Currently, we're just sorting by the stringified representation! which
is just convenient for reproducibility, but we rely on these orderings
for prioritization in discovery.
2025-05-29 19:06:33 +00:00
Jack O'Connor 08f2fa48ff
make the error message clearer when running distroless containers (#13549)
Previously you could get a confusing error message like this:

```
$ docker run ghcr.io/astral-sh/uv run python
error: Could not read ELF interpreter from any of the following paths: /bin/sh, /usr/bin/env, /bin/dash, /bin/ls
```

Now the error message is better:

```
error: Failed to discover managed Python installations
  Caused by: Failed to determine the libc used on the current platform
  Caused by: Failed to find any common binaries to determine libc from: /bin/sh, /usr/bin/env, /bin/dash, /bin/ls
```

See https://github.com/astral-sh/uv/issues/8635.

---------

Co-authored-by: konsti <konstin@mailbox.org>
Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-05-29 10:29:01 -07:00
johnthagen 72e2821d26
Fix `exclude-newer` date format in docs (#13706)
## Summary

Closes #13704
2025-05-28 20:23:10 +00:00
Reci e5d002beb1
Add `uvw` as alias for `uv` without console window on Windows (#11786)
<!--
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

Related to https://github.com/astral-sh/uv/issues/6801.

Currently on Windows, uv itself will always creates a console window,
even though the window could be empty if `uv run --gui-script` is used.
This is due to it using the [default `console` window
subsystem](https://rust-lang.github.io/rfcs/1665-windows-subsystem.html).

This PR introduces a wrapper `uvw` that, similar to the existing `uvx`,
invokes `uv` with the
[`CREATE_NO_WINDOW`](https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags#:~:text=CREATE_NO_WINDOW)
process creation flag on Windows, which creates child process without
console window.

Note that this PR does not alter any behaviors regarding `run --script`
and `run --gui-script`.

## Test Plan

Built and tested locally by doing something like `uvw run test.py`.
2025-05-28 14:37:21 -04:00
konsti f62836fa04
Windows paths are valid URLs (#13625)
Currently, it is not possible to set a custom Python downloads JSON on
Windows, as Windows paths can be valid URLs.

```rust
use url::Url;

fn main() {
    dbg!(Url::parse(r"C:\Users\Ferris\download.json"));
}
```

Tested by https://github.com/astral-sh/uv/pull/13585 (where it is
currently failing CI).
2025-05-28 10:11:56 -05:00
Zanie Blue 56ce40b0f4
Update packse scenarios (#13688)
Closes #13676 

See https://github.com/astral-sh/packse/pull/242 and
https://github.com/astral-sh/packse/releases/tag/0.3.47
2025-05-28 08:58:38 -05:00
konsti 56203484a2
Add `uv add --bounds` to configure the version constraint (#12946)
By default, uv uses only a lower bound in `uv add`, which avoids
dependency conflicts due to upper bounds. With this PR, this cna be
changed by setting a different bound kind. The bound kind can be
configured in `uv.toml`, as a user preference, in `pyproject.toml`, as a
project preference, or on the CLI, when adding a specific project.

We add two options that add an upper bound on the constraint, one for
SemVer (`>=1.2.3,<2.0.0`, dubbed "major", modeled after the SemVer
caret) and another one for dependencies that make breaking changes in
minor version (`>=1.2.3,<1.3.0`, dubbed "minor", modeled after the
SemVer tilde). Intuitively, the major option bumps the most significant
version component, while the minor option bumps the second most
significant version component. There is also an exact bounds option
(`==1.2.3`), though generally we recommend setting a wider bound and
using the lockfile for pinning.

Versions can have leading zeroes, such as `0.1` or `0.0.1`. For a single
leading 0, we shift the the meaning of major and minor similar to cargo.
For two or more leading zeroes, the difference between major and minor
becomes inapplicable, instead both bump the most significant component:
- major: `0.1` -> `>=0.1,<0.2`
- major: `0.0.1` -> `>=0.0.1,<0.0.2`
- major: `0.0.1.1` -> `>=0.0.1.1,<0.0.2.0`
- major: `0.0.0.1` -> `>=0.0.0.1,<0.0.0.2`
- minor: `0.1` -> `>=0.1,<0.1.1`
- minor: `0.0.1` -> `>=0.0.1,<0.0.2`
- minor: `0.0.1.1` -> `>=0.0.1.1,<0.0.2.0`
- minor: `0.0.0.1` -> `>=0.0.0.1,<0.0.0.2`

For a consistent appearance, we try to preserve the number of components
in the upper bound. For example, adding a version `2.17` with the major
option is stored as `>=2.17,<3.0`. If a version uses three components
and is greater than 0, both bounds will also use three components
(SemVer versions always have three components). Of the top 100 PyPI
packages, 8 use a non-three-component version (docutils, idna, pycparser
and soupsieve with two components, packaging, pytz and tzdata with two
component, CalVer and trove-classifiers with four component CalVer).
Example `pyproject.toml` files with the top 100 packages: [`--bounds
major`](https://gist.github.com/konstin/0aaffa9ea53c4834c22759e8865409f4)
and [`--bounds
minor`](https://gist.github.com/konstin/e77f5e990a7efe8a3c8a97c5c5b76964).
While many projects follow version scheme that roughly or directly
matches the major or minor options, these compatibility ranges are
usually not applicable for the also popular CalVer versioning.

For pre-release versions, there are two framings we could take: One is
that pre-releases generally make no guarantees about compatibility
between them and are used to introduce breaking changes, so we should
pin them exactly. In many cases however, pre-release specifiers are used
because a project needs a bugfix or a feature that hasn't made it into a
stable release, or because a project is compatible with the next version
before a final version for that release is published. In those cases,
compatibility with other packages that depend on the same library is
more important, so the desired bound is the same as it would be for the
stable release, except with the lower bound lowered to include
pre-release.

The names of the bounds and the name of the flag is up for bikeshedding.
Currently, the option is call `tool.uv.bounds`, but we could also move
it under `tool.uv.edit.bounds`, where it would be the first/only entry.

Fixes #6783

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-05-28 13:11:31 +00:00
Charles Tapley Hoyt 3ee8028bb4
Improve performance of uv-python crate's manylinux submodule (#11131)
## Summary

This PR makes a few performance improvements:

1. Reduces the need to unpack and repack a `_GLibCVersion` tuple
2. Reduces the doubled call to `_is_compatible(arch, glibc_version)`
3. Moves the assignment of the `tag` variable directly into the yield,
reducing memory allocation in case this is never used when
`_is_compatible(arch, glibc_version)` is false
4. Combines the check of the `glibc_version` being in
`_LEGACY_MANYLINUX_MAP` and the assignment to the variable together. I'm
not sure if this is actually better, but using the assignment expression
reduces this from 4 lines to 2

## Test Plan

I upstreamed these changes in
https://github.com/pypa/packaging/pull/869. Otherwise, I'm pretty
confident this is a minor change that works the same
2025-05-28 15:09:20 +02:00
konsti de64f1dfa8
Use ref-cast for `DisplaySafeUrl` (#13696)
By default, Rust does not support safe cast from `&U` to `&T` for
`#[repr(transparent)] T(U)` even if the newtype opts in. The dtolnay
ref-cast crate fills this gap, allowing to remove `DisplaySafeUrlRef`.
2025-05-28 11:28:28 +00:00
John Mumm 410dc33574
Make `DisplaySafeUrlRef` Copy and other minor PR follow-ups (#13683)
This PR implements a few review follow-ups from #13560. In particular,
it
* Makes `DisplaySafeUrlRef` implement `Copy` so that it can be passed by
value.
* Updates `to_string_with_credentials` methods with
`displayable_with_credentials`, returning an `impl Display` instead of
`String` for greater flexibility.
* Updates the `DisplaySafeUrl` and `DisplaySafeUrlRef` `Debug`
implementations to match the underlying `Url` `Debug` implementation
(with the exception that credentials are masked).
* Replaces an unnecessary `DisplaySafeUrl::from(Url::from_file_path`
with `DisplaySafeUrl::from_file_path`
2025-05-28 06:36:18 -04:00
Zanie Blue 32b949c3a8
Avoid using 3.8 in tests when feasible (#13680)
See https://github.com/astral-sh/uv/issues/13676

Python 3.8 is EOL, and we should avoid using it for tests unless we're
covering 3.8-specific behaviors.

In some cases, the Python version we require for the test is arbitrary,
for which I've added a new constant (set to 3.12). In other cases, we
require an older Python version for compatibility with various packages,
like `setuptools`. For those, we can _probably_ switch to a newer
version but it'd be more invasive as we'd need to change our constraints
or `exclude-newer`.

Adds a feature flag for cases where we still need to use the EOL
version.

There's a lot of usage in packse scenarios too, I'll update those
separately because the diff will be large.
2025-05-27 18:34:49 +00:00
Michael Gathara 7e39a80b18
Include pre-release versions in `uv python install --reinstall` (#13645)
<!--
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 change allows for `uv python install --reinstall` to include
pre-releases when reinstalling. It does this by explicitly allowing
pre-releases to be included within `PythonRequest::Any` if the user does
not specify a version to reinstall.

Fixes #13582

## Test Plan

<!-- How was it tested? -->
```bash
uv python install 3.14 3.13 3.10
uv python install --no-config --reinstall
```
2025-05-27 09:35:48 -05:00
Alex Waygood 7bba3d00d4
Write the path of the parent environment to an `extends-environment` key in the `pyvenv.cfg` file of an ephemeral environment (#13598) 2025-05-27 13:46:28 +01:00
Charlie Marsh 9a1d977e7e
Avoid reinstalling dependency group members with `--all-packages` (#13678)
## Summary

Right now, if a workspace member is first created by way of being a dev
dependency on another member, we end up duplicating it in the graph.
Instead, we should create all the roots upfront; all subsequent node
creations are robust to existing nodes.

Closes
https://github.com/astral-sh/uv/issues/13673#issuecomment-2912196406.
2025-05-27 08:43:07 -04:00
Dennis Dang 33d8f69076
Exit early on `self update` if global `--offline` is set (#13663)
## Summary
Resolves https://github.com/astral-sh/uv/issues/13580.

`uv self update --offline` should fail and exit early because
self-updating requires network connection.

## Test Plan
A snapshot test is added.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
Co-authored-by: konsti <konstin@mailbox.org>
2025-05-27 03:29:58 +00:00
Charlie Marsh 71c0e6de50
Reduce number of reference-checks for `uv cache clean` (#13669)
## Summary

This should reduce the number of filesystem operations fairly
dramatically:

- Only query actual symlinks.
- Don't recurse into package bodies (huge).
- Only traverse once (rather than twice).

Closes https://github.com/astral-sh/uv/issues/13667.
2025-05-26 21:43:24 -04:00
John Mumm c19a294a48
Add `DisplaySafeUrl` newtype to prevent leaking of credentials by default (#13560)
Prior to this PR, there were numerous places where uv would leak
credentials in logs. We had a way to mask credentials by calling methods
or a recently-added `redact_url` function, but this was not secure by
default. There were a number of other types (like `GitUrl`) that would
leak credentials on display.

This PR adds a `DisplaySafeUrl` newtype to prevent leaking credentials
when logging by default. It takes a maximalist approach, replacing the
use of `Url` almost everywhere. This includes when first parsing config
files, when storing URLs in types like `GitUrl`, and also when storing
URLs in types that in practice will never contain credentials (like
`DirectorySourceUrl`). The idea is to make it easy for developers to do
the right thing and for the compiler to support this (and to minimize
ever having to manually convert back and forth). Displaying credentials
now requires an active step. Note that despite this maximalist approach,
the use of the newtype should be zero cost.

One conspicuous place this PR does not use `DisplaySafeUrl` is in the
`uv-auth` crate. That would require new clones since there are calls to
`request.url()` that return a `&Url`. One option would have been to make
`DisplaySafeUrl` wrap a `Cow`, but this would lead to lifetime
annotations all over the codebase. I've created a separate PR based on
this one (#13576) that updates `uv-auth` to use `DisplaySafeUrl` with
one new clone. We can discuss the tradeoffs there.

Most of this PR just replaces `Url` with `DisplaySafeUrl`. The core is
`uv_redacted/lib.rs`, where the newtype is implemented. To make it
easier to review the rest, here are some points of note:

* `DisplaySafeUrl` has a `Display` implementation that masks
credentials. Currently, it will still display the username when there is
both a username and password. If we think is the wrong choice, it can
now be changed in one place.
* `DisplaySafeUrl` has a `remove_credentials()` method and also a
`.to_string_with_credentials()` method. This allows us to use it in a
variety of scenarios.
* `IndexUrl::redacted()` was renamed to
`IndexUrl::removed_credentials()` to make it clearer that we are not
masking.
* We convert from a `DisplaySafeUrl` to a `Url` when calling `reqwest`
methods like `.get()` and `.head()`.
* We convert from a `DisplaySafeUrl` to a `Url` when creating a
`uv_auth::Index`. That is because, as mentioned above, I will be
updating the `uv_auth` crate to use this newtype in a separate PR.
* A number of tests (e.g., in `pip_install.rs`) that formerly used
filters to mask tokens in the test output no longer need those filters
since tokens in URLs are now masked automatically.
* The one place we are still knowingly writing credentials to
`pyproject.toml` is when a URL with credentials is passed to `uv add`
with `--raw`. Since displaying credentials is no longer automatic, I
have added a `to_string_with_credentials()` method to the `Pep508Url`
trait. This is used when `--raw` is passed. Adding it to that trait is a
bit weird, but it's the simplest way to achieve the goal. I'm open to
suggestions on how to improve this, but note that because of the way
we're using generic bounds, it's not as simple as just creating a
separate trait for that method.
2025-05-27 00:05:30 +02:00
Aria Desires cd8171d2a1
Unwire PackageMetadata fields (#13635)
PackageMetadata, for whatever reason, does not have a mirrored Wire type
so it was easy to not realize that it contains markers that need to be
complexified.

Fixes #13614

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-05-26 14:17:19 -04:00
konsti 6ab1d12480
Avoid rendering info log level (#13642)
We were previously rendering messages for the info level, carrying
overhead in pubgrub which using `log::info!`. We avoid this by only
configuring `LevelFilter::INFO` if the durations layer exists.

I've confirmed that the default `Subscriber::max_level_hint` goes from
`INFO` to `OFF` and the profile skips `Incompatibility::display`.
2025-05-26 15:17:15 +02:00
konsti a6f8fa7e42
Optimize Version display (#13643)
We format enough versions that the `.collect::<Vec<String>>()` showed up
in profiles.
2025-05-26 15:17:07 +02:00
Jo bef128892d
Set `LC_ALL=C` for git when checking git worktree (#13637)
## Summary

Closes #13612

We check if the git error message includes `not a git repository` to
figure out if the path isn't a Git repo or if Git's broken. This PR sets
`LC_ALL=C` when invoking `git rev-parse --is-inside-work-tree` so that
the error message doesn’t change based on the user’s locale settings.
2025-05-24 11:05:38 -04:00
Aria Desires 0ddcc19055
Bump version to 0.7.8 (#13629) 2025-05-23 19:13:28 -04:00
Aria Desires b93ce238a0
blocklist the linux cpython builds from 20250517 (#13617)
There is a runtime issue with some of these builds

Here is the testing I've seen ( has bug,  works):

* uv version (pbs version)
  *  uv 0.7.7 (pbs 20250521)
  *  uv 0.7.6 (pbs 20250517)
  *  uv 0.7.5 (pbs 20250409)
* os
  *  linux
  *  windows
* arch
  *  x86_64
  *  aarch64
* python version
  *  3.12
  *  3.13
  *  3.14

Fixes #13610
2025-05-23 18:15:16 -04:00
konsti 67bf3eb96c
Fix tests due to yanked configargparse (#13623)
The release of configargparse locked in the tests was yanked, we fix
this by updating the snapshots.
2025-05-23 18:43:49 +00:00
John Mumm 3758c513a4
Remove misleading line in pin documentation (#13611)
The documentation did not reflect #12921.
2025-05-23 09:04:50 +02:00
Aria Desires 8580b4bd2d
Bump version to 0.7.7 (#13601) 2025-05-22 14:42:26 -04:00
konsti 46bc7d3477
Build backend: Support stubs packages (#13563)
Stubs packages are different in that their name ends with `-stubs`,
their module is `<module name>-stubs` (with a dash, not the generally
legal underscore) and their modules contain a `__init__.pyi` instead of
an `__init__.py`
(https://typing.python.org/en/latest/spec/distributing.html#stub-only-packages).

We add support in the uv build backend by detecting the `-stubs` suffix.

Fixes #13546

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-05-22 19:02:17 +02:00
Geoffrey Thomas c8479574f2
Sync latest Python releases (#13593)
Pick up python-build-standalone 20250522, in particular to fix
astral-sh/python-build-standalone#619
2025-05-22 09:21:44 -04:00
renovate[bot] c7cabfccd7
Update markdown to v1 and fix CLI reference links (#13166)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [markdown](https://redirect.github.com/wooorm/markdown-rs) |
dependencies | major | `0.3.0` -> `1.0.0` |

---

### Release Notes

<details>
<summary>wooorm/markdown-rs (markdown)</summary>

###
[`v1.0.0`](https://redirect.github.com/wooorm/markdown-rs/releases/tag/1.0.0)

💯

Nothing changed since the last alpha.
It’s just that: this crate’s now being used a bunch and working well, so
it’s time to be stable!

</details>

---

### 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI1Ny4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-05-21 22:50:09 +02:00
Michał Górny dbcfe9f80b
Fix version json tests to work outside git checkout (#13566)
## Summary

Fix the two version json tests to account for the possibility that uv
was built outside a git checkout (e.g. from an unpacked git archive) and
therefore does not have the commit info available. This approach uses
separate snapshots for the two cases, as suggested in discussion of pull
request #13251.

Fixes #13212

## Test Plan

1. `cargo test` in a git clone.
2. `cargo clean`, moved `.git` away, `cargo test` again.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-05-21 15:59:39 -04:00
Aria Desires 38884da9b9
make `uv version` lock and sync (#13317)
This adopts the logic from `uv remove` for locking and syncing, as the
scope of the changes made are ultimately similar. Unlike `uv remove`
there is no support for modifying PEP723 scripts, as these are not
versioned.

In doing this the `version` command gains a truckload of args for
configuring lock/sync behaviour. Presumably most of these are passed via
settings or env files, and not of particular concern.

The most interesting additions are:

* `--frozen`: makes `uv version` work ~exactly as it did before this PR
* `--locked`: errors if the lockfile is out of date
* `--no-sync`: updates the lockfile, but doesn't run the equivalent of
`uv sync`
* `--package name`: a convenience for referring to a package in the
workspace

Note that the existing `--dry-run` flag effectively implies `--frozen` for sets and bumps.

Fixes #13254
Fixes #13548
2025-05-21 09:46:09 -04:00
konsti cf27c077be
Remove unnecessary current dir in tests (#13561)
This is already done by `add_shared_options`.
2025-05-20 21:36:45 +02:00
konsti bc7b71f269
Platform discovery is using ld.so instead ldd (#13552)
In platform discovery we're parsing the output of the ELF interpreter,
e.g., `/lib64/ld-linux-x86-64.so.2`. This file is ld, not ldd, which was
incorrectly named in the code.

An alternative is naming everything ELF interpreter instead of ld.so.
2025-05-20 15:27:22 +02:00
Zanie Blue 7f3e94a091
Bump version to 0.7.6 (#13537)
Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-05-19 19:46:11 -04:00
konsti 2894721b6e
Use `AsyncFn` traits for cached client (#13530)
Make use of the 2024 edition.
2025-05-19 07:49:27 +00:00
samypr100 3483f1d8b3
fix: format uv-trampoline for 2024 edition (#13519)
## Summary

Follow on to https://github.com/astral-sh/uv/pull/13516

Ensure uv-trampoline is formatted after switching to 2024 edition.
2025-05-18 20:19:27 -04:00
Charlie Marsh 6e05d37a1d
Remove `av` pin in `transformers` (#13518)
## Summary

This test started failing, and it fails at least back to v0.6, so I
don't think it's on our end. I'm wondering if all the wheels here were
yanked? They're visible in the lockfile, but not on PyPI:
https://pypi.org/project/av/9.2.0/#files. So to get this passing, let's
just unpin it.

Edit: Ahh, ok. It looks like the project ran out of space, so they
removed wheels for all the older versions:
https://github.com/PyAV-Org/PyAV/issues/1879.
2025-05-18 19:59:34 -04:00
Charlie Marsh c5032aee80
Bump MSRV to 1.85 and Edition 2024 (#13516)
## Summary

Builds on https://github.com/astral-sh/uv/pull/11724.

Closes https://github.com/astral-sh/uv/issues/13476.
2025-05-18 19:38:43 -04:00
Charlie Marsh cc6e766232
Update pre-release hint (#13517)
## Summary

I believe it's a known issue that the "available versions" doesn't
respect `--exclude-newer`.
2025-05-18 18:41:18 -04:00
Michał Górny 061751f195
Add missing git feature dep to preserve_executable_bit test (#12850)
## Summary

Without the `git` feature, it fails with:

```
error: Failed to initialize Git repository at `/home/mgorny/.local/share/uv/tests/.tmp01wGGK/temp/preserve_executable_bit`
stdout:
stderr: error: `git` operations are not allowed — are you missing a cfg for the `git` feature?
```

## Test Plan
cargo test --features python --profile=fast-build --no-default-features
2025-05-18 17:31:01 -04:00
Charlie Marsh 9904c47daf
Respect default extras in uv remove (#13380)
## Summary

Using "all extras" in `uv remove` will cause errors for projects with
conflicting extras. Now that we have a concept of "default extras", it
seems better to respect those defaults like we do for dependency groups.

Closes https://github.com/astral-sh/uv/issues/12770.
2025-05-18 17:28:50 -04:00
Zanie Blue 4b7f5f1103
Update Python releases (#13509) 2025-05-17 13:19:20 -05:00
Eric Nielsen be1404df2a
Fix VIRTUAL_ENV_PROMPT value in activator/activate (#13501)
## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
I've compared all the activator scripts here with the original ones in
https://github.com/pypa/virtualenv/tree/main/src/virtualenv/activation
and only the bash/POSIX script here was yielding a VIRTUAL_ENV_PROMPT
value with parenthesis and a trailing space, which should be part of the
shell prompt (PS1 for bash/POSIX) but not of the VIRTUAL_ENV_PROMPT
value itself. This fixes that small inconsistency. Fixes #13456

This reverts commit 0ec2d4e434

## Test Plan

<!-- How was it tested? -->
I didn't test this locally.
2025-05-17 07:48:09 -04:00
Charlie Marsh 9d1a14e1f9
Bump version to v0.7.5 (#13500) 2025-05-16 20:37:17 -04:00
konsti 5d37c7ecc5
Apply first set of Rustfmt edition 2024 changes (#13478)
Rustfmt introduces a lot of formatting changes in the 2024 edition. To
not break everything all at once, we split out the set of formatting
changes compatible with both the 2021 and 2024 edition by first
formatting with the 2024 style, and then again with the currently used
2021 style.

Notable changes are the formatting of derive macro attributes and lines
with overly long strings and adding trailing semicolons after statements
consistently.
2025-05-16 20:19:02 -04:00
konsti b31d08c683
Bump simple cache bucket to v16 (#13498)
We broke the rkyv deserialization in
e70cf25ea7 (diff-348b24d7a84672ab2873833988156191995ff467619a77f548adbd9808549999L30-R41)
by placing `.tar.bz2` in the position of `.tar.gz`. We need to
invalidate the cache bucket.

Fixes #13492
2025-05-16 20:17:23 -04:00
konsti 316439337f
Don't error when the script is too short for the buffer (#13488)
I hit this error case with a broken wheel.
2025-05-16 20:14:13 -04:00
konsti 77268ee152
Build backend: Case sensitive module discovery (#13468)
We may run on case-sensitive file systems (Linux, generally) or on
case-insensitive file systems (Windows, generally), while modules in
Python may be lower or upper case. For robustness over filesystem
casing, we require an explicit module name for modules with upper cases.

Fixes #13419
2025-05-16 14:25:35 +02:00
konsti 23261b7e2e
Apply some Edition 2024 fixes (#13479)
Some `ref`-removal and `use<>` fixes for the Rust Edition 2024
migration, which are also compatible with Rust Edition 2021.
2025-05-16 10:34:22 +02:00
Andrew Pollack 0baa376627
cli: adjust grammar in “script not supported” error (#13483)
Love this tooling! Small adjustment to help on error messaging 🙏 

<!--
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 previous message was missing the word **“like,”** which made it read
a tad awkwardly.
This PR inserts the missing word so the error reads naturally:
**After:**
```
$ uvx ch1.py 
error: It looks like you tried to run a Python script at `ch1.py`, which is not supported by `uvx`

hint: Use `uv run ch1.py` instead
```

**Before:**
```
$ uvx ch1.py 
error: It looks you tried to run a Python script at `ch1.py`, which is not supported by `uvx`

hint: Use `uv run ch1.py` instead
```

## Test Plan

<!-- How was it tested? -->
- `cargo run -- uvx examples/ch1.py` shows the updated message (see
“After” above).
- `cargo test` passes.
2025-05-16 10:23:30 +02:00
konsti 4aa72089a1
Mask `gen` as `r#gen` for the 2024 edition (#13477)
`gen` is a reserved keyword in Rust 2024. This is a requirement to run
`cargo fmt` on the Rust 2024 edition.
2025-05-15 19:21:12 +00:00
Zanie Blue 6fbcd09b5a
Bump version to 0.7.4 (#13473) 2025-05-15 11:08:50 -05:00
Zanie Blue e92c17881c
Log skip reasons during Python installation key interpreter match checks (#13472)
Investigating https://github.com/astral-sh/uv/issues/13471
2025-05-15 10:28:01 -05:00
konsti 18a1f0d9db
Build backend: Normalize glob paths (#13465)
Unlike OS APIs, glob inclusion checks don't work when there are relative
path elements such as `./`. We normalize the path before using it for
the glob.

Fixes #13407
2025-05-15 17:19:02 +02:00
Ahmed Ilyas 7a83f51de2
Reinstall local packages in `uv add` (#13462)
## Summary

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

## Test Plan

`cargo test`
2025-05-15 14:08:54 +00:00
konsti 7261ede004
Refactor build backend testing (#13464)
This is useful for adding more tests for build backend configuration.
2025-05-15 12:00:02 +00:00
John Mumm 4ea44bec0a
Ensure cached realm credentials are applied if no password is found for index URL (#13463)
We were not correctly falling back to cached realm credentials when an
index URL was provided with only a username. This came up in a [later
comment](https://github.com/astral-sh/uv/issues/13443#issuecomment-2881115301)
on #13443 where credentials in a pip extra index in `uv.toml` were being
ignored when the same URL (but with only a username) was used at the
command line for `--extra-index-url`. I've added a test to catch this
case.

Closes #13443
2025-05-15 13:36:18 +02:00
konsti 12860a9041
Remove extra newline (#13461)
This left an extra newline the hint, which isn't captured in the
snapshot.
2025-05-15 09:30:21 +00:00
Eduardo Rittner Coelho 2d4d93a350
ProgressReporter: align progress bars by largest name length (#13266)
## Summary

Related to https://github.com/astral-sh/uv/issues/12492

This change makes all progress bars vertically aligned. This is still a
WIP and so is not complete, in the current design I store `max_len` in
`BarState` and update it on every `on_request_start`, however this is
problematic since order matters, and if the largest name is not sent
first, the alignment is not complete. To mitigate this we'd probably
have to update all previous bars by "iterating" through the `bars` field
in `BarState` and update all request bars.

Below is an image of what happens when the largest name
(`nvidia-cusparselt-cu12`) is not the first (in this case, it was the
second to last).


![2025-05-02T10:56:54-03:00](https://github.com/user-attachments/assets/ac6f2205-5f30-4fe3-a2c3-f980e36b7cf7)


## Test Plan

There are currently no tests, and I'm not sure how to design them since
from what I gather the `uv_snapshot` facilities record the final output,
not the intermediate stages.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-05-15 09:32:36 +02:00
Charlie Marsh b326bb92a0
Retain trailing comments after PEP 723 metadata block (#13460)
## Summary

Closes https://github.com/astral-sh/uv/issues/13447.
2025-05-14 21:54:20 +00:00
konsti 73cf2b8d59
uv export docs: "export" instead of "install" (#13430)
Change the two missing places in the `uv export` docs to say "export"
instead of "install".
2025-05-13 15:53:10 +02:00
konsti 22b1ed5c5d
Be more precise in unpinned packages warning (#13426)
Fixes #13424
2025-05-13 07:25:05 +00:00
Charlie Marsh ca725d08f2
Remove unused source tree variant (#13422)
## Summary

Perhaps this disappeared when we added support for unnamed requirements?
2025-05-13 07:07:10 +00:00
Charlie Marsh 3b8139526a
Add comma after "i.e." in Conda environment error (#13423) 2025-05-13 03:51:07 +00:00
Charlie Marsh a179972e2d
Reject `pylock.toml` in `uv add -r` (#13421)
## Summary

This silently fails right now.

Closes #13420.
2025-05-13 03:50:01 +00:00
konsti 73d22ac21b
Fix double self-dependency (#13366)
The fix itself and its documentation live in pubgrub:
https://github.com/astral-sh/pubgrub/pull/44

Fixes #13344

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-05-13 03:03:44 +00:00
konsti 3b125dbe71
Avoid panics for cannot-be-a-base URLs (#13406)
Following #13376, avoid `.unwrap()` on `Url::path_segments()`.

I also added some unwrap-safety comments.
2025-05-12 22:29:26 -04:00
John Mumm 6df588bb00
Redact credentials when displaying URLs (#13333)
This PR redacts credentials in displayed URLs. 

It mostly relies on a `redacted_url` function (and where possible
`IndexUrl::redacted`). This is a quick way to prevent leaked credentials
but it's prone to programmer error when adding new trace statements. A
better follow-on would use a `RedactedUrl` type with the appropriate
`Display` implementation. This would allow us to still extract
credentials from the URL while displaying it securely. On the plus side,
the sites where the `redacted_url` function are used serve as easy
signposts for where to use the new type in a future PR.

Closes #1714.
2025-05-12 18:58:25 +02:00
konsti 1afadda819
Add more context to errors in high level crates. (#13351)
Add error context in some places where it was previously missing, and a
few style improvements.
2025-05-12 11:04:41 +00:00
renovate[bot] aed9269c8e
Align indentation of long arguments (#13394)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [clap](https://redirect.github.com/clap-rs/clap) |
workspace.dependencies | patch | `4.5.35` -> `4.5.38` |

---

### Release Notes

<details>
<summary>clap-rs/clap (clap)</summary>

###
[`v4.5.38`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4538---2025-05-11)

[Compare
Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.37...v4.5.38)

##### Fixes

-   *(help)* When showing aliases, include leading `--` or `-`

###
[`v4.5.37`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4537---2025-04-18)

[Compare
Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.36...v4.5.37)

##### Features

-   Added `ArgMatches::try_clear_id()`

###
[`v4.5.36`](https://redirect.github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#4536---2025-04-11)

[Compare
Source](https://redirect.github.com/clap-rs/clap/compare/v4.5.35...v4.5.36)

##### Fixes

- *(help)* Revert 4.5.35's "Don't leave space for shorts if there are
none" for now

</details>

---

### 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:eyJjcmVhdGVkSW5WZXIiOiI0MC43LjEiLCJ1cGRhdGVkSW5WZXIiOiI0MC43LjEiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImludGVybmFsIl19-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-05-12 11:36:48 +02:00
Charlie Marsh 4109210cca
Avoid erroring on `pylock.toml` dependency entries (#13384)
## Summary

We want to allow any map; as-is, it expects the unit struct.

Closes https://github.com/astral-sh/uv/issues/13383.
2025-05-11 02:55:58 +00:00
Charlie Marsh e70cf25ea7
Fix `.tgz` parsing to respect true extension (#13382)
## Summary

We mapped both `.tgz` and `.tar.gz` to the same enum variant; later,
though, we made the assumption that a file marked with that variant
ended with exactly `.tar.gz`. Instead, we need to preserve the
originating suffix.

Closes https://github.com/astral-sh/uv/issues/13372.
2025-05-10 20:55:28 +00:00
Charlie Marsh d3fc814ff9
Retain dot-separated wheel tags during cache prune (#13379)
## Summary

If a set of wheel tags includes a dot, this code is treating the part
_after_ the dot as an extension, and thereby failing to detect that the
entry is a symlink to an archive (and thereby removing the archive).

This is all an optimization, so this code just makes it a little
targeted: we skip specific known extensions, rather than anything with
any extension.

Closes https://github.com/astral-sh/uv/issues/13270.
2025-05-10 18:39:11 +00:00
Frazer McLean 62692b4e1b
Fix detection of sorted dependencies when include-group is used (#13354)
This follows on from #13334 to fix another case.

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

If a dependency group contained any `{ include-group = "..." }` entries,
the sort detection would bail out. The root cause of the problem was
gating the sort detection behind `deps.iter().all(Value::is_str)`.

A public code search reveals that keeping include-groups at the top is
by far the most common, but keeping them at the bottom isn't uncommon.
In both of these cases, uv will now preserve the convention that is in
use.

Unless I've missed it, I don't think uv supports `uv add`ing an
include-group, and so that wasn't tested here.

## Test Plan

cargo test

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-05-10 14:00:27 -04:00
Zanie Blue 26e37f3a1e
Rename `--raw-sources` to `--raw` (#13348)
This also omits bounds on constraints, and is useful for that. This
retains `--raw-sources` as an alias. I've had this on my mind for a
while, but https://github.com/astral-sh/uv/pull/12946 reminded me of it
again.
2025-05-08 15:05:03 -05:00
Zanie Blue 9a15240147
Fix display of HTTP responses in trace logs for retry of errors (#13339)
Follows https://github.com/astral-sh/uv/pull/13228

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

I recall some discussion (maybe around
https://github.com/astral-sh/uv/pull/4725) about how finding the source
may not work properly? I can't find it though.

Now, I tested this, e.g.:

```
❯ cargo run -q -- pip install anyio -vv --index-url https://download.pytorch.org/whl/torch/ --no-cache --reinstall
...
TRACE Considering retry of response HTTP 403 Forbidden for https://download.pytorch.org/whl/torch/anyio/
```

I lament that I didn't think of that as a testing method in the first
place :)
2025-05-08 09:23:24 -05:00
Charlie Marsh 145fe4e7e3
Show 'Downgraded' when self update is used to install an older version (#13340)
## Summary

Small thing I noticed while testing
https://github.com/astral-sh/uv/pull/13305.
2025-05-08 00:17:47 +00:00
Ahmed Ilyas 3eba70cf09
Suggest `uv self update` if required version is newer (#13305)
## Summary

Closes #13253 

## Test Plan

```sh
❯ cat pyproject.toml | rg required
required-version = ">=0.7.3, <0.8"
❯ cargo run -q --features self-update --manifest-path ~/uv/Cargo.toml add black
error: Required uv version `>=0.7.3, <0.8` does not match the running version `0.7.2`.
hint: Update `uv` by running `uv self update`.
❯ cat pyproject.toml | rg required
required-version = ">=0.7.3"
❯ cargo run -q --features self-update --manifest-path ~/uv/Cargo.toml add black
error: Required uv version `>=0.7.3` does not match the running version `0.7.2`. 
hint: Update `uv` by running `uv self update`.
❯ cat pyproject.toml | rg required
required-version = "<0.7"
❯ cargo run -q --features self-update --manifest-path ~/uv/Cargo.toml add black
error: Required uv version `<0.7` does not match the running version `0.7.2`.
❯ cat pyproject.toml | rg required
required-version = ">=0.4,<0.7"
❯ cargo run -q --features self-update --manifest-path ~/uv/Cargo.toml add black
error: Required uv version `>=0.4, <0.7` does not match the running version `0.7.2`.
```

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-05-08 00:09:29 +00:00
Frazer McLean d242c47821
Preserve order of dependencies which are sorted naively (#13334)
## Summary

The prior implementation only looks for dependencies which are sorted by
name then specifier.

I knew uv was meant to preserve sorted dependencies, but it never seemed
to work for me.

I've always used the "sort lines" feature of PyCharm/Sublime to sort
these lists, and I guess I'm not the only one. In such a case,
`flask-wtf>=1.2.1` is sorted before `flask>=3.0.2`.

After digging into the code I realised what was happening, hence this
merge request.

Maybe there's a tool I'm not aware of that people are using to sort
dependencies "properly", or are doing it by hand, but I think this is
worth supporting.

Relevant issues: https://github.com/astral-sh/uv/issues/9076,
https://github.com/astral-sh/uv/issues/10738

## Test Plan

`cargo test`
2025-05-07 18:18:20 -04:00
Zanie Blue 3c413f74b9
Bump verison to 0.7.3 (#13337) 2025-05-07 14:37:22 -05:00
Zanie Blue fa8db5a8d0
Avoid enumerating sources in errors for path Python requests (#13335)
e.g., these are misleading cruft in the error message at
https://github.com/astral-sh/uv/pull/12168#discussion_r2078204601

```
❯ uv python find /foo/bar
error: No interpreter found for path `/foo/bar` in virtual environments, managed installations, or search path
❯ cargo run -q -- python find /foo/bar
error: No interpreter found at path `/foo/bar`
```
2025-05-07 18:53:09 +00:00
konsti 364e3999d4
Improve error message when a virtual environment Python symlink is broken (#12168)
When removing a Python interpreter underneath an existing venv, uv
currently shows a not found error:

```
error: Failed to inspect Python interpreter from active virtual environment at `.venv/bin/python3`
  Caused by: Python interpreter not found at `/home/konsti/projects/uv/.venv/bin/python3`
```

This is unintuitive, as the file for the Python interpreter does exist,
it is a broken symlink that needs to be replaced with `uv venv`.

I've been encountering those occasionally, and I expect users that
switch between versions a lot will, too, especially when they also use
pyenv or a similar Python manager.

The new error hints at this solution:

```
error: Failed to inspect Python interpreter from active virtual environment at `.venv/bin/python3`
  Caused by: Broken symlink at `.venv/bin/python3`, was the underlying Python interpreter removed?

hint: To recreate the virtual environment, run `uv venv`
```
2025-05-07 13:24:53 -05:00
konsti a43333351e
Build backend: Allow escaping in globs (#13313)
PEP 639 does not allow any characters that aren't in either their
limited glob syntax or the alphanumeric Unicode characters. This means
there's no way to express a glob such as `**/@test` for the excludes.

We extend the glob syntax from PEP 639 by introducing backslash escapes,
which can escape all characters but path separators (forward and
backwards slashes) to be parsed verbatim.

This means we have two glob parsers: The strict PEP 639 parser for
`project.license-files`, and our extended parser for `tool.uv`, with a
slight difference if you need to use special characters, to both adhere
to PEP 639 and to support cases such as #13280.

Fixes #13280
2025-05-07 18:31:41 +02:00
Zanie Blue ddd6f3debe
Fix discovery of pre-release managed Python versions in range requests (#13330)
We have test coverage for this elsewhere, but managed Python versions
are a distinct case because we know the _full_ version before querying
the interpreter (whereas, when we find them on the `PATH`, we usually
only know `X.y` from the file name).

This pre-filter logic now matches our subsequent logic at


060be9cef1/crates/uv-python/src/discovery.rs (L2146-L2149)



060be9cef1
shows the snapshot change.
2025-05-07 09:27:13 -05:00
Tobias Gårdhus 5e7f3d2920
Add `--show-with` to `uv tool list` to list packages included by `--with` (#13264)
## Summary

Add a `--show-extras` argument to the `uv tool list` cli, to show which
extra dependencies were installed with the tool.

i.e.

```bash
$ uv tool install fastapi --with requests --with typer==0.14
```

```bash
$ uv tool list --show-extras
fastapi v0.115.12 [extras: requests, typer==0.14]
- fastapi
```

## Test Plan

Added a new test function based on the others in the same file, with the
other arguments tested with the new argument as well.
2025-05-06 15:23:50 -05:00
konsti 1ec1935693
Reproducible uv build backend across operating systems (#13171)
The goal of this PR is to support reproducible builds and best-effort
platform-independent builds. Previously, while the build backend would
build the same source dist and wheel on the same machine, they would
look different across different operating systems. This PR fixes the
platform-dependent walk dir order by sorting and removes
platform-specific permissions from the source dist that had caused those
differences.

The reproducibility goal does not extend to platform-dependent
filesystem features, such as permissions and links, especially in
interaction with Git. Since most users share code across platforms
through Git, we're focusing on cross-platform behavior under Git. One of
those caveats is intentional: If a file, such as a bash script, has an
executable bit, we preserve it. This means that E.g. builds of Git
checkout of a repository with an executable shell script in the sources
will have different archives on Unix and Windows. Another relevant case
are symlinks: By default, Git on Windows replaces symlinks with a file
that contains the path to the target file
(https://stackoverflow.com/q/5917249/3549270). (This example comes from
Cargo, where it means that the package archive is different on Windows
when symlinking license from the repository root to a workspace package)

Best reviewed commit-by-commit
2025-05-06 18:51:56 +02:00
Tim Felgentreff 878c2acdf3
Add downloading of GraalPy (#13172)
## Summary

This adds GraalPy download metadata so that `uv python install graalpy`
works. See https://github.com/astral-sh/uv/issues/13114

## Test Plan

The existing integration test was changed to test this functionality.
2025-05-06 11:02:27 -05:00
konsti 9071e0eeac
Move portable glob parsing to struct (#13311)
Refactoring to make fixing #13280 easier.
2025-05-06 11:22:54 +00:00
konsti 3218e364ae
Use `fs_err` for paths in symlinking errors (#13303)
In #13302, there was an IO error without context. This error seems to be
caused by a symlink error. Switching as symlinking to `fs_err` ensures
these errors will carry context in the future.
2025-05-05 16:29:27 +00:00
Charlie Marsh f557ea3823
Avoid re-creating virtual environment with `--no-sync` (#13287)
## Summary

We now show a user-visible warning if we're using a "stale" virtual
environment due to `--no-sync`. I'd also be fine erroring here.

Closes https://github.com/astral-sh/uv/issues/13235.
2025-05-05 14:57:46 +00:00
konsti 5386701cc1
Build backend: Make preview default and add configuration docs (#12804)
Add configuration documentation for the build backend and make it the
preview default.

The build backend should generally work with default configuration
unless you want specific features such as flat layout or module
renaming, there is only a dedicated configuration, but no concept or
guide page for the build backend. Once the build backend is stable, we
can update the guide documentation to explain that uv defaults to its
own build backend, but other build backends are also supported.

The uv build backend becomes the default in preview, giving it more
exposure from users and preparing it to make it the default proper. The
current documentation retains warnings that the build backend is in
preview.

To see current uses of `uv_build` on GitHub:
https://github.com/search?q=path%3A**%2Fpyproject.toml+uv_build%3E%3D0&type=code

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-05-05 13:52:31 +00:00
Charlie Marsh 07f346f723
Accept `musllinux_1_0` as a valid platform tag (#13289)
## Summary

This seems to match `packaging`:


d0d5ad8687/src/packaging/_musllinux.py (L71C1-L72C62)

Closes https://github.com/astral-sh/uv/issues/13045.
2025-05-05 08:53:41 +02:00
Charlie Marsh 2c567a64b9
Treat already-installed base environment packages as preferences in `uv run --with` (#13284)
## Summary

If a script has some requirements, and you provide `--with`, we
currently ignore any constraints from those requirements. We might want
to treat them as hard constraints in the future. For now, though, we
just treat them as preferences -- so we _prefer_ those versions, but
don't require them to match and still run the `--with` resolution in
isolation.

Closes https://github.com/astral-sh/uv/issues/13173.
2025-05-04 23:24:57 +00:00
Zanie Blue ea4284c041
Add `--dry-run` support to `uv self update` (#9829)
See commentary at
https://github.com/astral-sh/uv/issues/9828#issuecomment-2537542100
regarding the limitations and future upstream changes needed.

```
❯ cargo build --features self-update
   Compiling uv v0.5.8 (/Users/zb/workspace/uv/crates/uv)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.28s
❯ cp ./target/debug/uv ~/.cargo/bin
❯ uv self update --dry-run
info: Checking for updates...
Nothing to do. You're on the latest version of uv (v0.5.8)
❯ uv self update --dry-run 0.5.7
info: Checking for updates...
Would update uv from v0.5.8 to v0.5.7
❯ vi ~/.config/uv/uv-receipt.json  # Edit the receipt to think its on an older version
❯ uv self update --dry-run
info: Checking for updates...
Would update uv from v0.5.8 to the latest version
```

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-05-04 17:54:36 -04:00
Charlie Marsh c12ce84fbd
Respect locked script preferences in `uv run --with` (#13283)
## Summary

Part of https://github.com/astral-sh/uv/issues/13173, but doesn't close
the issue. This just respects preferences if your script uses a
lockfile, since we already support that for locked _projects_.
2025-05-04 12:56:33 -04:00
konsti e2d105d045
Retry streaming downloads on broken pipe errors (#13281)
Educated guess at #12359

See
adab70fd9f/src/proto/streams/state.rs (L309-L310)
for the error source.
2025-05-04 08:56:15 -04:00
konsti 96cfca1c8f
Move static feature out of perf features (#13265)
#5577 fixed a bug on macos due to dynamically linking lzma/xz through
static linking. In #7686, this feature was moved to the performance
category.

This PR moves the `xz2/static` back to the general default features,
and, inspired by https://github.com/Homebrew/homebrew-core/pull/222211,
it structures and documents the feature flags cleaner.

We need to take care that this feature does not accidentally disable
features we want.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-05-02 15:56:40 +00:00
konsti b442aae80e
Only rebuild download JSON on change (#13261)
By default, Cargo runs the build script if any file in the package
changes
(https://doc.rust-lang.org/cargo/reference/build-scripts.html#change-detection).
In our case, we only need to rerun it if `download-metadata.json`
changed.
2025-05-02 07:49:34 -05:00
konsti 360a335e7f
Check nested IO errors for retries (#13260)
## Summary

The only thing that changed for #12175 relevant to the existing
downloads is the order of nesting, so we're checking all nested IO
errors instead of only the first one.

See #13238

## Test Plan

This is an educated guess based on what happens if I turn off the
network during a download.

```
Downloading cpython-3.13.3-linux-x86_64-gnu (download) (20.3MiB)
TRACE Considering retry of error: ExtractError("cpython-3.13.3-20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz", Io(Custom { kind: Other, error: TarError { desc: "failed to unpack `/home/konsti/.local/share/uv/python/.temp/.tmpe3AIvt/python/lib/libpython3.13.so.1.0`", io: Custom { kind: Other, error: TarError { desc: "failed to unpack `python/lib/libpython3.13.so.1.0` into `/home/konsti/.local/share/uv/python/.temp/.tmpe3AIvt/python/lib/libpython3.13.so.1.0`", io: Custom { kind: Other, error: reqwest::Error { kind: Decode, source: reqwest::Error { kind: Body, source: TimedOut } } } } } } }))
TRACE Cannot retry IO error: not one of `ConnectionReset` or `UnexpectedEof`
TRACE Cannot retry IO error: not one of `ConnectionReset` or `UnexpectedEof`
TRACE Cannot retry error: not an IO error
error: Failed to install cpython-3.13.3-linux-x86_64-gnu
  Caused by: Failed to extract archive: cpython-3.13.3-20250409-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
  Caused by: failed to unpack `/home/konsti/.local/share/uv/python/.temp/.tmpe3AIvt/python/lib/libpython3.13.so.1.0`
  Caused by: failed to unpack `python/lib/libpython3.13.so.1.0` into `/home/konsti/.local/share/uv/python/.temp/.tmpe3AIvt/python/lib/libpython3.13.so.1.0`
  Caused by: error decoding response body
  Caused by: request or response body error
  Caused by: operation timed out
```
2025-05-02 14:41:09 +02:00
Christopher Tee 801fd0e5b8
Deduplicate fetched index URLs (#13205)
<!--
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? -->
Fixes #11970.

## Test Plan

<!-- How was it tested? -->
Ran `cargo nextest`
2025-05-02 10:29:07 +02:00
konsti 4c63c9c6a2
Update add_warn_index_url snapshot (#13259)
There is a new idna version of testpypi. While we don't select that
version due to the exclude-newer cutoff, the version is still available
to pubgrub as an incompatible choice, changing the error message on
conflicts.
2025-05-02 08:13:37 +00:00
Charlie Marsh a261995449
Use base client pattern in more sites (#13227)
## Summary

For consistency. No functional changes.
2025-04-30 20:00:59 -04:00
Meitar Reihan 0593b967ba
Add `python-downloads-json-url` option for `uv.toml` to configure custom Python installations via JSON URL (#12974)
## Summary

Part of #12838. Allow users to configure `python-downloads-json-url` in
`uv.toml` and not just from env.

I followed similar PR #8695, so same as there it's also available in the
CLI (I think maybe it's better not to be configurable from the CLI, but
since the mirror parameters are, I think it's better to do the same)


## Test Plan

<!-- How was it tested? -->
2025-04-30 15:52:11 -04:00
Meitar Reihan 5ee54b4fa3
minify and filter embed managed pythons json on compile time (#12967)
## Summary

In #10939 I added the generated
`crates/uv-python/src/download-metadata-minified.json` file which is a
minified version of `crates/uv-python/download-metadata.json`.

The main reason for this PR is to avoid bloating the git objects as this
is a single-line file.

As a bonus, I also filtered the embed json to include only the versions
for the compiled target. Which should improve the binary size and
performance by a bit.

## Test Plan

<!-- How was it tested? -->
2025-04-30 15:51:03 -04:00
Zanie Blue 481d05d8df
Bump version to 0.7.2 (#13240) 2025-04-30 14:01:58 -05:00
Aria Desires f91b4aeb66
hard error `uv version` for more cli flags (#13203) 2025-04-30 17:39:11 +00:00
Zanie Blue 671d609127
Improve trace log for retryable errors (#13228)
Previously, this looked like

> TRACE Considering retry of error: Error { kind:
WrappedReqwestError(Url { scheme: "https", cannot_be_a_base: false,
username: "", password: None, host: Some(Domain("pkgs.dev.azure.com")),
port: None, path:
"/My-Project-Name/_packaging/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX/pypi/download/rr-config/4/rr_config-4.0.0-py3-none-any.whl",
query: None, fragment: None },
WrappedReqwestError(Reqwest(reqwest::Error { kind: Status(405), url:
"https://pkgs.dev.azure.com/My-Project-Name/_packaging/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX/pypi/download/rr-config/4/rr_config-4.0.0-py3-none-any.whl"
}))) }
2025-04-30 12:29:47 -05:00
Zanie Blue d8e472cfa8
Use "error" instead of "warning" for self-update message (#13229)
Closes https://github.com/astral-sh/uv/issues/13221
2025-04-30 12:23:30 -05:00
Zanie Blue a9ab39ad6f
Fix patching of `clang` in managed Python sysconfig (#13237)
Regressed in
https://github.com/astral-sh/uv/pull/12239/files#r2069106892 because
additional entries override the previous one in the mapping. Now, we can
apply multiple patches in-order.

Closes #13236
2025-04-30 12:23:22 -05:00
konsti 9ea0fdcee9
Respect `--project` in `uv version` (#13230)
Previously, we were using the wrong `Workspace` discovery and would
report the version of the workspace root, which would iterate up from
the `--project` directory and return the workspace root (with or without
a project in the root). Instead, we need `ProjectWorkspace` discovery
that returns the closest project.

This fixes `uv version --project <path>` where `<path>` belongs to a
workspace member.

Fixes #13213
2025-04-30 16:11:50 +00:00
Zanie Blue 3a87b6374a
Fix incorrect venv invalidation for pre-release Python versions (#13234)
I think this regressed in https://github.com/astral-sh/uv/pull/13027 — I
misunderstood what versions could be represented in the `pyvenv.cfg` (I
assumed they _never_ included pre-release components).

Closes #13233
2025-04-30 10:55:22 -05:00
konsti 90f46f89a5
Bump version to 0.7.1 (#13218)
Revert fix handling of authentication when encountering redirects
([#13215](https://github.com/astral-sh/uv/pull/13215))
2025-04-30 11:41:55 +02:00
John Mumm c73819371c
Revert fix handling of authentication when encountering redirects (#13215)
These changes to redirect handling appear to have caused #13208. This PR
reverts the redirect changes to give us time to investigate.
2025-04-30 10:53:10 +02:00
Charlie Marsh 6bce5d712f
Add support for BLAKE2b-256 (#13204)
## Summary

You can upload these to PyPI and `warehouse` will validate them.
2025-04-29 18:39:41 -04:00
Charlie Marsh 62bca8c34c Stylize version warning with bold, yellow, etc. (#13202) 2025-04-29 16:37:00 -05:00
Zanie Blue 1e8e08def2 Bump version to 0.7.0 and write changelog (#13201)
The changelog diff is deranged. Rendered at
https://github.com/astral-sh/uv/blob/zb/changelog-07/CHANGELOG.md#070

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>
2025-04-29 16:37:00 -05:00
Zanie Blue f84faf726a Make uv’s first-index strategy more secure by default by failing early on authentication failure (#12805)
uv’s default index strategy was designed with dependency confusion
attacks in mind. [According to the
docs](https://docs.astral.sh/uv/configuration/indexes/#searching-across-multiple-indexes),
“if a package exists on an internal index, it should always be installed
from the internal index, and never from PyPI”. Unfortunately, this is
not true in the case where authentication fails on that internal index.
In that case, uv will simply try the next index (even on the
`first-index` strategy). This means that uv is not secure by default in
this common scenario.

This PR causes uv to stop searching for a package if it encounters an
authentication failure at an index. It is possible to opt out of this
behavior for an index with a new `pyproject.toml` option
`ignore-error-codes`. For example:

```
[[tool.uv.index]]
name = "my-index"
url = "<index-url>"
ignore-error-codes = [401, 403]
```

This will also enable users to handle idiosyncratic registries in a more
fine-grained way. For example, PyTorch registries return a 403 when a
package is not found. In this PR, we special-case PyTorch registries to
ignore 403s, but users can use `ignore-error-codes` to handle similar
behaviors if they encounter them on internal registries.

Depends on #12651

Closes #9429
Closes #12362
2025-04-29 16:37:00 -05:00
Charlie Marsh 11d00d21f7 Reject non-PEP 751 TOML files in install commands (#13120)
If you pass a TOML file to `uv pip install` that isn't recognized, we
should just reject it instead of assuming `requirements.txt`. I just
don't see a real case where it's better to let the command proceed.
2025-04-29 16:37:00 -05:00
Charlie Marsh 3ace372158 Reject non-PEP 751 filenames in `uv pip compile` and `uv export` (#13119)
We shouldn't let users create files that won't work in subsequent
commands.

Closes https://github.com/astral-sh/uv/issues/13117.
2025-04-29 16:37:00 -05:00
Zanie Blue e8524ebea4 Fix display name for `uvx --version` (#13109)
Based on #13108 because I don't want to deal with rebasing conflicts
across `main` and `release/070`.

```
❯ .uvx --version
uv-tool-uvx 0.6.16+23 (33b8b7340 2025-04-25)

❯ uvx --version
uvx 0.6.16+23 (33b8b7340 2025-04-25)
```

For posterity, chased this down via
https://github.com/clap-rs/clap/pull/3693 and
https://github.com/clap-rs/clap/issues/1382
2025-04-29 16:37:00 -05:00
Zanie Blue 60a164abbb Remove `--version` from subcommands (#13108)
Supersedes https://github.com/astral-sh/uv/pull/12439 — does not use the
Clap macro so we retain control over the messages
Closes #12431

0077a67b34
pulls `uv run` and `uv tool run` test changes from
https://github.com/astral-sh/uv/pull/12439
2025-04-29 16:37:00 -05:00
Zanie Blue b6df755c9b Omit Python 3.7 downloads from managed versions (#13022)
Removes Python 3.7 installation support.

The following are available today and would no longer be available

```
cpython-3.7.9-windows-x86_64-none                      <download available>
cpython-3.7.9-windows-x86-none                         <download available>
cpython-3.7.9-macos-x86_64-none                        <download available>
cpython-3.7.9-linux-x86_64-gnu                         <download available>
cpython-3.7.7-windows-x86_64-none                      <download available>
cpython-3.7.7-windows-x86-none                         <download available>
cpython-3.7.7-macos-x86_64-none                        <download available>
cpython-3.7.7-linux-x86_64-gnu                         <download available>
cpython-3.7.6-windows-x86_64-none                      <download available>
cpython-3.7.6-windows-x86-none                         <download available>
pypy-3.7.13-windows-x86_64-none                        <download available>
pypy-3.7.13-macos-x86_64-none                          <download available>
pypy-3.7.13-linux-x86_64-gnu                           <download available>
pypy-3.7.13-linux-x86-gnu                              <download available>
pypy-3.7.13-linux-s390x-gnu                            <download available>
pypy-3.7.13-linux-aarch64-gnu                          <download available>
pypy-3.7.12-windows-x86_64-none                        <download available>
pypy-3.7.12-macos-x86_64-none                          <download available>
pypy-3.7.12-linux-x86_64-gnu                           <download available>
pypy-3.7.12-linux-x86-gnu                              <download available>
pypy-3.7.12-linux-s390x-gnu                            <download available>
pypy-3.7.12-linux-aarch64-gnu                          <download available>
pypy-3.7.10-windows-x86_64-none                        <download available>
pypy-3.7.10-macos-x86_64-none                          <download available>
pypy-3.7.10-linux-x86_64-gnu                           <download available>
pypy-3.7.10-linux-x86-gnu                              <download available>
pypy-3.7.10-linux-s390x-gnu                            <download available>
pypy-3.7.10-linux-aarch64-gnu                          <download available>
pypy-3.7.9-windows-x86-none                            <download available>
pypy-3.7.9-macos-x86_64-none                           <download available>
pypy-3.7.9-linux-x86_64-gnu                            <download available>
pypy-3.7.9-linux-x86-gnu                               <download available>
pypy-3.7.9-linux-s390x-gnu                             <download available>
pypy-3.7.9-linux-aarch64-gnu                           <download available>
```

All the CPython ones should absolutely not be available, as they're not
even the last security patch release. I'm on the fence about PyPy?
2025-04-29 16:37:00 -05:00
Charlie Marsh 8bb5b63009 Make `--frozen` and `--no-sources` conflicting options (#12671)
Alternatively, we could just warn.

Closes https://github.com/astral-sh/uv/issues/12653.
2025-04-29 16:37:00 -05:00
Aria Desires f401d9ba8f change `uv version` to be an interface for project version reads and edits (#12349)
This is a reimplementation of #7248 with a new CLI interface.

The old `uv version` is now `uv self version` (also it has gained a
`--short` flag for parity).
The new `uv version` is now an interface for getting/setting the project
version.

To give a modicum of support for migration, if `uv version` is run and
we fail to find/read a `pyproject.toml` we will fallback to `uv self
version`. `uv version --project .` prevents this fallback from being
allowed.

The new API of `uv version` is as follows:

* pass nothing to read the project version
* pass a version to set the project version
* `--bump major|minor|patch` to semver-bump the project version
* `--dry-run` to show the result but not apply it
* `--short` to have the final printout contain only the final version
* `--output-format json` to get the final printout as json

```
$ uv version
myfast 0.1.0

$ uv version --bump major --dry-run
myfast 0.1.0 => 1.0.0

$ uv version 1.2.3 --dry-run
myfast 0.1.0 => 1.2.3

$ uv version 1.2.3
myfast 0.1.0 => 1.2.3

$ uv version  --short
1.2.3

$ uv version  --output-format json
{
  "package_name": "myfast",
  "version": "1.2.3",
  "commit_info": null
}
```

Fixes #6298
2025-04-29 16:37:00 -05:00
Zanie Blue de1479c4ef Use index URL instead of package URL for keyring credential lookups (#12651)
Some registries (like Azure Artifact) can require you to authenticate
separately for every package URL if you do not authenticate for the
/simple endpoint. These changes make the auth middleware aware of index
URL endpoints and attempts to fetch keyring credentials for such an
index URL when making a request to any URL it's a prefix of.

The current uv behavior is to cache credentials either at the request
URL or realm level. But with these changes, we also need to cache
credentials at the index level. Note that when uv does not detect an
index URL for a request URL, it will continue to apply the old behavior.

Addresses part of #4056
Closes #4583
Closes #11236
Closes #11391
Closes #11507
2025-04-29 16:37:00 -05:00
Zanie Blue 514a7ea6df Require the command in `uvx <name>` to be available in the Python environment (#11603)
Closes https://github.com/astral-sh/uv/issues/7804

Includes a few small minor changes to the messaging, but the primary
change is that in, e.g., `uvx foo`, if the `foo` package does not
provide the `foo` executable we will no longer execute an arbitrary
`foo` executable if present on the `PATH`. This prevents confusing and
surprising behavior, such as the user reported where they did `uv tool
install foobar` (which provides `foo`) then `uvx foo` (which does not
provide `foo`) later falls back to the executable provided by `foobar`
since it's on the `PATH`. We don't enforce this for `--from`, so things
like `uvx --from foo bash -c "..."` are still totally valid. We also
still allow `uvx foo` where the `foo` executable is provided by a
_dependency_ of `foo` instead of `foo` itself.

Most of the diff here is consolidating the logic of the
`hint_on_not_found` and `warn_executable_not_provided_by_package `
utilities.
2025-04-29 16:37:00 -05:00
Zanie Blue 6cc2202799 Ignore arbitrary Python requests in version files (#12909)
Closes https://github.com/astral-sh/uv/issues/12605
2025-04-29 16:37:00 -05:00
Zanie Blue 1988e209ef Treat empty `UV_PYTHON_INSTALL_DIR` as unset (#12907)
Same as https://github.com/astral-sh/uv/pull/12905 — found via regex
2025-04-29 16:37:00 -05:00
Zanie Blue cac6560b4f Treat empty `UV_TOOL_DIR` as unset (#12905)
Closes https://github.com/astral-sh/uv/issues/8608
2025-04-29 16:37:00 -05:00
Aria Desires 318949ade6 Error on unknown dependency object specifiers (#12841)
This reverts commit dd788a0f47.

And relands #12811, for 0.7.0
2025-04-29 16:37:00 -05:00
Charlie Marsh a3dae2512c
Disallow mixing requirements across PyTorch indexes (#13179)
## Summary

If you use `--torch-backend=auto`, we want to avoid selecting (e.g.) a
`+cu124` build of `torch` alongside a `+cu126` build of `torchvision`.
2025-04-28 20:06:18 +00:00
Bartosz Sokorski 6292748371
Add poetry-core as a build backend option (#12781)
<!--
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 adds `poetry-core` as a build backend choice. 

## Test Plan

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

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-04-28 19:11:52 +00:00
Ahmed Ilyas 4680c9b22d
Add more default group tests and fix default groups for `uv add` (#13182)
## Summary

Brings in a bug fix for `uv add` w.r.t default groups from
https://github.com/astral-sh/uv/pull/12964, see comment:
https://github.com/astral-sh/uv/pull/12964#discussion_r2060775131

Adds additional test coverage for default groups in `run`, `remove`,
`add`.

## Test Plan

`cargo test`
2025-04-28 15:02:43 -04:00
Ahmed Ilyas f872917d33
Refactor `ExtraSpecification` to support `default-extras` (#12964)
## Summary

Part of #8607. This is a pure refactor aimed at paving the way for
supporting the `default-extras` configuration in the `pyproject.toml`
file.

The `ExtraSpecification` struct has been refactored to align more
closely with the
[`DependencyGroups`](256b100a9e/crates/uv-configuration/src/dependency_groups.rs (L9))
struct.

## Test Plan

Existing tests.
2025-04-28 13:30:14 -04:00
konsti 85d8b07026
Remove flyte-short-incompatible benchmark for too many false positives (#13181)
The benchmark has recurring false positives
(https://github.com/astral-sh/uv/issues?q=flyte-short-incompatible%20),
so we're removing it.
2025-04-28 18:01:34 +02:00
Charlie Marsh bb0158d005
Use `upload-time` rather than `upload_time` in `uv.lock` (#13176)
## Summary

In https://github.com/astral-sh/uv/pull/12968, we added support for
upload time to `uv.lock`, but stylized as `upload_time`. The other keys
in `uv.lock` use kebab casing, as in common in Python formats, so this
really should've been `upload-time`. I want to change it ASAP to
minimize churn for users. Any users that already upgraded will of course
experience churn in their files a second time. But if we don't change it
now, we'll only increase the surface area of affected users.

So, this PR uses `upload-time` instead, but continues reading
`upload_time` to make it non-breaking.
2025-04-28 11:01:17 -04:00
renovate[bot] 6402f98cbd
Update Rust crate windows to 0.61.0 (#13159)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [windows](https://redirect.github.com/microsoft/windows-rs) |
dependencies | minor | `0.59.0` -> `0.61.0` |

---

### Release Notes

<details>
<summary>microsoft/windows-rs (windows)</summary>

###
[`v0.61.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.61.0)

[Compare
Source](https://redirect.github.com/microsoft/windows-rs/compare/0.60.0...0.61.0)

Major crate updates:

-   `windows` 0.59.0
-   `windows-core` 0.59.0
    -   `windows-implement` 0.59.0
    -   `windows-interface` 0.59.0
-   `windows-targets` 0.53.0
    -   `windows_i686_msvc` 0.53.0
    -   `windows_x86_64_msvc` 0.53.0
    -   `windows_aarch64_msvc` 0.53.0
    -   `windows_i686_gnu` 0.53.0
    -   `windows_x86_64_gnu` 0.53.0
    -   `windows_i686_gnullvm` 0.53.0
    -   `windows_x86_64_gnullvm` 0.53.0
    -   `windows_aarch64_gnullvm` 0.53.0
-   `windows-bindgen` 0.59.0
-   `windows-registry` 0.4.0
-   `windows-result` 0.3.0
-   `windows-strings` 0.3.0
-   `cppwinrt` 0.2.0

Minor crate updates:

-   `windows-version` 0.1.2

Excluded:

-   `windows-sys` 0.59.0

Things to keep in mind:

- The tag/release names no longer map directly to the crate versions, so
to [find
samples](https://redirect.github.com/microsoft/windows-rs/tree/master/crates/samples)
for a particular release requires looking at [the
releases](https://redirect.github.com/microsoft/windows-rs/releases)
page and finding the release that most recently updated a particular
crate.

- The `windows-bindgen` crate includes the major code generation
overhaul that brings many improvements - be sure to check out the PR
description for more information. The resulting code gen depends on the
new version of `windows-core` and its dependencies, unless you include
the `--sys` option.
[#&#8203;3359](https://redirect.github.com/microsoft/windows-rs/issues/3359)

- The `cppwinrt` crate constitutes a major update due to streamlining
the error handling.
[#&#8203;3415](https://redirect.github.com/microsoft/windows-rs/issues/3415)

- The `windows-registry`, `windows-strings,` and `windows-result` crates
are also major version updates since they include small breaking
changes.

- The `windows-targets` crate finally receives a major version update,
the first in over a year. This is due to
[#&#8203;3359](https://redirect.github.com/microsoft/windows-rs/issues/3359)
and
[#&#8203;3342](https://redirect.github.com/microsoft/windows-rs/issues/3342)
potentially introducing breaking changes. Although unlikely, these
updates introduced sufficient changes that make it hard to ensure that
the `windows-targets` libs don't break existing code. As we're updating
`windows-targets` anyway, I took the liberty to bump the MSRV to 1.60 -
to match the latest version of `windows-sys` - and remove the old but
unused doc macro feature. Both remained for compatibility with very old
dependents of the `windows-targets` crate.

- The `windows-version` crate receives a minor update to update its
dependency on the `windows-targets` crate.

- Beyond these specifics, this update is the culmination of around 6
months worth of work on the `windows-rs` project. The biggest
improvements comes from the new code generation engine, but many other
improvements are now also available for production. This includes
support for many new lints, warnings, and suggestions provided by the
Rust toolchain; much smaller code gen thanks to deriving many more
traits; more efficient code gen; major improvements to WinRT type system
and implementation support; more robust and consistent error handling;
stock collection and async support; improved support for class
hierarchies; and much more!

In addition to "what's changed" below, check out what's changed for
notes for
[0.60.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0)
and
[0.59.0](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.59.0)
for additional changes that roll up to the crates published as part of
this release.

#### What's Changed

- Remove improper_ctypes workaround by
[@&#8203;ChrisDenton](https://redirect.github.com/ChrisDenton) in
[https://github.com/microsoft/windows-rs/pull/3296](https://redirect.github.com/microsoft/windows-rs/pull/3296)
- Bump rollup from 2.79.1 to 2.79.2 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3299](https://redirect.github.com/microsoft/windows-rs/pull/3299)
- Update jsonschema requirement from 0.20 to 0.21 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3301](https://redirect.github.com/microsoft/windows-rs/pull/3301)
- Address Rust nightly compiler warnings by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3311](https://redirect.github.com/microsoft/windows-rs/pull/3311)
- Update jsonschema requirement from 0.21 to 0.22 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3310](https://redirect.github.com/microsoft/windows-rs/pull/3310)
- Update workflows to ignore paths on pull request by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3312](https://redirect.github.com/microsoft/windows-rs/pull/3312)
- Fix remaining `std` references in `windows` and `windows-core` crates
for `no_std` builds by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3317](https://redirect.github.com/microsoft/windows-rs/pull/3317)
- Bump cookie and express in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3318](https://redirect.github.com/microsoft/windows-rs/pull/3318)
- Fix nested struct sort order by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3321](https://redirect.github.com/microsoft/windows-rs/pull/3321)
- Update jsonschema requirement from 0.22 to 0.23 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3323](https://redirect.github.com/microsoft/windows-rs/pull/3323)
- Add `unwrap` helper for `NTSTATUS` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3324](https://redirect.github.com/microsoft/windows-rs/pull/3324)
- Bump http-proxy-middleware from 2.0.6 to 2.0.7 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3331](https://redirect.github.com/microsoft/windows-rs/pull/3331)
- Remove "implement" feature by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3333](https://redirect.github.com/microsoft/windows-rs/pull/3333)
- Update web workflow by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3344](https://redirect.github.com/microsoft/windows-rs/pull/3344)
- Update Windows metadata by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3342](https://redirect.github.com/microsoft/windows-rs/pull/3342)
- Bump cross-spawn from 7.0.3 to 7.0.6 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3347](https://redirect.github.com/microsoft/windows-rs/pull/3347)
- fix: remove use of std in windows-strings h! macro by
[@&#8203;vthib](https://redirect.github.com/vthib) in
[https://github.com/microsoft/windows-rs/pull/3356](https://redirect.github.com/microsoft/windows-rs/pull/3356)
- Major `windows-bindgen` update by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3359](https://redirect.github.com/microsoft/windows-rs/pull/3359)
- Harden reg-free class activation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3365](https://redirect.github.com/microsoft/windows-rs/pull/3365)
- Simpler bindings generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3367](https://redirect.github.com/microsoft/windows-rs/pull/3367)
- `windows-bindgen` should generate `no_std` bindings by default by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3366](https://redirect.github.com/microsoft/windows-rs/pull/3366)
- Prefer optional over convertible parameters by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3368](https://redirect.github.com/microsoft/windows-rs/pull/3368)
- Remove unused extensions by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3369](https://redirect.github.com/microsoft/windows-rs/pull/3369)
- Simpler code generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3370](https://redirect.github.com/microsoft/windows-rs/pull/3370)
- Update dependencies by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3374](https://redirect.github.com/microsoft/windows-rs/pull/3374)
- Simpler code gen for Boolean parameters by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3373](https://redirect.github.com/microsoft/windows-rs/pull/3373)
- Remap `BOOLEAN` to `bool` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3376](https://redirect.github.com/microsoft/windows-rs/pull/3376)
- Avoid generating `transmute` for input value type parameter bindings
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3377](https://redirect.github.com/microsoft/windows-rs/pull/3377)
- Fix macro docs by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3378](https://redirect.github.com/microsoft/windows-rs/pull/3378)
- Streamline error handling in `windows-bindgen` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3379](https://redirect.github.com/microsoft/windows-rs/pull/3379)
- Improve WinRT event representation and testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3382](https://redirect.github.com/microsoft/windows-rs/pull/3382)
- Use `track_caller` to make debugging `bindgen` build script errors
easier by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3383](https://redirect.github.com/microsoft/windows-rs/pull/3383)
- `windows-bindgen` now uses `Ref` and `OutRef` for COM interface traits
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3386](https://redirect.github.com/microsoft/windows-rs/pull/3386)
- Add static event test/sample for WinRT by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3389](https://redirect.github.com/microsoft/windows-rs/pull/3389)
- Verify param direction by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3390](https://redirect.github.com/microsoft/windows-rs/pull/3390)
- Ensure external references to static factories are generated correctly
by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3392](https://redirect.github.com/microsoft/windows-rs/pull/3392)
- Update `windows-bindgen` to support `unsafe_op_in_unsafe_fn` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3393](https://redirect.github.com/microsoft/windows-rs/pull/3393)
- Make `Ref` work with more than just interface types by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3394](https://redirect.github.com/microsoft/windows-rs/pull/3394)
- Add PR preview deployments to web workflow by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3395](https://redirect.github.com/microsoft/windows-rs/pull/3395)
- Adjust web workflow to use gh-pages branch by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3397](https://redirect.github.com/microsoft/windows-rs/pull/3397)
- Streamline CRA deps and webpack config by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3396](https://redirect.github.com/microsoft/windows-rs/pull/3396)
- Address nightly clippy warnings about operator precedence by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3414](https://redirect.github.com/microsoft/windows-rs/pull/3414)
- Detect unsupported array parameters by
[@&#8203;iancormac84](https://redirect.github.com/iancormac84) in
[https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402)
- `cppwinrt` should consistently panic on failure by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3415](https://redirect.github.com/microsoft/windows-rs/pull/3415)
- Shorten sample crate names by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3416](https://redirect.github.com/microsoft/windows-rs/pull/3416)
- Use `track_caller` to make debugging `cppwinrt` build script errors
easier by [@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3417](https://redirect.github.com/microsoft/windows-rs/pull/3417)
- Fix provenance in direct32 sample by
[@&#8203;ChrisDenton](https://redirect.github.com/ChrisDenton) in
[https://github.com/microsoft/windows-rs/pull/3419](https://redirect.github.com/microsoft/windows-rs/pull/3419)
- Update web workflow to use external origin by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3420](https://redirect.github.com/microsoft/windows-rs/pull/3420)
- Avoid `transmute` where possible by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3421](https://redirect.github.com/microsoft/windows-rs/pull/3421)
- Update GitHub Actions runners by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3423](https://redirect.github.com/microsoft/windows-rs/pull/3423)
- Improve feature search UX, add dark mode, and update deps by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3422](https://redirect.github.com/microsoft/windows-rs/pull/3422)
- Release 0.61.0 by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3418](https://redirect.github.com/microsoft/windows-rs/pull/3418)

#### New Contributors

- [@&#8203;iancormac84](https://redirect.github.com/iancormac84) made
their first contribution in
[https://github.com/microsoft/windows-rs/pull/3402](https://redirect.github.com/microsoft/windows-rs/pull/3402)

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.60.0...0.61.0

###
[`v0.60.0`](https://redirect.github.com/microsoft/windows-rs/releases/tag/0.60.0)

[Compare
Source](https://redirect.github.com/microsoft/windows-rs/compare/0.59.0...0.60.0)

This release includes an update to the
[windows-registry](https://crates.io/crates/windows-registry) and
[windows-strings](https://crates.io/crates/windows-strings) crates,
mainly to provide various improvements to registry support for
[rustup](https://redirect.github.com/rust-lang/rustup).

#### What's Changed

- Add precise registry types and allocation-free queries and updates by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3184](https://redirect.github.com/microsoft/windows-rs/pull/3184)
- Add registry `Value` to/from `HSTRING` conversion by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3190](https://redirect.github.com/microsoft/windows-rs/pull/3190)
- Replace `From<&str>` for `GUID` with `TryFrom<&str>` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3193](https://redirect.github.com/microsoft/windows-rs/pull/3193)
- Remove uneeded feature dependencies by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3201](https://redirect.github.com/microsoft/windows-rs/pull/3201)
- docs: add root level documentation for all libraries by
[@&#8203;Nerixyz](https://redirect.github.com/Nerixyz) in
[https://github.com/microsoft/windows-rs/pull/3202](https://redirect.github.com/microsoft/windows-rs/pull/3202)
- Cleanup doc testing by
[@&#8203;Nerixyz](https://redirect.github.com/Nerixyz) in
[https://github.com/microsoft/windows-rs/pull/3205](https://redirect.github.com/microsoft/windows-rs/pull/3205)
- Revert cfg doc by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3206](https://redirect.github.com/microsoft/windows-rs/pull/3206)
- Remove workaround for "unused" private fields by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3207](https://redirect.github.com/microsoft/windows-rs/pull/3207)
- Immutable Event implementation by
[@&#8203;lifers](https://redirect.github.com/lifers) in
[https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198)
- Always treat warnings as errors by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3210](https://redirect.github.com/microsoft/windows-rs/pull/3210)
- Consistent allocation failure handling by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3209](https://redirect.github.com/microsoft/windows-rs/pull/3209)
- Improve class hierarchy support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3212](https://redirect.github.com/microsoft/windows-rs/pull/3212)
- Consistent allocation failure for stock collections by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3216](https://redirect.github.com/microsoft/windows-rs/pull/3216)
- Consistent allocation failure for `windows-registry` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3215](https://redirect.github.com/microsoft/windows-rs/pull/3215)
- Add default "std" feature for `windows-registry` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3214](https://redirect.github.com/microsoft/windows-rs/pull/3214)
- Overhaul async and future support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3213](https://redirect.github.com/microsoft/windows-rs/pull/3213)
- Addressing new nightly Clippy warning by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3222](https://redirect.github.com/microsoft/windows-rs/pull/3222)
- Add async `ready` support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3221](https://redirect.github.com/microsoft/windows-rs/pull/3221)
- Bump micromatch from 4.0.5 to 4.0.8 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3223](https://redirect.github.com/microsoft/windows-rs/pull/3223)
- Add file dialog sample by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3226](https://redirect.github.com/microsoft/windows-rs/pull/3226)
- Use relative path for extension by
[@&#8203;glandium](https://redirect.github.com/glandium) in
[https://github.com/microsoft/windows-rs/pull/3224](https://redirect.github.com/microsoft/windows-rs/pull/3224)
- Simplify trait bounds for interface implementations by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3227](https://redirect.github.com/microsoft/windows-rs/pull/3227)
- Remove unnecessary closure from generated code by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3228](https://redirect.github.com/microsoft/windows-rs/pull/3228)
- Bump webpack from 5.90.2 to 5.94.0 in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3236](https://redirect.github.com/microsoft/windows-rs/pull/3236)
- Add async `spawn` support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3235](https://redirect.github.com/microsoft/windows-rs/pull/3235)
- Nightly Clippy warning about assumed lifetime by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3243](https://redirect.github.com/microsoft/windows-rs/pull/3243)
- Regenerate GNU libs by
[@&#8203;riverar](https://redirect.github.com/riverar) in
[https://github.com/microsoft/windows-rs/pull/3241](https://redirect.github.com/microsoft/windows-rs/pull/3241)
- Add support for composable constructors by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3246](https://redirect.github.com/microsoft/windows-rs/pull/3246)
- Use workspace dependencies where practical by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3248](https://redirect.github.com/microsoft/windows-rs/pull/3248)
- Add test folders by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3252](https://redirect.github.com/microsoft/windows-rs/pull/3252)
- Improve interop testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3253](https://redirect.github.com/microsoft/windows-rs/pull/3253)
- Avoid deriving `Eq` for structs containing floating point type
parameters by [@&#8203;kennykerr](https://redirect.github.com/kennykerr)
in
[https://github.com/microsoft/windows-rs/pull/3255](https://redirect.github.com/microsoft/windows-rs/pull/3255)
- Add test for composable type authoring support by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3259](https://redirect.github.com/microsoft/windows-rs/pull/3259)
- Factory cache statics don't need to be public by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3261](https://redirect.github.com/microsoft/windows-rs/pull/3261)
- Allow `noexcept` methods in a composable hierarchy by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3262](https://redirect.github.com/microsoft/windows-rs/pull/3262)
- Group more of the WinRT tests together by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3263](https://redirect.github.com/microsoft/windows-rs/pull/3263)
- Remove "riddle" and metadata generation by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3266](https://redirect.github.com/microsoft/windows-rs/pull/3266)
- Improvements to `windows-metadata` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3268](https://redirect.github.com/microsoft/windows-rs/pull/3268)
- We can now derive `Eq` and `PartialEq` for structs containing
callbacks by [@&#8203;kennykerr](https://redirect.github.com/kennykerr)
in
[https://github.com/microsoft/windows-rs/pull/3270](https://redirect.github.com/microsoft/windows-rs/pull/3270)
- Simpler "retval" heuristic by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3271](https://redirect.github.com/microsoft/windows-rs/pull/3271)
- Test error handling for `windows-bindgen` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3272](https://redirect.github.com/microsoft/windows-rs/pull/3272)
- Exclude `web` on most workflows by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3279](https://redirect.github.com/microsoft/windows-rs/pull/3279)
- Bump serve-static and express in /web/features by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3274](https://redirect.github.com/microsoft/windows-rs/pull/3274)
- Update jsonschema requirement from 0.18 to 0.19 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/microsoft/windows-rs/pull/3283](https://redirect.github.com/microsoft/windows-rs/pull/3283)
- Move `VARIANT` support to the `windows` crate by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3282](https://redirect.github.com/microsoft/windows-rs/pull/3282)
- Update `jsonschema` dependency by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3286](https://redirect.github.com/microsoft/windows-rs/pull/3286)
- Expand `raw-dylib` testing by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3287](https://redirect.github.com/microsoft/windows-rs/pull/3287)
- Fix for `cppwinrt` concurrency issue by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3289](https://redirect.github.com/microsoft/windows-rs/pull/3289)
- Address Rust nightly compiler warnings by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3292](https://redirect.github.com/microsoft/windows-rs/pull/3292)
- Add `Deref` implementation for `HSTRING` by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3291](https://redirect.github.com/microsoft/windows-rs/pull/3291)
- Release 0.60.0 by
[@&#8203;kennykerr](https://redirect.github.com/kennykerr) in
[https://github.com/microsoft/windows-rs/pull/3293](https://redirect.github.com/microsoft/windows-rs/pull/3293)

#### New Contributors

- [@&#8203;lifers](https://redirect.github.com/lifers) made their first
contribution in
[https://github.com/microsoft/windows-rs/pull/3198](https://redirect.github.com/microsoft/windows-rs/pull/3198)

**Full Changelog**:
https://github.com/microsoft/windows-rs/compare/0.59.0...0.60.0

</details>

---

### 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI1Ny4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: konstin <konstin@mailbox.org>
2025-04-28 13:36:29 +02:00
konsti b33a19689c
Optional managed Python archive download cache (#12175)
Part of #11834

Currently, all Python installation are a streaming download-and-extract.
With this PR, we add the `UV_PYTHON_CACHE_DIR` variable. When set, the
installation is split into downloading the interpreter into
`UV_PYTHON_CACHE_DIR` and extracting it there from a second step. If the
archive is already present in `UV_PYTHON_CACHE_DIR`, we skip the
download.

The feature can be used to speed up tests and CI. Locally for me, `cargo
test -p uv -- python_install` goes from 43s to 7s (1,7s in release mode)
when setting `UV_PYTHON_CACHE_DIR`. It can also be used for offline
installation of Python interpreter, by copying the archives to a
directory in the offline machine, while the path rewriting is still
performed on the target machine on installation.
2025-04-28 12:09:09 +02:00
John Mumm 4ee4a8861e
Implement RFC 7231 compliant relative URI and fragment handling in redirects (#13050)
This PR restores #13041 and integrates two PRs from @zanieb:
* #13038
* #13040

It also adds tests for relative URI and fragment handling.

Closes #13037.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-04-28 09:07:06 +02:00
Charlie Marsh dc5b3762f3
Show tag hints when failing to find a compatible wheel in `pylock.toml` (#13136)
## Summary

Closes #13135.
2025-04-27 12:56:50 -04:00
Charlie Marsh 78756de027
Respect build options (`--no-binary` et al) in `pylock.toml` (#13134)
## Summary

Closes #13133.
2025-04-27 12:28:30 -04:00
Charlie Marsh 17b4ebed8e
Avoid erroring on omitted wheel-only packages in `pylock.toml` (#13132)
## Summary

Closes https://github.com/astral-sh/uv/issues/13127.
2025-04-27 11:58:20 -04:00
ReinforcedKnowledge 1b23035703
Add pylock.toml mentions where relevant (#13115)
Just a small PR to add mentions to `pylock.toml` in the CLI manual where
appropriate.

I tried to say "PEP-751 compatible lock files" when appropriate to also
include the case `r"^pylock\.([^.]+)\.toml$"`. Feel free to change that
if you think it's cluttery.

I also tried to include the "single-use" wording when it made sense.

I also have almost never used the `uv pip` interface, so maybe there are
some other minor things to add here and there about the usage of
`pylock.toml` that I missed.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-04-26 14:26:30 +00:00
Zanie Blue fb08116800
Report Python versions in `pyvenv.cfg` version mismatch (#13027)
When working on #13025 I noticed this message was lacking versions,
which seems frustrating if you're debugging things.

I refactored the general `matches_interpreter` utilities that were added
in https://github.com/astral-sh/uv/pull/12884 into a more purpose-fit
function that returns an `Option` with the versions if there's a
mismatch.
2025-04-25 18:06:46 +00:00
Charlie Marsh 8414e9f3dd
Bump version to v0.6.17 (#13110) 2025-04-25 12:57:07 -05:00
konsti 09129031a4
Fix panic with invalid last char in PEP 508 name (#13105)
Fixes #13102
2025-04-25 14:56:46 +02:00
konsti ae5c77c0e4
Reject requires python even if not listed on the index page (#13086)
Reject distributions with an incompatible `Requires-Python`, even if the
index page is missing `data-requires-python`.

Fixes #13079
2025-04-25 12:52:02 +02:00
konsti cd7621043e
Block scripts from overwriting `python` (#13051)
uv adds some binaries and scripts to a venv, and installed packages
should not be allowed to overwrite them.

Fixes #12983
2025-04-25 07:10:10 +00:00
John Mumm 9fb19cd43c
Check for mismatched package and distribution names on resolver thread (#13088)
This PR restores the `bogus_redirect` test that was
non-deterministically hanging (reverting #13076).

Mismatched package and distribution names were causing uv to hang prior
to #12917 (which added the `bogus_redirect` test). But with that fix, uv
was only checking for mismatched package names on the main thread (and
not the resolver thread). This allowed for a race condition which would
prevent uv from ever doing the check, triggering the original hang
condition. This PR adds the check to the resolver thread to prevent this
race condition.
2025-04-24 15:18:01 +02:00
Charlie Marsh a4ea814159
Avoid panic for invalid Python versions (#13077)
## Summary

We unwrap these further on, so we should validate them ahead of time.

Closes https://github.com/astral-sh/uv/issues/13075.
2025-04-23 22:23:33 +00:00
Charlie Marsh a6a0087f74
Temporarily remove bogus redirect test (#13076)
## Summary

This needs to be made more reliable.
2025-04-23 17:18:31 -04:00
Charlie Marsh 4bef9fadbb
Add PyTorch v2.7.0 to GPU backend (#13072)
## Summary

The first version to support CUDA 12.8.
2025-04-23 16:59:41 -04:00
konsti 473d7c75a4
Check dist name to handle bogus redirect (#12917)
When an index performs a bogus redirect or otherwise returns a different
distribution name than expected, uv currently hangs.

In the example case, requesting the simple index page for any package
returns the page for anyio. This mean querying the sniffio version map
returns only anyio entries, and the version maps resolves to an anyio
version. When the resolver makes a query for sniffio and waits for it to
resolve, the main thread finds an anyio and resolves only that in the
wait map, causing the hang.

We fix this by checking the name of the returned distribution against
the name of the requested distribution. For good measure, we add the
same check in `Request::Dist` and `Request::Installed`. For performance
and complexity reasons, we don't perform this check in the version map
itself, but only after a candidate distribution has been selected.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
2025-04-22 15:36:27 +00:00
Ben Beasley 45910eb6d1
Fix several occurrences of the phrase “This options” (#13053)
## Summary

Fixes several occurrences of the minor typo “This options” for “This
option.”
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
Since this is just a typo fix in documentation and comment strings, no
particular testing was conducted.

## Notes

The typo fixes in `crates/uv-cli/src/lib.rs` would affect
`docs/reference/cli.md`. I assumed you might want to just re-generate
the reference documention, but fixing it up manually would look like:

```diff
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index 338fa0ff9..8851ca2c0 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -355,7 +355,7 @@ uv run [OPTIONS] [COMMAND]
 
 </dd><dt id="uv-run--no-group"><a href="#uv-run--no-group"><code>--no-group</code></a> <i>no-group</i></dt><dd><p>Disable the specified dependency group.</p>
 
-<p>This options always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
+<p>This option always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
 
 <p>May be provided multiple times.</p>
 
@@ -1757,7 +1757,7 @@ uv sync [OPTIONS]
 
 </dd><dt id="uv-sync--no-group"><a href="#uv-sync--no-group"><code>--no-group</code></a> <i>no-group</i></dt><dd><p>Disable the specified dependency group.</p>
 
-<p>This options always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
+<p>This option always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
 
 <p>May be provided multiple times.</p>
 
@@ -2492,7 +2492,7 @@ uv export [OPTIONS]
 
 </dd><dt id="uv-export--no-group"><a href="#uv-export--no-group"><code>--no-group</code></a> <i>no-group</i></dt><dd><p>Disable the specified dependency group.</p>
 
-<p>This options always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
+<p>This option always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
 
 <p>May be provided multiple times.</p>
 
@@ -2855,7 +2855,7 @@ uv tree [OPTIONS]
 
 </dd><dt id="uv-tree--no-group"><a href="#uv-tree--no-group"><code>--no-group</code></a> <i>no-group</i></dt><dd><p>Disable the specified dependency group.</p>
 
-<p>This options always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
+<p>This option always takes precedence over default groups, <code>--all-groups</code>, and <code>--group</code>.</p>
 
 <p>May be provided multiple times.</p>
 
```
2025-04-22 09:20:00 -04:00
Michał Górny 41727cbc54
Support using `uv build-backend` in the Python backend (#13049)
<!--
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

Provide an in-code switch to permit using the `uv build-backend` command
rather than the default `uv-build` in the Python PEP517 backend. This
option is intended to be used by downstream packagers to provide an
option of reusing `uv` that was built already instead of having to build
a second `uv-build` executable that largely overlaps with `uv`.

Fixes #12389

## Test Plan

The option is intended for downstream consumption only, and it is tested
downstream (via attempting to build a package using the `uv_build`
backend). The backend itself is covered by tests already.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-04-22 13:46:42 +02:00
konsti 7807e64357
Apply context filter to PEP 751 tests (#13047)
Filter out the Python patch version from `pylock.toml` exports.

Fixes #13039
2025-04-22 08:43:24 +00:00
Zanie Blue d8ad9d3cd6
Bump verison to 0.6.16 (#13042)
Includes #13041 

Also reverts https://github.com/astral-sh/uv/pull/13036
2025-04-22 03:53:08 +00:00
Zanie Blue 534953290b
Revert "Properly handle authentication for 302 redirect URLs" (#13041)
This reverts commit 17ed789edb / #12920 

There's a regression reported in
https://github.com/astral-sh/uv/issues/13037 and it looks like we're
missing some important parts per #13040
2025-04-22 03:40:42 +00:00
Zanie Blue e2f400adbe
Bump version to 0.6.15 (#13034)
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-04-22 00:03:33 +00:00
Charlie Marsh 12bfbed0ec
Omit PEP 751 version for source trees (#13030)
## Summary

This is a "MUST NOT" in the spec.
2025-04-21 22:58:39 +00:00
Charlie Marsh 6130524585
Clean up TOML-to-Jiff conversion (#13028)
## Summary

Based on some feedback from the Jiff author (@BurntSushi).
2025-04-21 22:49:42 +00:00
Charlie Marsh 2ba4edfbbe
Add PEP 751 support to `uv pip compile` (#13019)
## Summary

You now specify `--format pylock.toml` or `-o pylock.toml` to output in
PEP 751 format.
2025-04-21 22:48:54 +00:00
Zanie Blue b594c2d702
Add test case for `uv python list` downloads (#12381)
Requires #12380 
Extends new tests from #12374 

Is waiting for dependent PRs to merge; for early review see
a27c93e3b6
2025-04-21 22:24:55 +00:00
Charlie Marsh ffcd5eb14f
Validate that PEP 751 entries don't include multiple sources (#12993)
## Summary

The spec defines these as mutually exclusive, so we now error when
trying to install such a package.
2025-04-21 22:22:03 +00:00
Zanie Blue cda72b297f
Refactor environment validity check into separate function (#13025)
Now, we can use early returns! Pulled out of
https://github.com/astral-sh/uv/pull/7934, where we're adding more logic
here.
2025-04-21 22:17:50 +00:00
Charlie Marsh e089c42e43
Add `pylock.toml` to `uv pip install` and `uv pip sync` (#12992)
## Summary

We accept `pylock.toml` as a requirements file (e.g., `uv sync
pylock.toml` or `uv pip install -r pylock.toml`). When you provide a
`pylock.toml` file, we don't allow you to provide other requirements, or
constraints, etc. And you can only provide one `pylock.toml` file, not
multiple.

We might want to remove this from `uv pip install` for now, since `pip`
may end up with a different interface (whereas `uv pip sync` is already
specific to uv), and most of the arguments aren't applicable (like
`--resolution`, etc.). Regardless, it's behind `--preview` for both
commands.
2025-04-21 22:10:30 +00:00
Charlie Marsh 1c3706c4ef
Infer output type in `uv export` (#12958)
## Summary

If the user provides a `.toml` file, we assume PEP 751; otherwise, we
assume `requirements.txt`.
2025-04-21 21:35:04 +00:00
Charlie Marsh d8cea2fd49
Add `uv export` support for PEP 751 (#12955)
## Summary

This PR adds `uv export` support for [PEP
751](https://peps.python.org/pep-0751). We don't yet expose a way to
consume the generated lockfile, but it's a first step.

The logic to go from `uv.lock` to "flat set of packages to include, with
markers telling us when to include them" is all shared with the
`requirements.txt` export (and extracted in
https://github.com/astral-sh/uv/pull/12956). So most of the code is just
converting from our internal types to the PEP 751 schema.
2025-04-21 21:21:17 +00:00
Zanie Blue 9484e3663c
Prefer stable releases over pre-releases in `uv python install` (#12194)
e.g., `uv python install 3` should not install the 3.14 alpha

Closes #12184
2025-04-21 21:16:07 +00:00
Zanie Blue c55dd0f295
Add a brief sleep before sending SIGINT to children (#13018)
In an attempt to avoid interrupting the child if it is in the process of
exiting.

This resolves the issue with marimo reported in
https://github.com/astral-sh/uv/issues/12108#issuecomment-2745933178 and
https://github.com/marimo-team/marimo/issues/4224
2025-04-21 14:47:39 -05:00
Zanie Blue 8717fbe469
Forward additional signals to the child process in `uv run` (#13017)
As I suspected quite some time ago
(https://github.com/astral-sh/uv/pull/6738#issuecomment-2315466033),
it's problematic that we don't handle _every_ signal here. This PR adds
handling for all of the Unix signals except `SIGCHLD`, `SIGIO`, and
`SIGPOLL` which seem incorrect to forward. Also notable, we _cannot_
handle `SIGKILL` so if someone sends that to the PID instead of the
PGID, they will leave dangling subprocesses.

Instead, we could use `exec` and avoid this handling. However, we'd lose
the ability to add nice error message on failure (e.g., as someone is
trying to add in https://github.com/astral-sh/uv/pull/12201) and, more
critically, we'd need to figure out how to clean up resources properly
(i.e., temporary directories) which currently happens on `Drop`. In the
long-term, we'll probably want an option to use `exec` — but we'll need
to figure out when to clean up resources or accept that they will
dangle. This was last discussed in
https://github.com/astral-sh/uv/issues/3095 — discussion on that
approach should continue there.

A note on the implementation: I spent time time trying to write the
handler using a tokio stream, so we could dynamically iterate over a
list of signals instead of copy/pasting the implementation — I couldn't
get it to work though and it didn't seem critical.

Closes https://github.com/astral-sh/uv/issues/12830
2025-04-21 14:47:30 -05:00
Jo 2cb998847c
Fix `SourceNotAllowed` error message (#13012)
## Summary

Before:

```console
$ uv python list py --managed-python
error: Interpreter discovery for `executable name `py`` requires `search path` but only only managed is allowed
```

After:

```console
$ uv python list py --managed-python
error: Interpreter discovery for `executable name `py`` requires `search path` but only `only managed` is allowed
```
2025-04-21 08:29:45 -04:00
konsti da09ece8a9
Build backend: Add reference docs and schema (#12803)
Add reference documentation and schema integration for the uv build
backend. The reference documentation comes with a preview note upfront.
2025-04-21 12:27:49 +02:00
konsti 2b96dbdd49
Refactor adding bounds to dependencies in `pyproject.toml` (#12945)
Preparation work for making the kind of bound added configurable.

No functional changes, just moving some methods around.
2025-04-21 12:25:27 +02:00
Max Mynter 2608f742b2
Allow updating Git sources by name (#12897)
Closes: #4567

## Summary

When adding a package with Git reference options (`--rev`, `--tag`,
`--branch`) that already has a Git source defined, use the existing Git
URL with the new reference instead of reporting an error.

This allows commands like `uv add requests --branch main` to work when
requests is already defined with a Git source in the project
configuration.

Previously, you would need to provide the whole Git url again for this
to work:
```bash
uv add git+https://github.com/psf/requests --branch main
```
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
- [x] Add unit tests for project
- [x] Add unit tests for script
- [x] Tested locally for project and script environments like below

### Testing Project
In a directory using the `uv` executable from this PR (via replacing
every `uv` with `cargo run --`) initialize a project and virtual
environment
```bash
uv init
uv venv
```
move into the environment 
```bash
# on mac
source .venv/bin/activate
```
and add a dependency with a git url
```bash
uv add git+https://github.com/Textualize/rich --branch master
```
Then change the branch of the project to see that the branch can be
changed without need of the whole git url:
```bash
uv add rich --branch py310
```

### Testing Script
Create the following file, e.g. `script.py`:
```python
import time
from rich.progress import track

print("Starting")
for i in track(range(20), description="For example:"):
    time.sleep(0.05)
print("Done")
```
Now using `uv` (referencing the executable of this PR) add the
dependency
```bash
uv add --script script.py 'git+https://github.com/Textualize/rich' --branch master
```
and check we can execute the script:
```bash
uv run script.py
```
To test the change update the branch

```bash
uv add --script script.py rich --branch py310
```
and check that the dependency is updated and the script is executed:
```bash
uv run script.py
```

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

----
This is my first time contributing to `uv` (yay, 🤗) so let me know if
there is something obvious i am missing.
Unit tests will follow soon.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-04-21 02:58:38 +00:00
Charlie Marsh 132307b67c
Add upload time to `uv.lock` (#12968)
## Summary

This is included in PEP 751, so we lose it when converting from
`uv.lock`. I think it's a good piece of information to include in the
`uv.lock` anyway.
2025-04-20 21:58:12 -04:00
John Mumm e9e4ad4d7d
Obfuscate username in tracing URL (#12969)
A URL username can be a secret token, so we should avoid logging it.
2025-04-19 11:11:41 +02:00
John Mumm ea16fe28b6
Obfuscate password in credentials debug messages (#12944)
I noticed in the trace output that we weren't obfuscating the
`Credentials` password in a trace message. This PR creates a `Password`
newtype with a custom `Debug` implementation.
2025-04-19 00:01:11 +02:00
Zanie Blue 41ac6649d7
Add debug logs for version file search (#12951)
Co-authored-by: John Mumm <jtfmumm@gmail.com>
2025-04-18 16:31:52 +00:00
Zanie Blue 91410acf82
Fix `PythonDownloadRequest` parsing for partial keys (#12925)
In #12909, I noticed we failed to parse partial download keys with `any`
placeholders. Here, parsing for that is fixed.
2025-04-18 11:25:52 -05:00
Charlie Marsh 6eb6475afd
Add `subdirectory` to Direct URL for local directories (#12971)
## Summary

This is allowed by the spec, even though we don't have a use for it.
2025-04-18 11:57:58 -04:00
johnthagen 3d340e83b7
Improve formatting for `"all"` `default-groups` setting documentation (#12963)
## Summary

Make the documentation for `"all"` `defauilt-groups` a little easier to
read by monospacing the literal.
2025-04-18 11:34:39 -04:00
John Mumm 17ed789edb
Properly handle authentication for 302 redirect URLs (#12920)
uv was failing to authenticate on 302 redirects when credentials were
available. This was because it was relying on `reqwest_middleware`'s
default redirect behavior which bypasses the middleware pipeline when
trying the redirect request (and hence bypasses our authentication
middleware). This PR updates uv to retrigger the middleware pipeline
when handling a 302 redirect, correctly using credentials from the URL,
the keyring, or `.netrc`.

Closes #5595
Closes #11097
2025-04-18 14:56:17 +02:00
Charlie Marsh 256b100a9e
Accept `requirements.txt` (verbatim) as a format on the CLI (#12957)
## Summary

Right now, you have to do `--format requirements-txt`, which seems
confusing? We now accept both `requirements.txt` and `requirements-txt`.
2025-04-18 03:18:53 +00:00
Charlie Marsh 784510becc
Separate `requirements.txt` export logic from graph construction (#12956)
## Summary

A standalone, preparatory refactor for
https://github.com/astral-sh/uv/pull/12955.
2025-04-17 23:10:03 -04:00
Alex Prengère 451c834ebb
Show PyPy downloads during `uv python list` (#12915)
Fixes #12914.
When `PythonDownloadRequest` does not have the `implementation` set, do
not set it to CPython when calling `fill`, otherwise only CPython
interpreters are shown when listing interpreters available for download,
with `uv python list`.
2025-04-17 11:59:13 -05:00
Dheepak Krishnamurthy 89b221d72b
fix(ui): update version formatting to use cyan color (#12943)
## Summary

This PR simplifies the version formatting by replacing `.white()` with
`.cyan()` styling for consistency.

Resolves #12940 

## Test Plan

I manually recreated the code and tested it with this patch:

```diff
diff --git i/crates/uv/src/lib.rs w/crates/uv/src/lib.rs
index b9c01b002..cf051351f 100644
--- i/crates/uv/src/lib.rs
+++ w/crates/uv/src/lib.rs
@@ -1019,6 +1019,20 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
         }) => commands::self_update(target_version, token, printer).await,
         #[cfg(not(feature = "self-update"))]
         Commands::Self_(_) => {
+            eprintln!("{}: {}", "error".cyan().bold(), "fake error message");
+
+            let version_information = format!(
+                "from {} to {}",
+                "v0.1.1".bold().cyan(),
+                "v0.1.2".bold().cyan(),
+            );
+            eprintln!(
+                "{}{} Upgraded uv {}! {}",
+                "success".green().bold(),
+                ":".bold(),
+                version_information,
+                format!("https://github.com/astral-sh/uv/releases/tag/{}", "v0.1.2").cyan()
+            );
             anyhow::bail!(
                 "uv was installed through an external package manager, and self-update \
                 is not available. Please use your package manager to update uv."
```

In a light terminal, this is what it looks like:

<img width="750" alt="image"
src="https://github.com/user-attachments/assets/dc0d283c-e845-41fb-9821-80b0a3f1c4fe"
/>
2025-04-17 12:58:36 -04:00
Max Mynter ebb45bdba1
Align supported Config-settings with example in docs (#12947)
Closes #12929
## Summary
Untag the `config-settings` value to support JSON schema according to
the
[docs](https://docs.astral.sh/uv/reference/settings/#config-settings).
```toml
[tool.uv]
config-settings = { editable_mode = "compat" }
```
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
Verified using the "Even Better TOML" extension with paths to old and
new `uv.schema.json`.


## Notes
I could not reproduce the issue with either the `taplo` (on which Even
Better Toml is built, afaik) and `check-jsonschema` CLI tools; with both
old and new versions of the `uv.schema.json` validated the
`pyproject.toml`.

Maybe for these there is some additional regularization going on and
that's also how a breaking case ended up in the docs?
I'm unsure on how to test for this.

After about an hour, the Even better TOML VSCode extension was the only
way to reproduce failing validation.

Let me know if I can do something else.

<!-- How was it tested? -->
2025-04-17 12:57:53 -04:00
konsti 37a71fd26a
Make `uv init` resilient against broken git (#12895)
Currently, `uv init` works without a `git` executable, and with a
working `git` executable, but not with a broken `git`, be it from GitHub
Action's Windows CI or from the shim we insert.

`uv init` calls git twice: Once `git rev-parse` to check whether a git
repo already exists, and then `git init` (if there is no git repository
yet and no `--vcs none`).

By separately handling the cases where git failed during `git rev-parse`
doesn't work vs. where the is no repository when checking for an
existing repo work tree, we can avoid calling `git init` for broken git
and erroring. We have to hardcode the expected git command outputs to be
able to check.
2025-04-17 17:45:25 +02:00
John Mumm 211e712b83
Add test for install from remote requirements.txt (#12941)
Closes #2593.
2025-04-17 16:25:37 +02:00
Aria Desires 041c7a5e63
Use suffix on uvx binary when searching for uv binary (#12923)
This is a rebased and updated version of #11925 based on my review (I
didn't have permission to push to their branch).

For posterity I've preserved their commits but my final commit
essentially rewrites the whole thing anyway.

Fixes #11637

---------

Co-authored-by: Chris Lieb <clieb@bitsighttech.com>
2025-04-16 14:52:09 -04:00
Jo fc3dacf9a0
Improve docs for `uv python list --only-downloads` and `--only-installed` (#12916)
"Only show Python downloads, exclude installed distributions." might be
misunderstood as excluding installed distributions from `uv python list
--only-downloads`, implying that versions already installed won’t be
shown.
2025-04-16 10:51:47 -05:00
Zanie Blue e58cc39238
Patch `CC` and `CCX` entries in sysconfig for cross-compiled `aarch64` Python distributions (#12239)
Closes https://github.com/astral-sh/uv/issues/12207
2025-04-16 08:34:05 -05:00
konsti 4d34b28657
Set 4MB stack size for all threads, introduce `UV_STACK_SIZE` (#12839)
See #12769 for the motivation. We set the 4MB not only for the main
thread, but also for all tokio and rayon threads to fix a stack overflow
while unpacking wheels in production on Windows.

There are two variables for setting the stack size: A new
`UV_STACK_SIZE` that takes precedent, and the existing `RUST_MIN_STACK`.
When setting the stack size, `UV_STACK_SIZE` should be preferred, since
`RUST_MIN_STACK` affects all Rust applications, including build backends
we call (e.g., maturin). The minimum stack size is set to 1MB, the
lowest stack size we observed on a platform (Windows main thread).

Fixes #12769

## Test Plan

Tested manually with the example from #12769
2025-04-16 09:27:46 +02:00
Jo 8665c06225
Write requested python variant to pin file in `uv init` (#12870)
## Summary

Closes #12855

This PR also fixed an issue, where `python_request` was matched against
`PythonVersion::Default`. Previously, if `python_request` was `3.13t`,
it would match the last branch, triggering a download of the Python
version if it wasn't already installed.


6b7f60c1ea/crates/uv/src/commands/project/init.rs (L421-L448)

```console
❯ uv init -v --managed-python --python 3.13t foo
DEBUG uv 0.6.14 (a4cec56dc 2025-04-09)
DEBUG Searching for Python 3.13t in managed installations
DEBUG Searching for managed installations at `/Users/Jo/.local/share/uv/python`
DEBUG Found managed installation `cpython-3.13.1-macos-aarch64-none`
DEBUG Found `cpython-3.13.1-macos-aarch64-none` at `/Users/Jo/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/bin/python3.13` (managed installations)
DEBUG Skipping interpreter at `/Users/Jo/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/bin/python3.13` from managed installations: does not satisfy request `3.13t`
DEBUG Skipping incompatible managed installation `cpython-3.12.8-macos-aarch64-none`
DEBUG Skipping incompatible managed installation `pypy-3.11.11-macos-aarch64-none`
DEBUG Requested Python not found, checking for available download...
DEBUG Acquired lock for `/Users/Jo/.local/share/uv/python`
DEBUG Using request timeout of 30s
INFO Fetching requested Python...
Downloading cpython-3.13.3+freethreaded-macos-aarch64-none (49.9MiB)
DEBUG Downloading https://github.com/astral-sh/python-build-standalone/releases/download/20250409/cpython-3.13.3%2B20250409-aarch64-apple-darwin-freethreaded%2Bpgo%2Blto-full.tar.zst to temporary location: /Users/Jo/.local/share/uv/python/.temp/.tmpfoOLkE
DEBUG Extracting cpython-3.13.3%2B20250409-aarch64-apple-darwin-freethreaded%2Bpgo%2Blto-full.tar.zst
 Downloaded cpython-3.13.3+freethreaded-macos-aarch64-none
DEBUG Moving /Users/Jo/.local/share/uv/python/.temp/.tmpfoOLkE/python/install to /Users/Jo/.local/share/uv/python/cpython-3.13.3+freethreaded-macos-aarch64-none
DEBUG Released lock at `/Users/Jo/.local/share/uv/python/.lock`
DEBUG Writing Python versions to `/private/tmp/foo/.python-version`
Initialized project `foo` at `/private/tmp/foo`

❯ cat foo/.python-version
3.13
```

After this PR, uv will not try to download it:

```console
❯ uv python uninstall 3.13t
❯ cargo run -- init -v --managed-python --python 3.13t bar
DEBUG uv 0.6.14+15 (6b7f60c1e 2025-04-12)
DEBUG Writing Python versions to `/private/tmp/bar/.python-version`
Initialized project `bar` at `/private/tmp/bar`

❯ cat bar/.python_version
3.13t
```
2025-04-15 15:28:21 -05:00
John Mumm 278a136bcb
Ensure virtual environment is compatible with interpreter on sync (#12884)
It was possible that a virtual environment became out of sync with the
interpreter it pointed to (for example, if a symlink was changed to an
updated Python version). In such a case, `pyvenv.cfg` and
`activate_this.py` would no longer be correct. This PR detects when the
`version` (`venv` module) or `version_info` (uv and `virtualenv`) field
in `pyvenv.cfg` is out of sync with the interpreter. In such a case, uv
recreates the virtual environment.

Closes #12461
2025-04-15 12:01:14 +02:00
konsti 88cd7d619f
Cache `which git` in `uv init` (#12893)
Avoid running `which` multiple times, to be more coherent with the other
git code. In preparation of improving the `uv init` git handling.
2025-04-15 09:40:08 +00:00
konsti 30361e59c3
Remove `if if` (#12892)
Artifact from a clippy fix.
2025-04-15 09:16:00 +00:00
Aria Desires ff566a5006
make distability opt-in (#12885)
We have been claiming in our releases that we provide
archives/installers for uv-build, but we only upload it as a wheel to
pypi. This is because cargo-dist tries to be helpful and find all your
apps, but this scales poorly to large workspaces like ours, as stuff
like this slips in. So invert the default and make uv the only package
dist will see until we say otherwise.

See e.g. https://github.com/astral-sh/uv/releases/tag/0.6.14

Fixes #12883
2025-04-14 14:49:28 -04:00
Ahmed Ilyas c979d15e96
Respect build constraints for `uv run --with` dependencies (#12882)
## Summary

Closes #12505 

## Test Plan

`cargo test`
2025-04-14 12:53:17 -04:00
konsti 091ec62732
Fix tests on non-English Windows (#12878)
By default, unlike on CI, a Windows machine does not allow creating
symlinks, so we have to unix-gate tests that assume symlinks.

We can't install the transformers ecosystem test on Windows due to
missing torch, so it is also unix-gated.

Windows translates error messages, so we have to filter the "File not
found" message, since it can also be a "Datei nicht gefunden".
2025-04-14 15:50:55 +02:00
Ahmed Ilyas e4047e5888
Support build constraints in `uv tool` and PEP723 scripts. (#12842)
## Summary

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

## Test Plan

`cargo test`

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-04-14 09:26:57 -04:00
Christopher Tee 66df255a9c
Enable `--dry-run` with `--locked` / `--frozen` for `uv sync` (#12778)
## Summary
Closes #12687. 

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

## Test Plan

<!-- How was it tested? -->
Added the corresponding integration tests for:
- `uv sync --dry-run --locked`
  - [x] Preview lock changes
  - [x] Errors if lockfile is out-of-date
- `uv sync --dry-run --frozen`
  - [x] Preview lock changes

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2025-04-14 13:08:25 +00:00
renovate[bot] 291a13c276
Update Rust crate clap to v4.5.35 (#12699) 2025-04-14 12:35:41 +00:00
Michał Górny 2d340de2f8
Collapse whitespace in python_list tests (#12851)
## Summary

Collapse whitespace into a single space in python_list tests, in order
to make them agnostic of padding, and therefore pass both with Python
3.12.9 and Python 3.12.10.

Fixes #12799

## Test Plan
cargo test --features python --profile=fast-build --no-default-features
2025-04-14 08:23:10 -04:00
konsti b648980625
Address #12836 review comment (#12873)
Inline single use methods
2025-04-14 08:10:34 +00:00
renovate[bot] 2a02c600c8
Update Rust crate mimalloc to v0.1.46 (#12863)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [mimalloc](https://redirect.github.com/purpleprotocol/mimalloc_rust) |
dependencies | patch | `0.1.45` -> `0.1.46` |

---

### Release Notes

<details>
<summary>purpleprotocol/mimalloc_rust (mimalloc)</summary>

###
[`v0.1.46`](https://redirect.github.com/purpleprotocol/mimalloc_rust/releases/tag/v0.1.46):
Version 0.1.46

[Compare
Source](https://redirect.github.com/purpleprotocol/mimalloc_rust/compare/v0.1.45...v0.1.46)

##### Changes

-   Fixed musl builds.

</details>

---

### 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMzguMCIsInVwZGF0ZWRJblZlciI6IjM5LjIzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-14 10:10:12 +02:00
konsti 6b7f60c1ea
Fix pre-release exclusive comparison operator in uv-pep440 (#12836)
From PEP 440:

> The exclusive ordered comparison <V MUST NOT allow a pre-release of
the specified version unless the specified version is itself a
pre-release. Allowing pre-releases that are earlier than, but not equal
to a specific pre-release may be accomplished by using <V.rc1 or
similar.

We had an additional check that would block this even if the specifier
did have a pre-release.

This likely didn't show up earlier because `Ranges` uses different code
in the resolver.

I checked these changes against `packaging` to verify their behavior:

```python
print(SpecifierSet("<1").contains("1a1", prereleases=True)) # False
print(SpecifierSet("<1a2").contains("1a1", prereleases=True)) # True
print(SpecifierSet("<1").contains("1dev1", prereleases=True)) # False
print(SpecifierSet("<1dev2").contains("1dev1", prereleases=True)) # True
print(SpecifierSet("<1a2").contains("1dev1", prereleases=True)) # True
```

Closes #12834
2025-04-12 16:57:06 -04:00
Aria Desires dd788a0f47
Revert "feat: Error on dependency object specifier (#12811)" (#12840)
This reverts commit c117acf905.

This is a minor breaking change, to be relanded in 0.7.0.
2025-04-11 18:32:48 +00:00
Aria Desires 591bc34d84
display aliases for long and short args in the cli reference (#12824)
Fixes #12494

(I don't feel like showing it in long-help matters too much...)
2025-04-10 16:36:22 -05:00
Chandra Kiran G c117acf905
feat: Error on dependency object specifier (#12811)
## Summary

This PR errors out when an Unknown Dependency Object Specifier is used
in dependency groups.


Fixes #12638 

## Test Plan

The current behaviour is as follows:

```bash
➜  example git:(12638/dependency-object-specifier) ✗ cargo run -- sync
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
     Running `/home/luna/Documents/uv/target/debug/uv sync`
error: Failed to generate package metadata for `example==0.1.0 @ virtual+.`
  Caused by: Group `bar` contains a Dependency Object Specifier, which is not supported by uv
  ```


And the pyproject.toml to produce this is:

```toml
[project]
name = "example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13.2"
dependencies = []

[dependency-groups]
foo = ["pyparsing"]
bar = [{set-phasers-to = "stun"}]
```
2025-04-10 16:56:47 -04:00
Arthur Bied-Charreton 73fd0aedd1
Split UV_INDEX on all whitespace (#12820)
## Summary
Closes #12806

Split `UV_INDEX` by any whitespace rather than only ASCII 32, which does
not align with the behavior of `PIP_EXTRA_INDEX_URL` and can possibly
lead to difficulties when migrating from pip to uv.

Clap unfortunately does not support passing multiple delimiters, writing
a custom parsing function involved parsing index into a Vec<Vec<Index>>
and flattening it afterwards in order to avoid breaking the --index
command line option.

There might be a prettier solution I overlooked, let me know if there is
anything I should change!
2025-04-10 16:22:17 -04:00
Haaris Rahman ef68fca591
Add env arg UV_NO_EDITABLE (#12773)
<!--
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? -->

Adds the env arg `UV_NO_EDITABLE`.
Closes #12735 

## Test Plan

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


![image](https://github.com/user-attachments/assets/0bfde9e1-ce6e-4fcc-a8c2-0bf970c9aa9e)


I could not find a place where to add tests, any help would be
appreciated

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2025-04-10 15:56:07 -04:00
konsti 7a18e4429d
Fix CLI reference with code block (#12807)
Due to https://github.com/clap-rs/clap/issues/5900, clap folds docstring
code blocks in a way that breaks the rendering of the `uv publish
--index` option to html. As a workaround, `verbatim_doc_comment`
prevents this.


Release:

![image](https://github.com/user-attachments/assets/66d9af51-ac23-47f6-a859-7b20a4f1f4a2)

PR:

![image](https://github.com/user-attachments/assets/6a32a5a6-1dd8-49ff-a853-9df02f0141ad)


Release:
```
      --index <INDEX>
          The name of an index in the configuration to use for publishing.
          
          The index must have a `publish-url` setting, for example:
          
          ```toml [[tool.uv.index]] name = "pypi" url =
          "https://pypi.org/simple" publish-url =
          "https://upload.pypi.org/legacy/" ```
          
          The index `url` will be used to check for existing files to skip
          duplicate uploads.
          
          With these settings, the following two calls are equivalent:
          
          ``` uv publish --index pypi uv publish --publish-url
          https://upload.pypi.org/legacy/ --check-url https://pypi.org/simple
          ```
          
          [env: UV_PUBLISH_INDEX=]
```

PR:
```
      --index <INDEX>
          The name of an index in the configuration to use for publishing.
          
          The index must have a `publish-url` setting, for example:
          
          ```toml
          [[tool.uv.index]]
          name = "pypi"
          url = "https://pypi.org/simple"
          publish-url = "https://upload.pypi.org/legacy/"
          ```
          
          The index `url` will be used to check for existing files to skip
          duplicate uploads.
          
          With these settings, the following two calls are equivalent:
          
          ```shell
          uv publish --index pypi
          uv publish --publish-url https://upload.pypi.org/legacy/
          --check-url https://pypi.org/simple
          ```
          
          [env: UV_PUBLISH_INDEX=]
```	

Fixes #12652
2025-04-10 10:59:39 -05:00
Zanie Blue a4cec56dca
Bump to 0.6.14 (#12786) 2025-04-09 16:29:25 -05:00
github-actions[bot] 1099867681
Sync latest Python releases (#12784)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2025-04-09 12:32:00 -05:00
konsti a45ca9a36d
Build backend: Check module dir exists for sdist build (#12779)
Check that the source and module directory exist when build a source
distribution, instead of delaying the check to building the wheel. This
prevents building source distributions that can never be built into
wheels.
2025-04-09 15:47:01 +00:00
leiserfg 980599f4fa
Fix sdist with long directories (#12764)
I removed the `set_cksum` as the value of it is replaced inside of
`append_data`.

## Summary

This should fix #12762 but I don't know how to test it.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2025-04-09 13:01:21 +00:00
konsti 173d6f73d3
Add `uv-build` and `uv_build` aliases to `uv init --build-backend` (#12776)
This matches similar aliases for pdm/pdm-backend and hatch/hatchling.
2025-04-09 12:33:38 +00:00
Charlie Marsh d99983a630
Avoid querying GitHub on repeated install invocations (#12767)
## Summary

If you run `cargo run pip install "pip-test-package @
git+https://github.com/pypa/pip-test-package@5547fa909e83df8bd743d3978d6667497983a4b7"`
repeatedly, then every time, we'll take the "GitHub fast path" every
time, even if the package is already cached. This PR adds logic to skip
the fast path if the reference looks like a commit that we've already
checked out.

Closes https://github.com/astral-sh/uv/issues/12760.
2025-04-08 22:00:40 -04:00
Charlie Marsh 3ece75fc12
Error when `tool.uv.sources` is set in system-level configuration file (#12757)
## Summary

I think the lack of enforcement here is an oversight. We _do_ already
enforce this for user-level configuration files (contrary to the issue
-- at least, in my testing and from reading the code).

Closes https://github.com/astral-sh/uv/issues/12753.
2025-04-08 17:01:12 -04:00
Charlie Marsh 8a1967d299
Split workspace members onto their own lines in `uv init` (#12756)
## Summary

See the test cases. Previously, you could end up with something like:

```toml
[tool.uv.workspace]
members = [
    "foo",
    "bar",
    "baz", "bop",
]
```
2025-04-08 19:51:23 +00:00
Christopher Tee 7921667ced
Emit dedicated error message for Conda environment.yml files (#12669)
<!--
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 #12606.

Two options considered, thanks to @zanieb's guidance are:
1. Special-casing on parse error and encountering the `environment.yml`
filename, possibly at `RequirementsTxt::parse`
2. Adding a new `RequirementsSource::EnvironmentYml` variant and
erroring on `RequirementSpecification::from_source`

I went with the latter for the following reasons:
- This edge case is explicitly modelled within the type system. However,
it changes the semantics of `RequirementsSource` to also model
_unsupported_ sources.
- (**Separation of concerns**) The special-casing would occur in the
`uv-requirements-txt` crate, which seems to be relatively deep in the
guts of the codebase. In my opinion, maintainers working in
`uv-requirements-txt` would reasonably assume the input file to be a
`requirements.txt` file, instead of having to be concerned with it being
another file format (`environment.yml`, `pyproject.toml`, etc.)

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

## Test Plan
Manually tested as follows:
```sh
>>> cargo run -- pip install -r environment.yml
error: Conda environment file `environment.yml` is not supported

>>> cargo run -- add -r environment.yml
error: Conda environment file `environment.yml` is not supported
``` 

If you can point me to the appropriate test module, I can write up tests
for these to use `insta`.

<!-- How was it tested? -->
2025-04-07 18:11:43 -05:00
Zanie Blue 8ea34b56a1
Extend the reference documentation for `uv pip sync` (#12683)
See https://github.com/astral-sh/uv/issues/12680
2025-04-07 22:40:26 +00:00
Charlie Marsh a0f5c7250b
Avoid infinite loop in `uv export` with conflicts (#12726)
## Summary

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

Closes https://github.com/astral-sh/uv/issues/12719.
2025-04-07 19:10:58 +00:00
Zanie Blue 1cca93c099
Bump version to 0.6.13 (#12725) 2025-04-07 13:44:32 -05:00