Contributing¶
Thank you for your interest in contributing to rompy-xbeach!
Development Setup¶
- Clone the repository:
- Create a virtual environment:
- Install in development mode:
- Run tests:
Code Style¶
We use ruff for linting and formatting:
Testing¶
Run the full test suite:
Run specific tests:
Adding New Components¶
When adding new XBeach parameters or components:
-
Find the right location — Use the component hierarchy (physics, sediment, output, etc.)
-
Follow existing patterns — Look at similar components for structure
-
Add validation — Use Pydantic's
Fieldwithge,le,gt,ltfor ranges -
Document fields — Every field needs a
descriptionwith XBeach default noted -
Add tests — Test validation, serialisation, and integration
Example: Adding a New Parameter¶
from typing import Optional
from pydantic import Field
from rompy_xbeach.types import XBeachBaseModel
class MyComponent(XBeachBaseModel):
"""Description of the component."""
my_param: Optional[float] = Field(
default=None,
description="Description of parameter (XBeach default: 1.0)",
ge=0.0, # Greater than or equal
le=10.0, # Less than or equal
)
Example: Adding a Process Switch¶
For parameters that enable a feature with optional configuration:
from typing import Optional, Union
from pydantic import Field
class Physics(XBeachBaseModel):
my_feature: Optional[Union[bool, MyFeatureConfig]] = Field(
default=None,
description="Enable my feature",
)
Documentation¶
Documentation uses MkDocs with Material theme.
Build locally:¶
Add new pages:¶
- Create markdown file in
docs/ - Add to
navsection inmkdocs.yml
API documentation:¶
Use mkdocstrings directives:
Pull Request Process¶
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Run tests:
pytest tests/ - Run linting:
ruff check src/ - Commit with clear message
- Push and create PR
Questions?¶
Open an issue on GitHub or reach out to the maintainers.