Skip to content

Split command implementations and shared support out of uv - #2291

Draft
zaniebot wants to merge 6 commits into
mainfrom
zb/split-uv-crate
Draft

zaniebot wants to merge 6 commits into
mainfrom
zb/split-uv-crate

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Command implementations and shared project workflows are concentrated in uv. Move every command family into a dedicated *-command crate and give shared operations, project logic, CLI settings, output, and process helpers separate owners. uv retains initialization, dispatch, logging, and the central error-hint registry.

Selected dependencies:

uv (initialization and dispatch)
|
+-- uv-*-command (25 command crates)
|   |
|   +-- uv-project ----------> uv-operations
|   `-- uv-operations              |
|                                 `-- existing domain crates
+-- uv-cli-settings ---------> uv-cli-arguments
`-- uv-cli-arguments              (formerly uv-cli)

Shared command support:
  uv-cli-types       exit status and command-selection types
  uv-cli-output      terminal output and progress reporters
  uv-cli-report      installation reports
  uv-cli-error       command error classification
  uv-child-process   process execution and environment files

Command crates:
  uv-pip-command          uv pip ...
  uv-lock-command         uv lock
  uv-sync-command         uv sync
  uv-add-command          uv add
  uv-remove-command       uv remove
  uv-run-command          uv run
  uv-init-command         uv init
  uv-export-command       uv export
  uv-tree-command         uv tree
  uv-format-command       uv format
  uv-check-command        uv check
  uv-upgrade-command      uv upgrade
  uv-version-command      uv version
  uv-audit-command        uv audit
  uv-workspace-command    uv workspace ...
  uv-python-command       uv python ...
  uv-tool-command         uv tool ... and uvx
  uv-auth-command         uv auth ...
  uv-cache-command        uv cache ...
  uv-build-command        uv build and build-backend entrypoints
  uv-publish-command      uv publish
  uv-venv-command         uv venv
  uv-help-command         uv help
  uv-self-update-command  uv self update (optional)
  uv-pylock-command       shared pylock command support

Callers import directly from owning modules. Existing domain crates retain their responsibilities, and the split keeps command behavior, error classification, and application metadata intact. self-update remains optional.

@codspeed

codspeed Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by ×9.2

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 11 improved benchmarks
⏩ 78 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ unzip_wheel_many_files 371 ms 12.4 ms ×30
⚡ install_wheel_many_files 385 ms 13.6 ms ×28
⚡ prepare_wheel_many_files 383.4 ms 15 ms ×25
⚡ unpack_sdist_many_files 317.2 ms 36.8 ms ×8.6
⚡ resolve_warm_jupyter_universal 87.6 ms 11.6 ms ×7.6
⚡ resolve_warm_jupyter 17.4 ms 2.5 ms ×7.1
⚡ discover_workspace_from_all_members_with_excludes 52.7 ms 8.2 ms ×6.4
⚡ discover_workspace_from_all_members 50.5 ms 7.9 ms ×6.4
⚡ run_python_version_synthetic_workspace 268.4 ms 42.5 ms ×6.3
⚡ resolve_warm_airflow 233.2 ms 41.6 ms ×5.6
⚡ hash_sha256 1,165.6 µs 404 µs ×2.9

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing zb/split-uv-crate (8283b76) with main (b7c8c62)2

Open in CodSpeed

Footnotes

  1. 78 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 main (1f85ea1) during the generation of this report, so b7c8c62 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zaniebot zaniebot changed the title Split shared operations and output into separate crates Split command implementations and shared support out of uv Oct 5, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/split-uv-crate branch 9 times, most recently from c059bbf to b99d3ad Compare October 7, 2026 18:20
@zaniebot zaniebot added the build:skip-release Disable building release binaries for a pull request label Oct 7, 2026
Comment thread Cargo.toml
uv-help-command = { version = "0.0.90", path = "crates/uv-help-command" }
uv-init-command = { version = "0.0.90", path = "crates/uv-init-command" }
uv-lock-command = { version = "0.0.90", path = "crates/uv-lock-command" }
uv-pip-command = { version = "0.0.90", path = "crates/uv-pip-command" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Remove the superseded command and support crates

The new command crates copy implementations while leaving uv-pip-commands, uv-python-commands, uv-tool-commands, and uv-workspace-commands intact. Cargo metadata shows those four crates have no consumers, and their old support crates form a dependency graph unreachable from uv. Because workspace membership uses crates/*, workspace checks still maintain both implementations. Remove the superseded crates and their workspace dependency entries so each workflow has one owner.


anyhow = { workspace = true }
fs-err = { workspace = true }
insta = { workspace = true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Keep snapshot dependencies limited to test builds

insta is used only inside the #[cfg(test)] module in installation.rs and is already declared under [dev-dependencies]. Adding it here unnecessarily brings snapshot infrastructure into ordinary uv builds. The new uv-publish-command manifest also moves its test-only insta dependency into production dependencies. Keep both declarations under [dev-dependencies].

Comment on lines +232 to +236
let build_result = build_impl(
project_dir,
skip_dependency_check,
src.as_deref(),
package.as_ref(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Avoid duplicating the complete build entry point

build_impl is private and has only this caller; it still performs CLI reporting and error rendering. The wrapper forwards the entire argument list and converts a new two-variant BuildResult directly into ExitStatus, so every future build option must now be maintained across two signatures and another forwarding call without establishing a separate reusable operation. Keep the implementation in build_frontend and return ExitStatus directly.

Comment on lines +772 to +777
let package_name = serde_json::to_string(&final_version.package_name)?;
let version = serde_json::to_string(&final_version.version)?;
let commit_info = serde_json::to_string(&final_version.commit_info)?;
writeln!(
printer.stdout_important(),
"{{\n \"package_name\": {package_name},\n \"version\": {version},\n \"commit_info\": {commit_info}\n}}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Retain derived serialization for project version output

Replacing ProjectVersionInfo's Serialize implementation with separately serialized fields and a handwritten JSON object creates a second definition of the output schema. Field additions or removals must now be synchronized with this format string, although the previous serde_json::to_string_pretty(&final_version) already produced the output covered by version_get_json. Restore the derive and serialize the struct directly in the new crate.

This branch was successfully deployed

1 active deployment
automations — 8283b76d Deployed Oct 7, 2026 by astral-automations-bot[bot] via review-code-quality / report #7784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:skip-release Disable building release binaries for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants