Skip to content

Avoid sharing version metadata across indexes#18373

Merged
charliermarsh merged 2 commits intomainfrom
charlie/dist-id
Mar 10, 2026
Merged

Avoid sharing version metadata across indexes#18373
charliermarsh merged 2 commits intomainfrom
charlie/dist-id

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

The metadata cache used VersionId as a key, which meant that if a package-version existed on two different indexes, we assumed identical metadata. This turns out not to be true in some contexts, e.g., for the linked issue with PyTorch. We now key it on DistributionId, which does include the index.

Closes #17732.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 8, 2026
@charliermarsh
Copy link
Copy Markdown
Member Author

(This has a few problems hence the failing tests but I think it’s directionally correct…)

@charliermarsh charliermarsh marked this pull request as ready for review March 9, 2026 02:44
@charliermarsh charliermarsh requested review from konstin and zanieb March 9, 2026 02:44
@charliermarsh charliermarsh merged commit 5dc986d into main Mar 10, 2026
54 checks passed
@charliermarsh charliermarsh deleted the charlie/dist-id branch March 10, 2026 11:34
konstin added a commit that referenced this pull request Mar 15, 2026
Improve the performance for #18373.

```
$ hyperfine --warmup 3 --runs 30 \
    '/tmp/uv-0-baseline lock --project /home/konsti/projects/airflow' \
    '/tmp/uv-1-or-insert-with lock --project /home/konsti/projects/airflow' \
    '/tmp/uv-2-single-lookup lock --project /home/konsti/projects/airflow' \

Benchmark 1: /tmp/uv-0-baseline lock --project /home/konsti/projects/airflow
Time (mean ± σ):     147.1 ms ±  10.1 ms    [User: 108.4 ms, System: 23.6 ms]
Range (min … max):   130.5 ms … 165.9 ms    30 runs

Benchmark 2: /tmp/uv-1-or-insert-with lock --project /home/konsti/projects/airflow
Time (mean ± σ):     141.3 ms ±   7.3 ms    [User: 106.3 ms, System: 21.3 ms]
Range (min … max):   131.5 ms … 160.6 ms    30 runs

Benchmark 3: /tmp/uv-2-single-lookup lock --project /home/konsti/projects/airflow
Time (mean ± σ):     139.6 ms ±   7.3 ms    [User: 104.7 ms, System: 21.8 ms]
Range (min … max):   128.3 ms … 160.9 ms    30 runs

Summary
/tmp/uv-2-single-lookup lock --project /home/konsti/projects/airflow ran
 1.01 ± 0.07 times faster than /tmp/uv-1-or-insert-with lock --project /home/konsti/projects/airflow
 1.05 ± 0.09 times faster than /tmp/uv-0-baseline lock --project /home/konsti/projects/airflow
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conditional [tool.uv.sources] causes platform-specific transitive dependencies to be dropped for default (non-extra) resolution

2 participants