Commit graph

4428 commits

Author SHA1 Message Date
Charlie Marsh
7a21b713b4
Avoid allocating for names in the PEP 508 parser (#10476)
## Summary

We can read from the slice directly. I don't think this will affect
performance today, because `from_str` will then allocate, but it
_should_ be a speedup once #10475 merges, since we can then avoid
allocating a `String` and go straight from `str` to `ArcStr`.
2025-01-10 20:12:23 +00:00
konsti
d44affaac0
Read publish username from URL (#10469) 2025-01-10 21:10:54 +01:00
Jeremy Foxcroft
2982c2074c
Fix UV_FIND_LINKS delimiter to split on commas (#10477)
#8061 incorrectly claims to change the delimiter for `UV_FIND_LINKS`
from spaces to commas. In reality, it prevents `UV_FIND_LINKS` from
being split. This commit fixes that.
2025-01-10 20:04:35 +00:00
Charlie Marsh
b3d7beb1a0
Use arcstr for package, extra, and group names (#10475)
## Summary

This appears to be a consistent 1% performance improvement and should
also reduce memory quite a bit. We've also decided to use these for
markers, so it's nice to use the same optimization here.

```
❯ hyperfine "./uv pip compile --universal scripts/requirements/airflow.in" "./arcstr pip compile --universal scripts/requirements/airflow.in" --min-runs 50 --warmup 20
Benchmark 1: ./uv pip compile --universal scripts/requirements/airflow.in
  Time (mean ± σ):     136.3 ms ±   4.0 ms    [User: 139.1 ms, System: 241.9 ms]
  Range (min … max):   131.5 ms … 149.5 ms    50 runs

Benchmark 2: ./arcstr pip compile --universal scripts/requirements/airflow.in
  Time (mean ± σ):     134.9 ms ±   3.2 ms    [User: 137.6 ms, System: 239.0 ms]
  Range (min … max):   130.1 ms … 151.8 ms    50 runs

Summary
  ./arcstr pip compile --universal scripts/requirements/airflow.in ran
    1.01 ± 0.04 times faster than ./uv pip compile --universal scripts/requirements/airflow.in
```
2025-01-10 19:46:36 +00:00
Andrew Gallant
503f9a97af
uv-resolver: pre-compute PEP 508 markers from universal markers (#10472)
It turns out that we use `UniversalMarker::pep508` quite a bit. To the
point that it makes sense to pre-compute it when constructing a
`UniversalMarker`.

This still isn't necessarily the fastest thing we can do, but this
results in a major speed-up and `without_extras` no longer shows up for
me in a profile.

Motivating benchmarks. First, from #10430:

```
$ hyperfine 'rm -f uv.lock && uv lock' 'rm -f uv.lock && uv-ag-optimize-without-extras lock'
Benchmark 1: rm -f uv.lock && uv lock
  Time (mean ± σ):     408.3 ms ± 276.6 ms    [User: 333.6 ms, System: 111.1 ms]
  Range (min … max):   316.9 ms … 1195.3 ms    10 runs

  Warning: The first benchmarking run for this command was significantly slower than the rest (1.195 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.

Benchmark 2: rm -f uv.lock && uv-ag-optimize-without-extras lock
  Time (mean ± σ):     209.4 ms ±   2.2 ms    [User: 209.8 ms, System: 103.8 ms]
  Range (min … max):   206.1 ms … 213.4 ms    14 runs

Summary
  rm -f uv.lock && uv-ag-optimize-without-extras lock ran
    1.95 ± 1.32 times faster than rm -f uv.lock && uv lock
```

And now from #10438:

```
$ hyperfine 'uv pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null' 'uv-ag-optimize-without-extras pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null'
Benchmark 1: uv pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null
  Time (mean ± σ):     12.718 s ±  0.052 s    [User: 12.818 s, System: 0.140 s]
  Range (min … max):   12.650 s … 12.815 s    10 runs

Benchmark 2: uv-ag-optimize-without-extras pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null
  Time (mean ± σ):     419.5 ms ±   6.7 ms    [User: 434.7 ms, System: 100.6 ms]
  Range (min … max):   412.7 ms … 434.3 ms    10 runs

Summary
  uv-ag-optimize-without-extras pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null ran
   30.32 ± 0.50 times faster than uv pip compile requirements.in -c constraints.txt --universal --no-progress --python-version 3.8 --offline > /dev/null
```

Fixes #10430, Fixes #10438
2025-01-10 11:23:19 -05:00
Charlie Marsh
bee2baa64e
Misc. changes based on ABI explorations (#10458) 2025-01-10 08:10:39 -05:00
Charlie Marsh
8d25f295af
Only track markers for compatible versions (#10457)
## Summary

We shouldn't consider incompatible distributions (e.g., those that don't
match the required Python version) when determining the implied markers.
2025-01-10 08:10:27 -05:00
Charlie Marsh
7bf514d886
Remove get_with_version methods (#10456)
Some checks are pending
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary

I think these are vestigial.
2025-01-10 03:32:30 +00:00
Charlie Marsh
c5e536f0ec
De-duplicate result handling in Simple API responses (#10449)
## Summary

See: https://github.com/astral-sh/uv/pull/10432#issuecomment-2581084234
2025-01-09 22:45:13 +00:00
Zanie Blue
22222e945f
Allow reading --with-requirements from stdin in uv add and uv run (#10447)
For some reason this was banned when originally added (I did not see
discussion about it). I think it's fine to allow. With `uv run`, there's
a bit of nuance because we also allow the script to be read from stdin.
2025-01-09 16:39:37 -06:00
Ahmed Ilyas
452cafc639
Improve tool list output when tool environment is broken (#10409)
## Summary

Closes #9579 

## Test Plan

`cargo test`


<img width="1110" alt="Screenshot 2025-01-08 at 21 13 11"
src="https://github.com/user-attachments/assets/8937c14e-c594-470f-a8f2-77ac7167794f"
/>
2025-01-09 15:48:06 -06:00
Charlie Marsh
7096e83812
Respect sentinels in prioritization (#10443)
## Summary

If a user provides a constraint like `flask==3.0.0`, that gets expanded
to `[3.0.0, 3.0.0+[max])`. So it's not a _singleton_, but it should be
treated as such for the purposes of prioritization, since in practice it
will almost always map to a single version.
2025-01-09 21:19:49 +00:00
Aria Desires
e2c5526fbb
replace backoff with backon (#10442)
This should be essentially the exact same behaviour, but backon is a
total API redesign, so things had to be expressed slightly differently.
Overall I think the code is more readable, which is nice.

Fixes #10001
2025-01-09 16:01:23 -05:00
Charlie Marsh
56d39d21c2
Visit proxy packages eagerly (#10441)
## Summary

The issue here is that we add `urllib3{python_full_version >= '3.8'}` as
a dependency, then `requests{python_full_version >= '3.8'}`, which adds
`urllib3`, but at that point, we haven't expanded
`urllib3{python_full_version >= '3.8'}`, so we "lose" the singleton
constraint. The solution is to ensure that we visit proxies eagerly, so
that we accumulate constraints as early as possible.

Closes
https://github.com/astral-sh/uv/issues/10425#issuecomment-2580324578.
2025-01-09 20:37:28 +00:00
konsti
57367ed327
Use faster disjointness check for markers (#10439)
Some checks are pending
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2025-01-09 18:31:51 +00:00
Charlie Marsh
14b685d9fb
Warn-and-ignore for unsupported requirements.txt options (#10420)
## Summary

Closes https://github.com/astral-sh/uv/issues/10366.
2025-01-09 13:19:51 -05:00
Charlie Marsh
a0494bb059
Fetch concurrently for non-first-match index strategies (#10432)
## Summary

On a basic test, this speeds up cold resolution by about 25%:

```
❯ hyperfine "uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache" "../target/release/uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache" --warmup 10 --runs 30
Benchmark 1: uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache
  Time (mean ± σ):     585.8 ms ±  28.2 ms    [User: 149.7 ms, System: 97.4 ms]
  Range (min … max):   541.5 ms … 654.8 ms    30 runs

Benchmark 2: ../target/release/uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache
  Time (mean ± σ):     468.3 ms ±  52.0 ms    [User: 131.7 ms, System: 76.9 ms]
  Range (min … max):   380.2 ms … 607.0 ms    30 runs

Summary
  ../target/release/uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache ran
    1.25 ± 0.15 times faster than uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache
```

Given:
```toml
[project]
name = "foo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12.0"
dependencies = [
    "black>=24.10.0",
    "django>=5.1.4",
    "flask>=3.1.0",
    "requests>=2.32.3",
]
```

And:

```shell
hyperfine "uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache" "../target/release/uv lock --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match --upgrade --no-cache" --warmup 10 --runs 30
```

Closes https://github.com/astral-sh/uv/issues/10429.
2025-01-09 12:45:20 -05:00
Charlie Marsh
15ec830bea
Use matches rather than contains in requirements.txt parsing (#10423)
Some checks are pending
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2025-01-09 02:32:09 +00:00
Charlie Marsh
5551f9f3da
Remove unnecessary .to_string() call (#10419) 2025-01-08 23:59:13 +00:00
Charlie Marsh
f65fcf23b3
Remove duplicated comment (#10416) 2025-01-08 23:06:09 +00:00
Charlie Marsh
53dd554919
Update PEP 723 lockfile in uv remove --script (#10162)
## Summary

Counterpart to #10145 covering `uv remove` for PEP 723 scripts with
lockfiles.
2025-01-08 22:05:37 +00:00
Charlie Marsh
18b53c5b45
Add --script support to uv export for PEP 723 scripts (#10160)
## Summary

You can now run `uv export --script main.py` to show the dependency tree
for a given script. If a lockfile doesn't exist, it will create one.

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

Closes https://github.com/astral-sh/uv/issues/9657.
2025-01-08 21:48:53 +00:00
Charlie Marsh
9d5779b68c
Add --script support to uv tree for PEP 723 scripts (#10159)
## Summary

You can now run `uv tree --script main.py` to show the dependency tree
for a given script. If a lockfile doesn't exist, it will create one.

Closes https://github.com/astral-sh/uv/issues/7328.
2025-01-08 21:32:46 +00:00
Charlie Marsh
31b2d3f988
Update PEP 723 lockfile in uv add --script (#10145)
## Summary

`uv add --script main.py anyio` will now update the lockfile, _if_ it
already exists. (If no such lockfile exists, the behavior is unchanged.)
2025-01-08 21:19:12 +00:00
Charlie Marsh
e22b728e3f
Respect PEP 723 script lockfiles in uv run (#10136)
## Summary

If a script has a lockfile, then `uv run` will now reuse it.

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

Closes https://github.com/astral-sh/uv/issues/9688.
2025-01-08 20:34:45 +00:00
Burak Varlı
391ab757b8
Add ls alias to uv {tool, python, pip} list (#10240)
Some checks are pending
CI / check system | alpine (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
## Summary

This PR adds `ls` alias to `uv {tool, python, pip} list` for
convenience.

Not sure if folks previously discussed this or have any opinion on
having aliases – but I have a muscle memory for `ls` for listing things
in commands I'm using (like `docker images ls`, `zellij ls`, `helm ls`
etc.) and thought having `ls` alias for `list` command would be useful.

## Test Plan

I simply compiled `uv` and manually checked `./target/release/uv {tool,
python, pip} ls`.
2025-01-08 14:09:20 -05:00
Charlie Marsh
5d33b94c42
Add support for locking PEP 723 scripts (#10135)
## Summary

You can now run `uv lock --script main.py` to lock a given script
(though as of this PR, the script itself isn't used anywhere).

Closes https://github.com/astral-sh/uv/issues/6318.
2025-01-08 18:36:53 +00:00
Aria Desires
2f7f9ea571
improve shell compatibility of venv activate scripts (#10397)
The shellcheck action we uses misses some files, so they fell out of
spec for what we support. This PR first and foremost adds them to the
scanning list, and then fixes the issues found.

Fixes #7480
2025-01-08 13:12:29 -05:00
Charlie Marsh
4c161d284b
Respect requires-python when installing tools (#10401)
## Summary

This PR revives https://github.com/astral-sh/uv/pull/7827 to improve
tool resolutions such that, if the resolution fails, and the selected
interpreter doesn't match the required Python version from the solve, we
attempt to re-solve with a newly-discovered interpreter that _does_
match the required Python version.

For now, we attempt to choose a Python interpreter that's greater than
the inferred `requires-python`, but compatible with the same Python
minor. This helps avoid successive failures for cases like Posting,
where choosing Python 3.13 fails because it has a dependency that lacks
source distributions and doesn't publish any Python 3.13 wheels. We
should further improve the strategy to solve _that_ case too, but this
is at least the more conservative option...

In short, if you do `uv tool instal posting`, and we find Python 3.8 on
your machine, we'll detect that `requires-python: >=3.11`, then search
for the latest Python 3.11 interpreter and re-resolve.

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

## Test Plan

The following should succeed:

```
cargo run python uninstall --all
cargo run python install 3.8
cargo run tool install posting
```

In the logs, we see:

```
...
DEBUG No compatible version found for: posting
DEBUG Refining interpreter with: Python >=3.11, <3.12
DEBUG Searching for Python >=3.11, <3.12 in managed installations or search path
DEBUG Searching for managed installations at `/Users/crmarsh/.local/share/uv/python`
DEBUG Skipping incompatible managed installation `cpython-3.8.20-macos-aarch64-none`
DEBUG Found `cpython-3.13.1-macos-aarch64-none` at `/opt/homebrew/bin/python3` (search path)
DEBUG Skipping interpreter at `/opt/homebrew/opt/python@3.13/bin/python3.13` from search path: does not satisfy request `>=3.11, <3.12`
DEBUG Found `cpython-3.11.7-macos-aarch64-none` at `/opt/homebrew/bin/python3.11` (search path)
DEBUG Re-resolving with Python 3.11.7
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.11.7
DEBUG Solving with target Python version: >=3.11.7
DEBUG Adding direct dependency: posting*
DEBUG Searching for a compatible version of posting (*)
...
```
2025-01-08 12:38:17 -05:00
Charlie Marsh
333f03f112
Bump version to v0.5.16 (#10395) 2025-01-08 10:29:32 -05:00
konsti
c5583b326f
Shrink Dist from 352 to 288 bytes (#10389)
Found this when looking at #10385. Since we're constructing a lot of
`Dist`s, we should keep it small.
2025-01-08 09:33:19 -05:00
konsti
15c81e9a02
Force a niche into VersionSmall (#10385) 2025-01-08 14:33:39 +01:00
konsti
68adadf806
Improve file pinning comments (#10387) 2025-01-08 11:42:25 +00:00
konsti
fa305bd244
Fix invalid_platform test on main (#10388)
Some checks are pending
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
This test started failing on main.

I don't understand why this changed (there was a new release but exclude-newer is supposed to exclude those), but the error message improved.
2025-01-08 10:55:06 +00:00
Charlie Marsh
1ee17afd79
Avoid enforcing project-level required version for uv self (#10374)
## Summary

Closes https://github.com/astral-sh/uv/issues/10355.
2025-01-07 13:17:42 -05:00
Charlie Marsh
2ae0ed3b35
Re-enable zlib-ng on all platforms (except s390x, PowerPC, and FreeBSD) (#10370)
PowerPC seems to build without errors if we upgrade `zlib-ng`, but
upgrading `zlib-ng` causes Windows to break
(https://github.com/rust-lang/libz-sys/issues/225), and Cargo doesn't
let us include two different versions.

s390x fails because it can't find `stfle`. It's possible that we could
fix this by by upgrading our manylinux version and/or by upgrading GCC
(which may necessitate upgrading our manylinux version), but I don't
know if it's fixable without one of those things? And it's not worth
bumping compatibility for that reason. \cc @konstin
2025-01-07 13:04:34 -05:00
Kevin Marchais
a2a2662d43
Fix ruff linting warnings from generated template files for extension modules (#10371)
## Summary

This PR fixes two ruff linting issues in the generated template files
when using: `uv init --build-backend` for extension modules.

1. Removes unnecessary `from __future__ import annotations` imports from
generated .pyi files
([PYI044](https://docs.astral.sh/ruff/rules/future-annotations-in-stub/))
2. Adds missing blank line after `hello_from_bin` import to comply with
isort formatting
([I001](https://docs.astral.sh/ruff/rules/unsorted-imports/))

## Test Plan

```bash
cargo run -- init --build-backend scikit-build-core example-ext
uvx ruff check example-ext --select ALL

cargo run -- init --build-backend maturin example-ext
uvx ruff check example-ext --select ALL
```

## Remaining warnings

There are still warnings remainings in the generated `__init__.py`
files:
- [D104](https://docs.astral.sh/ruff/rules/undocumented-public-package/)
Missing docstring in public package
-
[D103](https://docs.astral.sh/ruff/rules/undocumented-public-function/)
Missing docstring in public function
- [T201](https://docs.astral.sh/ruff/rules/print/) `print` found
2025-01-07 17:07:44 +00:00
Charlie Marsh
c8b3e8523c
Re-enable zlib-ng on x86 platforms (#10365)
## Summary

Closes https://github.com/astral-sh/uv/issues/10363.
2025-01-07 11:00:32 -05:00
Andrew Gallant
043bdcec8b
uv-pep440: fix bad merge (#10368)
This happened as a result of #10345 and #10362 being merged
independently. The latter used the old `Version::release` API, but the
former changed the `Version::release` API. This PR tweaks the new test
to use the new API (i.e., force a deref on the proxy type).
2025-01-07 15:11:41 +00:00
konsti
373e34f5dd
Remove [u64; 4] from small version to move Arc to full version (#10345) 2025-01-07 14:25:32 +00:00
Andrew Gallant
fb29445999
uv-pep440: adds an explicit test for trailing zeros (#10362)
Basically, this explicitly checks that parsing a `1.2.0` into a
`Version` will roundtrip back to a `1.2.0`, and that parsing a `1.2`
will roundtrip back to a `1.2`.

I think this case is included in the other tests in this module, but
this test makes the behavior more clearly intentional I think.

Ref #10345
2025-01-07 14:16:23 +00:00
konsti
14a9008e54
Avoid overcounting versions in batch prefetcher (#10350) 2025-01-07 14:12:18 +00:00
konsti
3cbf8ab7b1
Optimize requirements_for_extra (#10348) 2025-01-07 14:12:12 +00:00
konsti
c6ac121ed0
Refactor batch prefetch (#10349) 2025-01-07 14:58:36 +01:00
konsti
3dc481b063
Speed up file pins (#10346)
Ref https://github.com/astral-sh/uv/issues/10344

Avoid the nested hashmap, file pinning is called in the version
selection hot loop.

```
$ hyperfine --warmup 1 --prepare "uv venv -p 3.12" "./uv-2 pip compile scripts/requirements/airflow.in" "./uv-1 pip compile scripts/requirements/airflow.in"
    Finished `profiling` profile [optimized + debuginfo] target(s) in 0.12s
Benchmark 1: ./uv-2 pip compile scripts/requirements/airflow.in
  Time (mean ± σ):     420.1 ms ±   4.7 ms    [User: 585.4 ms, System: 195.1 ms]
  Range (min … max):   413.1 ms … 429.2 ms    10 runs

Benchmark 2: ./uv-1 pip compile scripts/requirements/airflow.in
  Time (mean ± σ):     473.0 ms ±   4.9 ms    [User: 654.4 ms, System: 209.4 ms]
  Range (min … max):   468.0 ms … 481.1 ms    10 runs

Summary
  ./uv-2 pip compile scripts/requirements/airflow.in ran
    1.13 ± 0.02 times faster than ./uv-1 pip compile scripts/requirements/airflow.in
```
2025-01-07 08:51:08 -05:00
konsti
d8fcf2a58f
Simplify requirements_for_extra (#10347)
Ref https://github.com/astral-sh/uv/issues/10344

Not a performance optimization, but the function had become too large.
No logic changes, just code moving around. Looks slightly better when
ignoring whitespace changes.

It's still too complex but i haven't found an apt simplification.
2025-01-07 08:50:13 -05:00
Charlie Marsh
0fcccb8994
Accept requirements in uv remove (#10338)
## Summary

This allows, e.g., `uv remove flask[dotenv]` to remove `flask`. Like
`pip install` and `uv pip install`, the content after the package name
has no effect.

Closes https://github.com/astral-sh/uv/issues/9764.
2025-01-07 08:47:05 -05:00
Andrew Tulloch
671e93816a
Buffer file reads in serde_json::from_reader (#10341)
<!--
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

https://docs.rs/serde_json/latest/serde_json/fn.from_reader.html
suggests that

> When reading from a source against which short reads are not
efficient, such as a
[File](https://doc.rust-lang.org/std/fs/struct.File.html), you will want
to apply your own buffering because serde_json will not buffer the
input. See
[std::io::BufReader](https://doc.rust-lang.org/std/io/struct.BufReader.html).

Without this buffering, we observe a sequence of single byte reads which
can be quite inefficient depending on the underlying filesystem.

This adds buffering with `std::io::BufReader` to resolve this.


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

## Test Plan

Unit tests cover this code.

<!-- How was it tested? -->
2025-01-07 08:02:33 -05:00
konsti
a1a4d820d5
Add Send + 'static bounds to cache deserialization (#10352)
Some checks are pending
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
2025-01-07 09:55:37 +00:00
konsti
180a138161
Deactivate tracing for choose version (#10351) 2025-01-07 09:55:06 +00:00