Thank you for your interest in contributing to AquaMVS. This guide will help you get started with development.
-
Clone the repository:
git clone https://github.com/tlancaster6/AquaMVS.git cd AquaMVS -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the package with development dependencies:
pip install -e ".[dev]" -
Run tests to verify your setup:
python -m pytest tests/
-
Formatter: Ruff (run
ruff format src/ tests/before committing) -
Linter: Ruff (run
ruff check src/ tests/to check for issues) -
Docstrings: Google style
-
Type hints: Use
numpy.typing.NDArraywith shape information in docstrings -
Imports ordering:
- Standard library imports
- Third-party imports (numpy, scipy, opencv, etc.)
- Local imports (from aquamvs)
Separate each group with a blank line.
This project uses git hooks via pre-commit to catch issues early:
- On commit: ruff lint/format, trailing whitespace, end-of-file fixer, YAML check, large file check, and secret detection (detect-secrets)
- On push: full ruff lint/format check across all files, fast test suite (
pytest -m "not slow"), and secret detection
Install both hooks after cloning:
pre-commit install
pre-commit install --hook-type pre-pushIf you modify documentation, you can verify the build locally before pushing, or let the GitHub CI catch issues after you push:
sphinx-build -W --keep-going -b html docs docs/_build/htmlRun all tests:
python -m pytest tests/Skip slow optimization tests:
python -m pytest tests/ -m "not slow"Run a single test file:
python -m pytest tests/test_calibration.py -v- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Make your changes and add tests
- Ensure all tests pass
- Format and lint your code with ruff (
ruff format src/ tests/ && ruff check src/ tests/) - Commit your changes with a clear message (see Commit Messages below)
- Push to your fork and submit a pull request
This project uses Conventional Commits for automated versioning and changelog generation. Format your commit messages as:
<type>(<scope>): <description>
[optional body]
Types:
feat:A new feature (triggers minor version bump, e.g., 1.0.0 → 1.1.0)fix:A bug fix (triggers patch version bump, e.g., 1.0.0 → 1.0.1)docs:Documentation changes onlytest:Adding or updating testsrefactor:Code changes that neither fix bugs nor add featureschore:Maintenance tasks (dependencies, tooling, etc.)
Scope (optional): The area of the codebase affected, e.g., calibration, cli, core
Examples:
feat(calibration): add support for tilted water surfacesfix(projection): correct Newton-Raphson convergence criteriondocs: update README installation instructionstest(synthetic): add test for multi-camera pose graph
When deprecating functionality in AquaMVS:
-
Add a deprecation warning using
warnings.warn()withDeprecationWarning:import warnings def old_function(): warnings.warn( "old_function() is deprecated as of version 1.2.0 and will be removed in version 1.4.0. " "Use new_function() instead.", DeprecationWarning, stacklevel=2 ) # existing implementation
-
Document in CHANGELOG.md under the "Deprecated" category:
### Deprecated - `old_function()` - Use `new_function()` instead (will be removed in 1.4.0)
-
Maintain for at least 2 minor versions before removal.
-
Document the replacement in the function's docstring:
def old_function(): """Original description. .. deprecated:: 1.2.0 Use :func:`new_function` instead. Will be removed in version 1.4.0. """
Always include stacklevel=2 in warnings to show the caller's location, not the warning itself.