feat(cli): add top-level CLI entry points for preview_asset and run_env#214
feat(cli): add top-level CLI entry points for preview_asset and run_env#214
Conversation
Allow `python -m embodichain.preview_asset` and `python -m embodichain.run_env` as shortcuts, following the same pattern as `python -m embodichain.data`. Also adds CLI reference documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds user-facing python -m entry points for existing lab CLIs (preview_asset, run_env) and documents them alongside the existing embodichain.data CLI.
Changes:
- Refactors
embodichain/lab/scripts/preview_asset.pyandembodichain/lab/scripts/run_env.pyto expose acli()entry point and keep__main__behavior. - Introduces top-level modules
embodichain/preview_asset.pyandembodichain/run_env.pyas thin entry points. - Adds CLI reference docs and links them from the guides index.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
embodichain/run_env.py |
New top-level CLI entry module for run_env (currently runs on import). |
embodichain/preview_asset.py |
New top-level CLI entry module for preview_asset (currently runs on import). |
embodichain/lab/scripts/run_env.py |
Extracts previous __main__ block into a reusable cli() function. |
embodichain/lab/scripts/preview_asset.py |
Extracts previous __main__ block into a reusable cli() function. |
docs/source/guides/index.rst |
Adds the new CLI guide to the guides toctree. |
docs/source/guides/cli.md |
Documents usage and arguments for the three CLIs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
embodichain/run_env.py
Outdated
| from embodichain.lab.scripts.run_env import cli | ||
|
|
||
| cli() |
There was a problem hiding this comment.
This module executes cli() at import time. Importing embodichain.run_env from another Python module will immediately parse sys.argv and start the runner (likely raising SystemExit on argparse errors), which is an unsafe side effect for a normal importable module. Consider exposing a local cli() wrapper and only invoking it under if __name__ == "__main__": so python -m embodichain.run_env still works without import-time execution.
| from embodichain.lab.scripts.run_env import cli | |
| cli() | |
| from embodichain.lab.scripts.run_env import cli as _cli | |
| def cli() -> None: | |
| """Entry point for the environment runner CLI.""" | |
| _cli() | |
| if __name__ == "__main__": | |
| cli() |
embodichain/preview_asset.py
Outdated
|
|
||
| from embodichain.lab.scripts.preview_asset import cli | ||
|
|
||
| cli() |
There was a problem hiding this comment.
This module calls cli() unconditionally at import time. If any code imports embodichain.preview_asset (e.g., for programmatic access or module discovery), it will immediately run the CLI argument parsing and launch the preview workflow, which is a harmful side effect. Please guard execution with if __name__ == "__main__": and optionally re-export a cli() function so python -m embodichain.preview_asset continues to work.
| cli() | |
| def main() -> None: | |
| """Entry point for ``python -m embodichain.preview_asset``.""" | |
| cli() | |
| if __name__ == "__main__": | |
| main() |
Description
This PR adds top-level CLI entry points for
preview_assetandrun_env, allowing users to invoke them via:This follows the same pattern as the existing
python -m embodichain.dataCLI.Changes:
if __name__ == "__main__"blocks intocli()functions inpreview_asset.pyandrun_env.pyembodichain/preview_asset.pyandembodichain/run_env.pydocs/source/guides/cli.md) covering all three CLI commandsDependencies: None
Type of change
Screenshots
N/A
Checklist
black .command to format the code base.🤖 Generated with Claude Code