Development¶
Setup¶
pip install -e ".[dev]" # pytest, build, twine, ruff
pip install -e ".[docs]" # mkdocs-material, mkdocstrings
Tests¶
pytest -m "not swat" # unit tests on synthetic fixtures
SWATPY_TEST_DOWNLOAD=1 pytest -m swat -rs # real SWAT2012 project (+ runs on linux x86_64)
pytest tests/test_readout.py -k monthly # a single test / subset
The unit tests use a small synthetic SWAT2012 model and synthetic output files in
tests/data, generated by tests/data/make_fixtures.py. The swat tests download the
rev 637 demo project and Linux executable from
SWATdata into ~/.cache/swatpy-tests.
Lint¶
Docs¶
The documentation lives in docs/ and is built with MkDocs:
The API reference is generated from docstrings by
mkdocstrings. On push to master the
.github/workflows/docs.yml workflow builds the site and deploys it to GitHub Pages.
Releasing¶
Releases are published to PyPI with trusted publishing from GitHub Actions
(.github/workflows/publish.yml):
- set
__version__inswatpy/__init__.pyand the version inCITATION.cff; - create a GitHub release with the tag
v<version>, which builds, checks and uploads to PyPI; - a manual run of the workflow uploads to TestPyPI instead.