Skip to content

Normalize dependency inputs in tool receipts - #21930

Closed
charliermarsh wants to merge 10 commits into
charlie/intersect-constraint-hashesfrom
charlie/tool-requirement-dedup
Closed

charliermarsh wants to merge 10 commits into
charlie/intersect-constraint-hashesfrom
charlie/tool-requirement-dedup

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Repeated --with arguments currently produce duplicate requirements in tool receipts. We now normalize requirements, constraints, overrides, exclusions, and build constraints when installing tools and reading existing receipts. Equivalent inputs reuse the installed environment, and successful installs and upgrades write normalized receipts. For example, --with 'httpie<1' --with 'httpie<2' records a single httpie<1 requirement.

Each input type has a normalized wrapper in uv-tool. Requirements and constraints combine overlapping declarations while retaining source identity, prerelease opt-in, and yanked-version eligibility. Overrides retain false markers that suppress dependencies, exclusions retain package and version scopes, and build constraints retain hash restrictions and validation behavior.

Depends on #21956, which makes repeated constraint hashes independent of declaration order.

Closes #14023.

@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from a0e7cc3 to 51bd134 Compare September 23, 2026 02:17
@charliermarsh
charliermarsh changed the base branch from main to charlie/arbitrary-equality-satisfaction September 23, 2026 02:17
@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from 51bd134 to 13ae6b6 Compare September 23, 2026 02:19
@charliermarsh
charliermarsh marked this pull request as ready for review September 23, 2026 02:36
@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Sep 23, 2026
Base automatically changed from charlie/arbitrary-equality-satisfaction to main September 23, 2026 10:57
charliermarsh added a commit that referenced this pull request Sep 23, 2026
## Summary

We resolve `package===1` to version `1.0.0`, but satisfaction checks
compare rendered versions and report the installed package as
incompatible. Compare parsed versions for `===` so installation reuse
and `uv pip check` agree with resolution.

Local version labels remain significant: `===1` accepts `1.0.0` but
rejects `1.0.0+local`.

Prerequisite for #21930.
@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from 469825d to f9f7664 Compare September 23, 2026 10:57
@codspeed

codspeed Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 25 untouched benchmarks
🆕 16 new benchmarks
⏩ 28 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation decode[16] N/A 51.4 µs N/A
🆕 Simulation decode[32] N/A 96.3 µs N/A
🆕 Simulation decode[48] N/A 140.6 µs N/A
🆕 Simulation decode[64] N/A 185.2 µs N/A
🆕 Simulation from_bytes[16] N/A 212.6 µs N/A
🆕 Simulation from_bytes[32] N/A 286 µs N/A
🆕 Simulation from_bytes[48] N/A 372.4 µs N/A
🆕 Simulation from_bytes[64] N/A 467 µs N/A
🆕 Simulation from_hex/lowercase[16] N/A 189.5 µs N/A
🆕 Simulation from_hex/lowercase[32] N/A 280.7 µs N/A
🆕 Simulation from_hex/lowercase[48] N/A 353.6 µs N/A
🆕 Simulation from_hex/lowercase[64] N/A 438.1 µs N/A
🆕 Simulation from_hex/uppercase[16] N/A 294.1 µs N/A
🆕 Simulation from_hex/uppercase[32] N/A 362.4 µs N/A
🆕 Simulation from_hex/uppercase[48] N/A 416 µs N/A
🆕 Simulation from_hex/uppercase[64] N/A 467.9 µs N/A

Comparing charlie/tool-requirement-dedup (9351edb) with charlie/intersect-constraint-hashes (cee9ebf)2

Open in CodSpeed

Footnotes

  1. 28 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on charlie/intersect-constraint-hashes (1db9344) during the generation of this report, so d4cce75 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from f9f7664 to 8670d61 Compare September 23, 2026 12:52
@charliermarsh
charliermarsh removed this pull request from stack #21932 September 23, 2026 12:52
@charliermarsh
charliermarsh changed the base branch from main to charlie/false-marker-roundtrip September 23, 2026 12:52
@charliermarsh charliermarsh changed the title Normalize requirements in tool receipts Normalize dependency inputs in tool receipts Sep 23, 2026
charliermarsh added a commit that referenced this pull request Sep 23, 2026
We serialize always-false markers as `python_version < '0'`, but parsing
that expression produces a nonconstant version range. Normalize
`python_version < '0'` to false and its complement to true, including
equivalent zero spellings, so false markers round-trip correctly.

This lets us recognize unchanged false overrides after reading tool
receipts. The simplification applies to `python_version`, whose values
contain only major and minor release numbers.

Prerequisite for #21930.
@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from 629dadb to 5fd7202 Compare September 23, 2026 14:26
@astral-sh-bot

This comment has been minimized.

@charliermarsh
charliermarsh force-pushed the charlie/tool-requirement-dedup branch from 7829a18 to 9351edb Compare September 25, 2026 14:00
@charliermarsh
charliermarsh force-pushed the charlie/intersect-constraint-hashes branch from cee9ebf to 1db9344 Compare September 25, 2026 14:00
@charliermarsh
charliermarsh removed this pull request from stack #21957 September 25, 2026 15:15

This branch was previously deployed

1 inactive deployment
automations — 9351edb5 Deployed Sep 25, 2026 by charliermarsh via review / security review #47612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv tool install --with <name> --with <name> writes duplicate requirements to the receipt

2 participants