uv
4d3ce168 - Normalize requirement declarations in lockfiles (#21951)

Commit
53 days ago
Normalize requirement declarations in lockfiles (#21951) Dependency declarations can express the same requirements in different forms. Normalize dependency collections when checking whether a lockfile satisfies its inputs, so equivalent declarations such as `foo>=1`, `foo>=2`, and `foo<3` versus `foo>=2,<3` can reuse the lock without resolving again. With `--preview-features lockfile-normalization`, also write normalized manifest inputs and package requirement metadata. Global and scoped overrides normalize independently, and false requirements remain intact where overrides can replace their markers. Build constraints retain their existing serialization and comparison. Semantic comparison is enabled by default, including for existing locks. Equivalent inputs can reuse a lock without rewriting it; only normalized output requires the preview feature. Older uv versions can read normalized locks but may consider them stale and rewrite them because they compare declarations differently. The preview `tool-install-locks` feature also uses this comparison. When equivalent requested inputs reuse a tool lock, the receipt records the latest raw inputs, which can affect resolution order on a later upgrade.
Author
Parents
Loading