This refactor focuses on reducing CLI monolith size and keeping behavior stable.
- Reduce bloat pressure in
src/calc/cli.py. - Keep existing CLI/REPL semantics unchanged.
- Preserve compatibility for existing tests and monkeypatch patterns.
-
Added
src/calc/options.py- Owns
CLIOptions, option parsing, and format/color mode validation.
- Owns
-
Added
src/calc/updates.py- Owns PyPI version lookup and update status line generation.
-
Added
src/calc/repl.py- Owns REPL command dispatch, tutorial command flow, and inline REPL option parsing.
-
Added
src/calc/render.py- Owns output rendering for plain/pretty/caret/latex/json formats.
-
Added
src/calc/ode.py- Owns ODE alias parsing and evaluation helpers.
-
Updated
src/calc/cli.py- Keeps compatibility wrapper functions (for tests and internal call sites).
- Delegates to focused modules above.
- Removes dead internal helper
_format_clickable_link.
-
Repository hygiene
- Updated
.gitignoreto ignore.coverage,.hypothesis/, anddist/. - Removed duplicate local launcher script
calc(keptphil).
- Updated
uv run --group dev pytest tests/test_cli.py tests/test_cli_unit.py -quv run --group dev pytest -q
Both pass at the time of this refactor.