Code Quality
Several make targets are available for use in an activated mpas_app development environment:
make docsto build the HTML documentation (see Documentation).make formatto format Python code and docstrings with ruff.make lintto lint Python code with ruff.make regtestto run the Regression Tests.make systestto run the System Tests.make testto run the linter, typechecker, and unit tests.make typecheckto typecheck Python code with mypy.make unittestto run the unit tests and report coverage with pytest and coverage.
Configuration for these tools is provided by the file pyproject.toml in the repo root.
Code should be formatted and tested periodically during the development process. A useful idiom is to run make format && make test to format the code and run all basic tests, which is equivalent to executing the format, lint, typecheck, and unittest targets. The order is intentional:
formatwill complain about certain kinds of syntax errors that would cause all the remaining code-quality tools to fail (and that could change line numbers reported by other tools, if it ran after them).lintprovides a good first check for obvious errors and anti-patterns in the code.typecheckoffers a more nuanced look at interfaces between functions, methods, etc. and may spot issues missed by the linter.unittestprovides higher-level semantic-correctness checks once code syntax and typing is deemed correct.
All the above tests are executed by the CI system against PRs, so be sure that code is formatted and that tests pass locally.
The mpas_app repository has standardized 100% unit-test coverage, enforced by make unittest and its configuration in pyproject.toml. Please help maintain this high standard.
Regression Tests
Coming soon.
System Tests
Coming soon.