Skip to content

Share environment-marker parsing across URL types - #2753

Draft
charliermarsh wants to merge 1 commit into
mainfrom
charlie/codex-uv-build-marker-parser
Draft

charliermarsh wants to merge 1 commit into
mainfrom
charlie/codex-uv-build-marker-parser

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Marker parsing never parses URLs, but its error type is generic over the requirement's URL representation. We use an internal marker syntax error and convert it into the public Pep508Error<T> at the requirement boundary, so the parser is shared across URL types. Error messages and spans are unchanged.

On Linux x86_64 with Rust 1.99.0 and the stripped minimal-size profile, uv-build decreases from 3,075,808 to 3,069,248 bytes (6,560 bytes, 0.21%) against main at e37c1f0c6.

All 132 PEP 508 tests with all features, 67 backend tests, strict clippy, and formatting pass. A 756-case comparison covering valid and invalid markers in project and build-system requirements produces identical diagnostics and metadata. CLI and archive comparisons also match. Forty CPU-pinned paired runs on a project with 1,000 requirement markers found no statistically resolved runtime change.

For uv-build size, this is an alternative to #2754: narrowing the build-system URL type removes the second marker-parser instantiation. Applying both adds 448 bytes to the combined build, so #2754 is preferable if its URL-validation change is acceptable.

@astral-automations-bot astral-automations-bot Bot added internal A refactor or improvement that is not user-facing performance labels Oct 14, 2026
@codspeed

codspeed Bot commented Oct 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 69 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing charlie/codex-uv-build-marker-parser (9629d50) with main (e37c1f0)

Open in CodSpeed

Footnotes

  1. 35 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. ↩

konstin pushed a commit to astral-sh/uv that referenced this pull request Oct 15, 2026
## Summary

We decouple the build backend's parsing of `build-system.requires` from
uv's supported installation sources. The build frontend resolves and
installs these requirements before invoking the backend, so the backend
should not enforce uv's Git transport or archive-format restrictions. We
retain general requirement and URL parsing while removing distribution
classification from this field, allowing the standalone `uv-build`
binary to omit Git parsing and archive-extension inference.

This intentionally broadens acceptance. The backend now accepts
Mercurial references such as `hg+https://example.com/repo` and archive
download URLs without a recognized filename extension. It also accepts
strings such as `git+banana://example.com/repo` and
`git+://example.com/repo` that parse as URLs but fail uv's Git URL
validation. Acceptance by the backend does not establish that a
requirement is installable; the frontend owns that check. uv's
direct-build validation and project-dependency parsing retain their
existing URL checks.

In the Linux x86_64 comparison against `main` at `e37c1f0c6`, using Rust
1.99.0 and the stripped `minimal-size` profile, `uv-build` shrank from
3,075,808 to 3,029,232 bytes (46,576 bytes, 1.51%). This subsumes the
standalone-binary size saving from astral-sh#2753; the two
savings are not additive.

Co-authored-by: Charlie Marsh <[email protected]>
@astral-automations-bot
astral-automations-bot Bot force-pushed the charlie/codex-uv-build-marker-parser branch from 9629d50 to 7e6a823 Compare October 18, 2026 03:30

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant