split cli.py and oci.py into packages:#47
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors two large single-file modules (captain/cli.py at ~1393 lines and captain/oci.py at ~550 lines) into proper Python packages with multiple submodules. Public APIs are re-exported from __init__.py with __all__, preserving all existing import paths (e.g., from captain.cli import main, from captain import oci). No behavioral changes — pure structural reorganization.
Changes:
- Split
captain/oci.pyinto acaptain/oci/package with four submodules:_common.py(shared constants/helpers),_build.py(image building/layer creation),_publish.py(publishing logic), and_pull.py(pull/tag operations). - Split
captain/cli.pyinto acaptain/cli/package with five submodules:_parser.py(CLI parser infrastructure),_main.py(entry point),_commands.py(command handlers),_stages.py(build stage orchestration), and_release.py(release subcommand). - Updated the
project_dirderivation in_main.pyto account for the additional directory nesting (parent.parent.parentinstead ofparent.parent).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
captain/oci.py |
Deleted — code moved to captain/oci/ package |
captain/oci/__init__.py |
Re-exports public API: compute_version_tag, publish, pull, tag_all, tag_image |
captain/oci/_common.py |
Shared constants (_ARCHES), helpers (_image_ref, _default_log), and compute_version_tag |
captain/oci/_build.py |
_deterministic_tar, _collect_arch_artifacts, _build_platform_image |
captain/oci/_publish.py |
_create_push_cleanup, _publish_single_arch, _publish_combined, publish |
captain/oci/_pull.py |
pull, tag_image, tag_all |
captain/cli.py |
Deleted — code moved to captain/cli/ package |
captain/cli/__init__.py |
Re-exports public API: main, COMMANDS |
captain/cli/_parser.py |
CLI parser infrastructure, flag definitions, command extraction |
captain/cli/_main.py |
Main CLI entry point (main()) |
captain/cli/_commands.py |
Build and utility command handlers |
captain/cli/_stages.py |
Build stage orchestration (kernel, tools, mkosi, iso) |
captain/cli/_release.py |
Release subcommand handler (publish, pull, tag) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
These two files were too large. Public APIs are re-exported from __init__.py with __all__ so existing imports (from captain.cli import main, from captain import oci) remain unchanged. No behavioral changes — pure structural refactor. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
32db3ce to
018a62b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge Queue StatusRule:
This pull request spent 10 minutes 46 seconds in the queue, including 10 minutes 37 seconds running CI. Required conditions to merge
|
Description
These two files were too large. Public APIs are re-exported from init.py with all so existing imports (from captain.cli import main, from captain import oci) remain unchanged. No behavioral changes — pure structural refactor.
Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: