Contributing¶
Contributions are welcome: bug reports and ideas as GitHub issues, and changes as pull requests. Please follow the Code of Conduct.
Changes to how a particular model is configured belong in that model's plugin: rompy-xbeach, rompy-swan or rompy-schism. rompy holds what every model shares: the run, time, grids, data and sources, rendering, backends and the command line.
Development setup¶
rompy needs Python 3.10 or later.
git clone https://github.com/YOUR-USERNAME/rompy.git
cd rompy
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
The dev extra installs pytest, coverage, ruff, black and respx. Add extra (pip install -e ".[dev,extra]") for the cloud storage and zarr dependencies.
Tests and style¶
pytest # the test suite
black src tests # format (the pre-commit hook runs black --check)
ruff check src tests # lint
Code is formatted with black at a line length of 88. Testing describes the test suite and how to write tests.
Where things go¶
rompy is extended through entry points, so most additions are a class plus a line in pyproject.toml:
| To add | Subclass | Entry point group |
|---|---|---|
| A model configuration | BaseConfig |
rompy.config |
| A data source | SourceBase |
rompy.source |
| A run backend | BaseBackendConfig and a backend class |
rompy.run |
| A postprocessor | BasePostprocessorConfig and a postprocessor class |
rompy.postprocess.config, rompy.postprocess |
| A pipeline backend | a class with execute() |
rompy.pipeline |
| A file transfer scheme | TransferBase |
rompy.transfer |
Backend internals explains how backends, postprocessors and pipeline backends are found and called.
Building the docs¶
The docs are built with ProperDocs (a maintained fork of MkDocs), Material and mkdocstrings, using the configuration shared by all rompy sites in rompy-docs:
pip install -e ".[docs,test]"
python -c "import tests.conftest" # download the example data into tests/data
properdocs serve -f mkdocs.yml # live preview
properdocs build --strict -f mkdocs.yml # what CI runs
rompy-docs check -f mkdocs.yml # compare with the shared configuration
- The reference is generated from the docstrings and Pydantic field descriptions. The docstring style is detected per docstring, so numpy and Google style both work; keep to the style of the module you are editing.
-
Examples run when the docs are built. Write examples in docstrings and pages as markdown-exec blocks; a failing example fails the strict build. Use a plain
pythonblock only for examples that need a model executable, Docker or remote data. -
Link classes to the reference with
[`ModelRun`][rompy.model.ModelRun]. Broken links fail the strict build. - Tutorials and examples live in rompy-notebooks and are published at rom-py.github.io/rompy-notebooks; link to them rather than copying them here.
Pull requests¶
- Create a branch from
main. - Make the change, with tests and docs.
- Run
pytest, the formatter and the strict docs build. - Open a pull request that says what changed and why, and reference the issue it fixes (e.g. "Fixes #123").
A maintainer reviews the change; once approved it is merged. Contributors are listed in AUTHORS.rst.
License¶
rompy is released under the Apache License 2.0. By contributing, you agree that your contributions are licensed under the same license.