[codex] Split PE rebuild CLI parsing from runtime imports#154
Draft
anth-volk wants to merge 2 commits into
Draft
[codex] Split PE rebuild CLI parsing from runtime imports#154anth-volk wants to merge 2 commits into
anth-volk wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #146
Summary
__getattr__pattern so importingmicroplex_usdoes not import coremicroplexor torch-backed surfaces._LazySymbolworkaround with an explicit parser/runtime boundary:build_policyengine_us_data_rebuild_checkpoint_parser()builds argparse without runtime imports, and execution helpers call_load_runtime_symbols()before doing real work.__main__with--help, blockstorch, and asserts coremicroplexwas not imported before argparse exits.Root Cause
The PE-US rebuild CLI was blocked before argument parsing because importing
microplex_usand the checkpoint module eagerly imported runtime pipeline modules that reached coremicroplex. Coremicroplex.__init__currently imports torch-backed surfaces, so a no-torch environment could not even render CLI help.Validation
uv run --no-sync ruff check src/microplex_us/__init__.py src/microplex_us/pipelines/pe_us_data_rebuild_checkpoint.py tests/test_package_imports.pyuv run --no-sync pytest tests/test_package_imports.py -q-> 5 passeduv run --no-sync python -m py_compile src/microplex_us/__init__.py src/microplex_us/pipelines/pe_us_data_rebuild_checkpoint.py tests/test_package_imports.pyuv run --no-sync python -m microplex_us.pipelines.pe_us_data_rebuild_checkpoint --helpNotes