Contributing¶
Thank you for your interest in contributing to the Consequences Solution! This guide covers everything you need to get started — from setting up your environment to building and releasing the package.
Getting Started¶
Prerequisites¶
- Python 3.10 or higher
- uv package manager
- Git
Clone the Repository¶
Install Dependencies¶
This installs all project and development dependencies (including pytest, build, etc.) into an isolated virtual environment managed by uv.
Development Workflow¶
Branching¶
Follow this branching convention:
| Branch type | Pattern | Example |
|---|---|---|
| Feature | feature/<description> |
feature/add-coastal-validation |
| Bug fix | fix/<description> |
fix/depth-raster-parsing |
| Release | release/<version> |
release/0.2.0 |
Always branch from main:
Running Tests¶
To run only a specific test file:
To run tests excluding manual tests:
Code Style¶
Markdown files are formatted with mdformat and checked in CI on every PR and push to main. Run it locally before pushing to avoid CI failures:
uv run mdformat $(find docs -name '*.md' ! -name 'building_inventories.md' ! -name 'index.md' ! -name 'gh_installation.md') *.md
To only check without modifying:
uv run mdformat --check $(find docs -name '*.md' ! -name 'building_inventories.md' ! -name 'index.md' ! -name 'gh_installation.md') *.md
Building the Package¶
The package is built as a Python wheel (.whl) using Hatchling via the build frontend.
Build the Wheel¶
From the repository root, run:
The output will be in dist/:
Verify the Wheel Contents¶
Confirm that inland_consequences/, sphere/core/, sphere/data/, and sphere/flood/ are all present.
Test the Wheel in a Clean Environment¶
uv venv /tmp/test_whl_env
source /tmp/test_whl_env/bin/activate
uv pip install dist/inland_consequences-0.1.0-py2.py3-none-any.whl
inland-consequences-check
deactivate
rm -rf /tmp/test_whl_env
The inland-consequences-check CLI entry point runs a smoke test that validates all public modules and classes are importable.
Releasing¶
Releases are fully automated via the .github/workflows/release.yml GitHub Action. Pushing a version tag triggers the workflow, which builds the wheel and publishes a GitHub Release with the .whl attached automatically.
Pre-release (rc / test)¶
Use a tag containing rc, alpha, beta, test, or dev to publish a pre-release — useful for testing install docs on a clean machine before cutting a final release.
GitHub will mark the release as Pre-release automatically. To clean it up afterward:
# Delete the remote tag
git push origin --delete v0.1.0-rc.1
# Delete the local tag
git tag -d v0.1.0-rc.1
Also delete the corresponding release on the Releases page.
Full Release¶
1. Prepare the Release Branch¶
Update the version in pyproject.toml, commit all changes, and open a PR.
2. Tag and Push¶
Once the release branch is ready:
The workflow triggers automatically, builds the wheel, and publishes a GitHub Release with auto-generated release notes.
3. Merge to Main¶
Note
The wheel binary should not be committed to version control. The workflow attaches it as a GitHub Release asset automatically.
Submitting Changes¶
- Ensure all tests pass:
uv run pytest - Ensure pre-commit hooks pass:
uv run pre-commit run --all-files - Push your branch and open a Pull Request against
main. - Provide a clear description of the change and any relevant context.
- A maintainer will review and merge your PR.
Reporting Issues¶
Please open an issue on GitHub with:
- A clear description of the bug or feature request
- Steps to reproduce (for bugs)
- Expected vs. actual behavior
- Python version and OS