Adding tables formatting - #127
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There is an import-time error in an example config and some formatting/tooling settings are currently unreliable across environments.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a Python “table” formatter for aligning repeated tuple/call rows (e.g., config tables), integrates it into pre-commit + CI, and updates various template/example configs to use the aligned layout with # fmt: off/on guards so Ruff formatting won’t undo the alignment.
Changes:
- Add
scripts/format_python_tables.pyplus CI regression tests to keep formatting stable. - Wire the formatter into
.pre-commit-config.yamland run its tests in GitHub Actions CI. - Reformat multiple template/example config tables and adjust VS Code template formatting settings.
File summaries
| File | Description |
|---|---|
| templates/histogrammer_config.template.py | Reformat default/custom histogram tuple tables for alignment. |
| templates/config.template.py | Reformat histogram tables and branchesToAdd rows; add spacing around guarded regions. |
| templates/.vscode/settings.json | Add tuple-table-formatter settings and change Python default formatter selection. |
| scripts/format_python_tables.py | New formatter script that aligns “table-like” repeated tuple/call rows and inserts # fmt: off/on. |
| configs/examples/skimmer_config.py | Align branchesToAdd rows and add # fmt: off/on guards. |
| configs/examples/plotter_config.py | Collapse multi-line Histogram(...) calls into aligned one-line rows with fmt guards. |
| configs/examples/minimal_plotter_config.py | Align histogram table and add fmt guards. |
| configs/examples/minimal_histogrammer_config.py | Align default histogram tuple table. |
| configs/examples/limits_config.py | Reformat background sample rows with fmt guards (but currently introduces an error). |
| configs/examples/histogrammer_config.py | Align histogram tuple tables and add fmt guards around them. |
| configs/das_exercises/task7_plotting.py | Align histogram definitions with fmt guards. |
| configs/das_exercises/task4_advanced_histograms.py | Align default histogram tuple table with fmt guards. |
| configs/das_exercises/task2_plotting.py | Align histogram definitions with fmt guards. |
| ci/test_format_python_tables.py | New unit/regression tests for the formatter script. |
| .pre-commit-config.yaml | Add a local pre-commit hook to run the formatter. |
| .github/workflows/ci.yml | Run formatter unit tests during CI. |
Review details
- Files reviewed: 14/16 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4430d0c to
756f85e
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
twybo
left a comment
There was a problem hiding this comment.
see other comments
Why hasnt the format CI not run succesfully?
There was a problem hiding this comment.
is this table formatting related?
No description provided.