Shared documentation tooling for rompy and its model plugins (rompy-xbeach, rompy-swan, rompy-schism) and the rompy-notebooks site.
The sites are built separately, one per repository, and read as one resource:
| Layer | Site |
|---|---|
| Concepts | rompy |
| Guide and reference | rompy-xbeach, rompy-swan, rompy-schism |
| Tutorials and examples | rompy-notebooks |
This package holds what they share:
- Build stack: installing
rompy-docsinstalls ProperDocs, Material, mkdocstrings, griffe-pydantic and markdown-exec at compatible versions. Sites build withproperdocs build --strict -f mkdocs.yml. - Theme files: a bar linking all the sites and shared styles, copied into each site by
rompy-docs sync. - Configuration template:
template.ymlholds themkdocs.ymlblocks every site uses.rompy-docs checkreports where a site differs. - API docs of pydantic models: the template renders fields with griffe-pydantic, including the fields a class inherits from rompy.
rompy_docs.griffe:PydanticFieldRulesapplies pydantic's field rules that griffe-pydantic's static mode misses. - Notebook links:
rompy_docs.notebookslists notebooks from the inventory the rompy-notebooks site publishes (tutorial tables, example cards, "See it in the notebooks" boxes), so package sites link notebooks without copying them. - Docstring conversion:
rompy-docs convertturns Sphinx.. ipython:: pythonand.. code-block::directives into Markdown fences. Converted examples run when the docs are built, with their output shown below the code.
-
Add
rompy-docsto thedocsextra of the package. -
Copy the blocks of
template.ymlintomkdocs.yml, then add the site's own settings, including:extra: rompy: site: xbeach # rompy, xbeach, swan, schism or notebooks
-
Run
rompy-docs syncto copy the theme files intodocs/, and commit them. -
Build with
properdocs build --strict -f mkdocs.yml. In CI, also runrompy-docs check. The config keeps themkdocs.ymlname so that other MkDocs-compatible engines, such as Zensical, can read it.
Docstrings may use numpy or google style (the template sets docstring_style: auto). Write examples in the Examples section as markdown-exec fences:
Examples
--------
```python exec="on" source="above" result="text" session="gen3"
from rompy_swan.components.physics import GEN3
print(GEN3().render())
```
The code runs at build time and its printed output appears below it. With --strict, the build fails if an example raises, so the docs build also tests the examples. Use a plain ```python fence for examples that need data files or a model run.