astral-sh
uv
BlogDocsChangelog

Don't allow local versions when a non-local version is pinned

#16480
Comparing
konsti/mismatch-local-versions-in-sync
(
81e2c10
) with
main
(
f3d3203
)
CodSpeed Performance Gauge
-1%
Untouched
6

Benchmarks

Passed

resolve_warm_jupyter_universal
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter_universal
CodSpeed Performance Gauge
0%
135.6 ms135.9 ms
resolve_warm_jupyter_universal
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter_universal
CodSpeed Performance Gauge
0%
208.9 ms209.7 ms
resolve_warm_jupyter
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter
CodSpeed Performance Gauge
-1%
40.5 ms40.7 ms
resolve_warm_airflow
crates/uv-bench/benches/uv.rs::uv::resolve_warm_airflow
CodSpeed Performance Gauge
-1%
444.1 ms447 ms
resolve_warm_jupyter
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter
CodSpeed Performance Gauge
-1%
71.9 ms72.6 ms
resolve_warm_airflow
crates/uv-bench/benches/uv.rs::uv::resolve_warm_airflow
CodSpeed Performance Gauge
-2%
763.3 ms777.6 ms

Commits

Click on a commit to change the comparison range
Base
main
f3d3203
+0.79%
Don't allow local versions when a non-local version is pinned See https://github.com/astral-sh/uv/issues/16368 Current behavior of `uv sync`: * Requested: `1.0.0+cpu`, Installed: `1.0.0`: Install new package * Requested: `1.0.0+cpu`, Installed: `1.0.0+cu128`: Install new package * Requested: `1.0.0`, Installed: `1.0.0+cpu`: Keep installed package The new behavior is to always reinstall when the local version part is different, for consistency and to fix torch. This behavior happens because internally, we translate the version from the lockfile to an `=={version}` request, and version matching says local versions are allowed if the specifier has no local version. This is a (minor) behavior change: When running `uv sync` in a venv with a package after installing the same package with the same version except the local version, uv will now remove the installed package and use the one from the lockfile instead. This seems more correct, as the other version was not matching the lockfile. There is still a gap as what we actually want to track is the index URL (or even better, the package hash), but as that information is not tracked in the venv, checking the local version is the next bests thing we can do. The main motivation is fixing torch, our main user of packages with both local and non-local versions (https://github.com/astral-sh/uv/issues/16368).
70219fc
2 days ago
by konstin
-1.55%
clippy
81e2c10
2 days ago
by konstin
© 2025 CodSpeed Technology
Home Terms Privacy Docs