uv
dbd293a3 - Extract build commands into uv-build-commands (#22260)

Commit
6 days ago
Extract build commands into uv-build-commands (#22260) ## Summary We move `uv build` into `uv-build-commands`, giving build orchestration its own compilation boundary alongside the other command families. The existing `uv-build-frontend` remains the shared interface to build backends. The `uv` crate supplies the diagnostic renderer used when reporting failed builds, so error hints still use the central routing. The new crate has no dependency on sibling command crates. We fold the implementation into the command entrypoint and return `ExitStatus` directly. This removes a forwarding call and the private `BuildResult` enum used only to translate the result into an exit status. The instrumented x86_64 Linux release build exceeds 16 GB of memory with the split crates, so we give its PGO job a 64 GB runner. ## Crate structure Selected dependencies after the complete split: ```text uv (process initialization, dispatch, remaining commands) | +-- uv-cli (argument parsing and settings resolution) +-- uv-python-commands -------> uv-python-context +-- uv-pip-commands ----------> uv-{resolve,install}-operations +-- uv-project-commands ------> uv-{lock,environment,audit}-operations | (including init) +-- uv-workspace-commands ----> uv-{lock,environment}-operations +-- uv-tool-commands ---------> uv-{lock,environment,audit}-operations +-- uv-build-commands --------> uv-build-frontend, uv-dispatch, uv-python-context `-- uv-publish-commands ------> uv-publish uv-lock-operations ----------> uv-resolve-operations uv-environment-operations ---> uv-{resolve,install}-operations `--> uv-python-context ``` ## Benchmarks We split command families and shared workflows so local edits can reuse more compiled code and rebuild faster. We replayed these historical production changes on the stack’s base ([`822539467`](https://github.com/astral-sh/uv/commit/822539467aa0744075b4ffde516db85ed0a547c5)) and final layout ([`129123230`](https://github.com/astral-sh/uv/commit/129123230ccf1e2e2318bbd235c370edc0958d5e)). Times are medians of three paired development-binary rebuilds, including linking, on Linux with stock Rust 1.99.0 and 16 Cargo jobs. Each replay starts from a warmed before-state. The comparison covers the full stack, including its prerequisite refactors. | Historical change | Before | After | Reduction | | --- | ---: | ---: | ---: | | [Project add: empty metadata cache](https://github.com/astral-sh/uv/commit/6cf775b65384d2fd549c6e858972de433c19bfab) | 12.25s | 8.39s | 31.5% | | [Project sync: workspace warning](https://github.com/astral-sh/uv/commit/c4e9150bc11eb29ae8f366430332b9592b9f9044) | 12.07s | 6.92s | 42.7% | | [CLI/settings: audit group selection](https://github.com/astral-sh/uv/commit/410a67e5a9297594538d4f616c532191f8c052c2) | 14.44s | 8.95s | 38.0% | | [Install operations: dry-run distributions](https://github.com/astral-sh/uv/commit/ab8220dd143153fe24f1ba06c703b8a4d209e251) | 14.18s | 9.40s | 33.7% | | [Lock metadata API and workspace command](https://github.com/astral-sh/uv/commit/ba5833f0988962079e75894490f576c7f8cccf49) | 16.74s | 11.67s | 30.3% | | [Lock internals: conflicting groups](https://github.com/astral-sh/uv/commit/fc012a663191c4bf3c8af5915ac51524d10ba13d) | 22.21s | 14.41s | 35.1% | | [Python installation type and command](https://github.com/astral-sh/uv/commit/7a3bc07950e733a967e745337e9189b6d3def9c2) | 43.11s | 29.37s | 31.9% | Lower wall times can require more total CPU; gains depend on available parallelism.
Author
Parents
Loading