Commit Graph

6275 Commits

Author SHA1 Message Date
Charlie Marsh 12caaf3160 Respect build constraints for workspace members (#18350)
## Summary

These are respected in `uv sync` and `uv pip install`, but not `uv
build`.

Closes https://github.com/astral-sh/uv/issues/18283
2026-03-06 16:53:07 +00:00
Zanie Blue 24e9b47900 Add fallback to /usr/lib/os-release on Linux (#18349) 2026-03-06 16:50:54 +00:00
Charlie Marsh 9dea237fca Revalidate editables and other dependencies in scripts (#18328)
## Summary

Lockfile re-validation was iterating from the workspace roots; but for
scripts, we have no roots! This is similar to the approach we use in `uv
tree`, `uv export`, etc.

Closes https://github.com/astral-sh/uv/issues/18312.
2026-03-06 11:46:07 -05:00
Zanie Blue 363aea27be Drop the sys-info dependency (#18324)
Part of https://github.com/astral-sh/uv/issues/14574 and
https://github.com/termux/termux-packages/issues/27547

Avoids the downstream patch at
https://github.com/termux/termux-packages/blob/master/packages/uv/0001-sys-info-replace-index-with-strchr.diff

`sys-info-rs` has not been updated in years
https://github.com/FillZpp/sys-info-rs — it includes C code and can't be
built on Termux https://github.com/FillZpp/sys-info-rs/issues/116

I considered switching to https://github.com/GuillaumeGomez/sysinfo but
our usage is trivial, so we implement our requirements in `uv-platform`
instead
2026-03-06 16:30:19 +00:00
konsti 401661ee22 Log the duration we took before erroring (#18231)
We previously errored due to not having long enough backoff, and there
were questions about how long the retries are, so let's log this on
failure.
2026-03-06 08:51:10 -06:00
Zanie Blue 8b82d17f44 Support Python 3.13+ on Android (#18301)
Python 3.13+ changed how it reports platform information on Android; see
https://peps.python.org/pep-0738/#architectures

Here we add support for the new platform values, without which uv will
fail due to an unrecognized interpreter.

Closes #18296
Closes #18285
Closes https://github.com/astral-sh/uv/issues/18313

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-06 07:42:21 -06:00
konsti 6055369bb1 Remove invisible unicode characters (#18344) 2026-03-06 14:27:57 +01:00
Charlie Marsh 5fc74a2357 Add fbgemm-gpu, fbgemm-gpu-genai, torchrec, and torchtune to the PyTorch list (#18338)
## Summary

Like #18336.
2026-03-06 07:27:35 -06:00
konsti 53c4a0925a Workspace refactoring rollup (#18308)
Three small refactorings pulled out of the toml optimization branch.
2026-03-06 10:37:41 +00:00
konsti 4a1028e78c Avoid toml Document overhead (#18306)
The difference is below the noise threshold, but it showed up in the
profiled. The code originally existed for error handling that has since
been removed.
2026-03-06 11:16:15 +01:00
Djordje 8616b11d59 Add torchcodec to PyTorch List (#18336)
<!--
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

torchcodec added
https://github.com/astral-sh/uv/issues/18335
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->
2026-03-05 19:11:38 -05:00
Alessandro Molina 6036575324 Handle the hard link limit gracefully instead of failing (#17699)
## Summary

Handle the case where too many hardlinks were created and thus
installing packages fails.

There are cases where the file system can have a hardlinks limit and
when it's hit `uv` fails,
for example AWS EFS that has a limit of 177 hard links (
https://docs.aws.amazon.com/efs/latest/ug/troubleshooting-efs-fileop-errors.html#hardlinkerror
)

This PR address this by resetting the hardlinks when the limit is
reached (it does this by replacing the file in the cache, so new
hardlinks can be made)

There can be race conditions over the limit, but those are ok, as the
links are reset atomically so in case of race conditions the worst case
will be that the limit is reset twice, but nothing will break.

## Test Plan

Add a `install_hardlink_after_emlink` function, it successfully
reproduced the issue on my system.
The issue is that it's expensive to run as it has to generate a lot of
hardlinks

---------

Co-authored-by: Tomasz Kramkowski <tom@astral.sh>
2026-03-05 23:43:34 +00:00
Charlie Marsh eec0c284d0 Add an environment variable for UV_VENV_RELOCATABLE (#18331)
Closes https://github.com/astral-sh/uv/issues/18319.
2026-03-05 18:40:39 -05:00
Charlie Marsh 9f53c5866f Add documentation for common marker values (#18327)
Closes https://github.com/astral-sh/uv/issues/18300.
2026-03-05 21:18:01 +00:00
Zanie Blue 91f02e29bb Add the uv-audit crate readme (#18325) 2026-03-05 19:44:21 +00:00
konsti 674fdffe4d Use a single global workspace cache (#18307)
Currently, uv parses each workspace member 's `pyproject.toml` in
airflow 4 times, this reduces it to 3 times.
2026-03-05 14:44:03 +01:00
konsti f18d279686 Add spans for toml reading (#18305)
In a warm cache situation, e.g. with `uv run`, toml parsing is by far
our slowest operation. These kinda hacky spans help debugging that. It
would be better if `toml::from_str` would be instrumented itself, but
this way we can add paths in the relevant places.
2026-03-05 14:43:52 +01:00
konsti 87b2539e80 Warn when using uv_build settings without uv_build (#15750)
To help with cases such as https://github.com/astral-sh/uv/issues/15655.

A question is when to show this warning. I've used sources as a proxy as
URL dependencies with enabled sources are likely those controlled by the
user, and they include workspace and `git clone`d path dependencies.

The first commit is a refactoring, the second commit the implementation.

Fixes https://github.com/astral-sh/uv/issues/15740
2026-03-05 06:56:35 -06:00
konsti 8efb5421bc Skip over broken tool Python on Windows too (#17176)
Fixes #16252
2026-03-05 10:02:49 +01:00
konsti bfcccc4be4 Support cp3-none-any (#17064)
According to
https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/,
`cp3-none-any` is a valid tag, even though you shouldn't use it. We
should accept it.

Part of https://github.com/astral-sh/uv/issues/17063
2026-03-04 20:45:34 +00:00
Zanie Blue 8ed803e507 Continue on trampoline job assignment failures (#18291)
A simpler short-term fix for https://github.com/astral-sh/uv/pull/18170

It's unclear if the complexity of that pull request is worth it.
2026-03-04 13:47:05 -06:00
konsti 2db251d454 Fix ssl_env_var test delay (#18289)
The test took >20s, usually being the last to run.
2026-03-04 12:18:23 -06:00
konsti 6ddcbbf700 Make ProjectWorkspace::from_project private (#18288)
Makes it easier to normalize paths exactly once.
2026-03-04 15:08:37 +01:00
Mitchell Berendhuysen d58915e8b3 Replace remove_dir_all with remove_virtualenv (#16203)
## Summary

Replace `remove_dir_all` with `remove_virtualenv` for the tool environment creation code path.

Closes #14985

## Test Plan

Relied on existing test coverage.

---------

Co-authored-by: Tomasz Kramkowski <tomasz@kramkow.ski>
2026-03-04 13:30:33 +00:00
github-actions[bot] 379f056aff Sync latest Python releases (#18282)
Automated update for Python releases.

Co-authored-by: zanieb <2586601+zanieb@users.noreply.github.com>
2026-03-03 20:23:27 -06:00
Zanie Blue c021be36ab Bump version to 0.10.8 (#18277) 2026-03-03 15:08:03 -06:00
Zanie Blue de60ad5b98 Use latest Python version filtering in more places (#18273)
Add `with_filtered_latest_python_versions()` to tests that were using
hardcoded patch versions for latest Python releases. This makes the
tests resilient to Python version bumps by using `[LATEST]` placeholders
instead of specific version numbers like `3.12.12` or `3.10.19`.

Also use `LATEST_PYTHON_3_12` constant for constructing directory paths
in the build version upgrade tests.
2026-03-03 18:19:29 +00:00
konsti 55cbe85d74 Unify poetry check types (#18260)
Found this duplication when looking at the toml parsing code.
2026-03-03 12:13:01 -06:00
Denizhan Dakılır 810072dd62 fix: uv tree orphaned roots and premature deduplication (#17212)
<!--
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

will close https://github.com/astral-sh/uv/issues/17160

Basically, old code using nodes with no incoming edges included
transitive deps which resulted in orphaned roots. We didnt actually need
that code as well, infinite cycle handling was done in `fn visit`
correctly so just using root node directly solves the issue. I also
found another bug during the process where packages were marked as
"visited" prematurely resulting in not even expanding them and not
showing them at the tree.

## Test Plan

I added two tests with snapshots.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2026-03-03 17:37:54 +00:00
github-actions[bot] 36955f7527 Sync latest Python releases (#18268)
Automated update for Python releases.

Co-authored-by: zsol <66740+zsol@users.noreply.github.com>
2026-03-03 17:36:38 +00:00
Charlie Marsh 06933d2af0 Respect exclusions in scripts (#18269)
## Summary

See: https://github.com/astral-sh/uv/pull/18022#discussion_r2809756319.
2026-03-03 17:20:57 +00:00
Brad Cowie 753ad06fe5 Prevent uv tool upgrade from installing excluded dependencies (#18022)
## Summary

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

Fixes #18021

Store dependencies excluded by uv tool install in the tool receipt and
provide these same dependencies to the requirements resolver when the
tool is upgraded.

## Test Plan

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

Running the repro commands provided in issue #18021, we can see the
excluded dependency does not get reinstalled when the tool is upgraded:

```sh
$ cat /tmp/excludes.txt
markdown-it-py

$ ~/Dev/uv/target/debug/uv install --excludes /tmp/excludes.txt 2048-cli==1.0.2
Resolved 7 packages in 150ms
Installed 7 packages in 56ms
 + 2048-cli==1.0.2
 + click==8.3.1
 + maturin==1.12.0
 + numpy==2.4.2
 + pygments==2.19.2
 + rich==13.9.4
 + rich-menu==0.3.0
Installed 1 executable: 2048-cli

$ cat ~/.local/share/uv/tools/2048-cli/uv-receipt.toml
[tool]
requirements = [{ name = "2048-cli" }]
excludes = ["markdown-it-py"]
entrypoints = [
    { name = "2048-cli", install-path = "/home/brad/.local/bin/2048-cli", from = "2048-cli" },
]

$ ~/Dev/uv/target/debug/uv tool upgrade 2048-cli
Updated 2048-cli v1.0.2 -> v1.0.3
 - 2048-cli==1.0.2
 + 2048-cli==1.0.3
Installed 1 executable: 2048-cli
```

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2026-03-03 17:06:35 +00:00
William Woodruff 02e804e920 Scaffolding for uv audit (#18119)
## Summary

This provides the scaffolding (CLI and initial `uv-audit` crate) for a
`uv audit` subcommand.

Closes #9189.

Tracking:

- [x] Core CLI scaffolding (this PR)
    - [x] #18185 
- [x] Audit core (probably a new `uv-audit` crate): #18124 
- [ ] Bulk dependency audits with OSV
- [ ] Result presentation
    - [ ] #18193 


Things that also need to be done with the MVP:

- [ ] We should not audit workspace members by default (by definition,
they don't exist on indices and therefore don't have meaningful results
from vulnerability services).
- [ ] I need to ensure groups/etc. are being filtered by correctly,
right now we audit every single package in the lockfile unconditionally.

## Test Plan

Unit and integration tests commensurate with the new functionality.

---------

Signed-off-by: William Woodruff <william@astral.sh>
2026-03-03 11:11:37 -05:00
Zsolt Dollenstein ce4b9a410a Fetch CPython from an Astral mirror by default (#18207) 2026-03-03 07:02:09 -05:00
Charlie Marsh 34b7734324 Promote authentication policy when saving tool receipts (#18246)
## Summary

If the user provides credentials for an index URL during tool install,
we strip the credentials. However, we now store the authentication
policy as `always` to ensure that if the user attempts to upgrade, and
we can't query the index, we correctly fail.

This won't cover credentials provided via keyring, but it will cover
embedded credentials and environment variables.

Closes https://github.com/astral-sh/uv/issues/18120.
2026-03-02 16:33:24 -06:00
Connor McCarthy acccaf8913 fix(pip-compile): respect constraints during --upgrade (#18226)
## Summary

[`pip-compile`] (jazzband) has the following semantics when invoked with
both `--upgrade` and `--upgrade-package={pkg}{constraint}`: upgrade all
packages WHILE abiding by the constraints provided.

Currently, `uv` ignores the additional constraints, merging `--upgrade`
and `--upgrade-package` simply as `--upgrade`, which is obviously a
divergence in behavior. This leads to specific package constraints being
ignored, even when explicitly provided. When I went to look at patching
this, I noticed an open TODO around the same behavior in the
`--no-upgrade` case.

As a solution, separate the `UpgradeStrategy` from the constraints
provided, allowing for a more graceful merge.

[`pip-compile`]: https://github.com/jazzband/pip-tools

I've created an issue to track this here:
https://github.com/astral-sh/uv/issues/18225

## Test Plan

I've added a few integration tests to cover this case (including
updating the negative test that existed), and updated the relevant
snapshots.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2026-03-02 08:40:48 -06:00
konsti 54361e6d9f Remove superfluous Cow (#18245) 2026-03-02 12:08:37 +01:00
konsti 3ecb77b199 Normalize inline snapshots (#18183)
I recreated all insta snapshots to reduce the churn in future PRs.

```
cargo insta test --force-update-snapshots --test-runner nextest
```
2026-03-02 10:01:38 +00:00
konsti 876a7cc3d7 Extend uv_build direct build compatibility (#17902)
uv 0.10 can use direct builds for uv_build with `<0.10`, there were no
breaking changes.

This PR also revamps the direct build detection to be more sensitive and
improves the errors messages.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
2026-03-02 10:48:56 +01:00
konsti 7c638055c8 Strip trailing whitespace from tool_install_uninstallable (#18184)
Avoid churn in this file when IDEs remove the trailing whitespace while
the snapshot contains. This single space looks like a typo in the pyenv
placeholder package.

Alternative to https://github.com/astral-sh/uv/pull/18182.
2026-03-02 10:46:50 +01:00
Chiranjeevi U 905d97dc82 Skip installed Python check for URL dependencies (#18211)
## Summary

Skip the installed Python version check when resolving URL dependencies.
Such checks are already skipped for registry dependencies.

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

---------

Signed-off-by: Chiranjeevi U <244287281+chiranjeevi-max@users.noreply.github.com>
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2026-03-01 20:38:17 +00:00
konsti deb70839b8 Configure a real retry minimum of 1s (#18201)
By default, retry-policies compute the actual retry duration as
`min_retry_interval * (base ** n_past_retries) * rng.uniform(0.0, 1.0)`,
so the first sleep duration would be between 0s and 1s. This change
bumps this to a real 1s minimum.
2026-03-01 16:34:20 +01:00
Charlie Marsh 548b29ffc3 Retain default-branch Git SHAs in pylock.toml files (#18227)
## Summary

If no revision is specified, we should assume the input used the default
branch (rather than returning early and ignoring the existing SHA).

Closes https://github.com/astral-sh/uv/issues/18224.
2026-02-28 20:50:11 -05:00
liam ef1045668c Add UV_INIT_BARE environment variable for uv init (#18210)
Resolves https://github.com/astral-sh/uv/issues/18202

This diff adds a `UV_INIT_BARE` environment variable that makes `--bare`
the default behavior for `uv init`. The command-line flag takes
precedence over the environment variable, following the same pattern
used by `UV_FROZEN`, `UV_LOCKED`, and other boolean environment
variables.
2026-02-27 17:37:28 -05:00
Tobias Diez 4551effe6a Improve hint for installing meson-python when missing as build backend (#15826)
<!--
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 package uses meson-python as backend, it's declared as:
```
[build-system]
build-backend = 'mesonpy'
requires = ['meson-python']
```

Currently, if meson-python is missing, one gets the following hint:
```
Traceback (most recent call last):
        File "<string>", line 8, in <module>
          import mesonpy as backend
      ModuleNotFoundError: No module named 'mesonpy'

      hint: This error likely indicates that `sagemath` depends on `mesonpy`, but doesn't declare it as a build
      dependency. If `sagemath` is a first-party package, consider adding `mesonpy` to its `build-system.requires`.
      Otherwise, either add it to your `pyproject.toml` under:

      [tool.uv.extra-build-dependencies]
      sagemath = ["mesonpy"]

      or `uv pip install mesonpy` into the environment and re-run with `--no-build-isolation`.
```

which is not quite correct as the build backend/module is called
"mesonpy" but the python package one has to install is "meson-python".
This hint is improved in this PR.


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

## Test Plan

I didn't yet had a chance to setup a local dev env for testing this.
<!-- How was it tested? -->
2026-02-27 20:16:07 +00:00
liam 99cb2a2c50 Add resolver hint when --exclude-newer filters out all versions of a package (#18217)
Resolves #18014 (also related to
https://github.com/astral-sh/uv/issues/18010)

When `--exclude-newer` is active and all versions of a required package
were uploaded after the cutoff, resolution fails with no indication that
the setting is the cause. This diff adds a resolver hint that surfaces
the relationship.

The diff also includes debug-level logging of the exclude-newer
configuration at resolver start (happy to get this in separately, if
needed), and trace-level logging each time an individual file is
excluded by the timestamp cutoff. These help diagnose resolution
behavior without requiring the hint to fire.
2026-02-27 13:59:02 -06:00
Zsolt Dollenstein 08ab1a3447 Bump version to 0.10.7 (#18212) 2026-02-27 07:07:47 -05:00
konsti 3697a2da18 Use global semaphores for concurrency limits (#18156)
Avoid problems such as https://github.com/astral-sh/uv/issues/15307,
follow-up to https://github.com/astral-sh/uv/pull/18054. See also
https://github.com/astral-sh/uv/pull/17633, for which this should be
helpful.
2026-02-25 15:53:06 +01:00
Zanie Blue a91bcf2683 Bump version to 0.10.6 (#18189) 2026-02-24 17:33:36 -06:00
Zanie Blue 908a7c11af Preserve file permissions when using reflinks on Linux (#18187)
Fixes an regression from #18117 where executable permissions were not
preserved on reflink. On Linux, the `FICLONE` ioctl only clones data
blocks without preserving file metadata, so permissions must be copied
separately. On macOS, `clonefile` already preserves permissions.

This appears to be a well known issue:

- https://github.com/pnpm/pnpm/issues/8546
-
https://github.com/morelj/reflink/blob/53408edf3bf3c5090b1146923f72066c7f6e9200/cloneflags.go#L6-L22
- https://github.com/python/cpython/issues/81338

Closes https://github.com/astral-sh/uv/issues/18181
2026-02-24 17:15:46 -06:00