Skip to content

refactor: move subcommands to separate modules#3099

Merged
messense merged 2 commits into
PyO3:mainfrom
messense:move-commands
Mar 22, 2026
Merged

refactor: move subcommands to separate modules#3099
messense merged 2 commits into
PyO3:mainfrom
messense:move-commands

Conversation

@messense

Copy link
Copy Markdown
Member

No description provided.

@messense messense force-pushed the move-commands branch 2 times, most recently from 1caedc8 to 6aec07d Compare March 22, 2026 02:41
@messense messense requested a review from Copilot March 22, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the CLI implementation by moving several subcommands and helpers out of main.rs into dedicated modules, and introduces a shared test helper for resolving test-crates paths.

Changes:

  • Extracted CLI subcommand implementations (build/publish/sdist/develop/pep517, etc.) into src/commands/*.
  • Added test_crate_path helper and updated tests to use it instead of hard-coded test-crates/... paths.
  • Adjusted SBOM fallback code to silence unused-variable warnings when the sbom feature is disabled.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test_utils.rs Adds a shared helper to resolve paths under test-crates for tests.
src/sbom.rs Updates non-sbom feature branch to mark parameters as unused.
src/pyproject_toml.rs Uses test_crate_path in tests to locate fixture pyproject.toml.
src/metadata.rs Uses test_crate_path in tests and avoids hard-coded fixture paths.
src/main.rs Replaces inlined subcommand logic with calls into commands::* modules.
src/lib.rs Exposes test_utils module for tests via #[cfg(test)].
src/commands/mod.rs New command module hub plus shared CLI helpers/options.
src/commands/utils.rs New shared helpers for building/unpacking sdists.
src/commands/build.rs Extracted build command implementation.
src/commands/publish.rs Extracted publish command implementation.
src/commands/sdist.rs Extracted sdist command implementation.
src/commands/develop.rs Extracted develop command implementation and venv detection.
src/commands/pep517.rs Extracted PEP517 subcommand enum and dispatch function.
src/build_options.rs Updates tests to use test_crate_path for fixture manifests.

Comment thread src/sbom.rs
Comment thread src/commands/utils.rs
@messense messense merged commit b6b0190 into PyO3:main Mar 22, 2026
45 checks passed
@messense messense deleted the move-commands branch March 22, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants