From faf16c13499893e07fd8298a7ffe6501162bf637 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 18 Mar 2025 08:12:40 -0700 Subject: [PATCH] Allow local version mismatches when validating lockfile (#12285) ## Summary Closes https://github.com/astral-sh/uv/issues/12282. ## Test Plan Given: ```toml [project] name = "foo" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13.0" dependencies = ["flash-attn"] [tool.uv] environments = ["sys_platform == 'darwin'", "sys_platform == 'linux'"] constraint-dependencies = ["torch==2.5.1"] [tool.uv.sources] flash_attn = [ { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp310-cp310-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.10'"}, { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp311-cp311-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.11'"}, { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.12'"}, { url = "https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu12torch2.5cxx11abiFalse-cp313-cp313-linux_x86_64.whl", marker = "sys_platform == 'linux' and python_version == '3.13'"} ] ``` Ran `uv lock` on `v0.6.5`. Then verified that `uv lock` fails on `v0.6.6` on the same lockfile, but this commit succeeds. --- crates/uv-resolver/src/lock/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index f546c95b0..3376ff55e 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -2874,7 +2874,9 @@ impl PackageWire { // Consistency check if let Some(version) = &self.id.version { for wheel in &self.wheels { - if version != &wheel.filename.version { + if *version != wheel.filename.version + && *version != wheel.filename.version.clone().without_local() + { return Err(LockError::from(LockErrorKind::InconsistentVersions { name: self.id.name, version: version.clone(),