feat: Add unified cfd-viz CLI with entry point and batch processing (…#36
feat: Add unified cfd-viz CLI with entry point and batch processing (…#36
Conversation
…Phase 4) Register cfd-viz as a package entry point in pyproject.toml and create a unified CLI with argparse subcommands (animate, dashboard, vorticity, profiles, monitor, info, batch) dispatching to existing scripts. Add batch processing module for TOML-configured multi-file operations with stderr progress indicators. Includes 23 tests covering parser structure, command dispatch, batch execution, and entry point verification.
There was a problem hiding this comment.
Pull request overview
Adds a unified cfd-viz command-line interface to the cfd_viz package (registered via pyproject.toml) and introduces TOML-driven batch processing with a simple stderr progress indicator, alongside a comprehensive CLI-focused test suite.
Changes:
- Register
cfd-vizas a package entry point ([project.scripts]) and add an argparse-based CLI with subcommands that dispatch to existing script entry points. - Add
cfd_viz/_batch.pyfor TOML-configured multi-file batch operations with progress output. - Add
tests/test_cli.pyto validate parser structure, dispatch, batch behavior, progress output, and entry point registration.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_cli.py | Adds CLI/batch/entry-point tests to validate parsing and high-level dispatch behavior. |
| scripts/init.py | Introduces scripts as a Python package (enables import scripts.* in a source checkout). |
| pyproject.toml | Registers the cfd-viz console script entry point. |
| cfd_viz/cli.py | Implements unified CLI parser and subcommand dispatch to existing scripts. |
| cfd_viz/_batch.py | Implements batch processing from TOML config with progress indicator and analysis runners. |
| ROADMAP.md | Marks Phase 4 CLI tooling as completed and documents delivered items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Move CLI helper functions from scripts/ into cfd_viz/_cli_impl.py so the installed wheel works without unpackaged script modules. Also: - Wrap animate in try/except for batch error resilience - Handle missing/invalid config file with clear error messages - Eliminate double VTK read in batch profiles analysis
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Avoid forcing matplotlib Agg backend on Windows or systems with DISPLAY set, so interactive commands like monitor can use GUI backends.
read_vtk_file() can raise ValueError for malformed VTK content. Treat it as a non-fatal read failure so the monitor keeps running.
The --output flag was ambiguously used as both a file path and directory. Add --output-dir for --export-frames to make the distinction clear.
The field animation type was listed in --type choices but omitted from the --all loop.
Catch ValueError from malformed VTK files in animate, vorticity, and profiles commands to show clean error messages instead of tracebacks.
Treat invalid VTK content as a non-fatal warning so other batch jobs can continue instead of aborting the entire run.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- Stop monitor loop when plot window is closed (close_event + fignum_exists) - Fix headless detection to only force Agg on Linux without DISPLAY/WAYLAND - Use st_mtime instead of st_ctime for latest file detection (Unix compat)
…Phase 4)
Register cfd-viz as a package entry point in pyproject.toml and create a unified CLI with argparse subcommands (animate, dashboard, vorticity, profiles, monitor, info, batch) dispatching to existing scripts.
Add batch processing module for TOML-configured multi-file operations with stderr progress indicators. Includes 23 tests covering parser structure, command dispatch, batch execution, and entry point verification.