Thank you for your interest in contributing to GridFIA! This document provides guidelines and instructions for contributing.
- Python 3.10+
- uv package manager (recommended)
- Git
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/gridfia.git cd gridfia -
Create a virtual environment and install dependencies
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e ".[dev,test,docs]"
-
Verify installation
uv run pytest tests/unit/ -v --tb=short
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes with clear, atomic commits
-
Push to your fork and submit a pull request
We follow these conventions:
- Formatting: Black (88 character line length)
- Import sorting: isort
- Type hints: Required for all public functions
- Docstrings: NumPy style
Run formatters before committing:
uv run black gridfia/ tests/
uv run isort gridfia/ tests/uv run mypy gridfia/- Run all tests:
uv run pytest - Run with coverage:
uv run pytest --cov=gridfia --cov-report=term-missing - Run specific test file:
uv run pytest tests/unit/test_api.py
We maintain a minimum of 80% test coverage. All new features must include tests.
-
Update documentation for any new features or API changes
-
Add tests for new functionality
-
Ensure CI passes - all tests and linting must pass
-
Write a clear PR description explaining:
- What changes were made
- Why they were made
- How to test them
-
Request review from maintainers
Use conventional commit format:
feat: Add new featurefix: Fix bug in Xdocs: Update documentationrefactor: Refactor X for claritytest: Add tests for X
gridfia/
├── api.py # Main API interface
├── config.py # Configuration management
├── exceptions.py # Custom exceptions
├── core/
│ ├── calculations/ # Forest metric calculations
│ ├── processors/ # Data processing pipelines
│ └── analysis/ # Statistical analysis
├── external/ # External service clients
├── utils/ # Utility modules
└── visualization/ # Mapping and plotting
- Create a new class in
gridfia/core/calculations/ - Inherit from
ForestCalculationbase class - Implement
calculate()andvalidate_data()methods - Register with
@registry.register("name")decorator - Add tests in
tests/unit/test_calculations.py
Example:
from gridfia.core.calculations.base import ForestCalculation
from gridfia.core.calculations.registry import registry
@registry.register("my_calculation")
class MyCalculation(ForestCalculation):
def __init__(self, **kwargs):
super().__init__(
name="my_calculation",
description="Description of calculation",
units="units",
**kwargs
)
def calculate(self, biomass_data: np.ndarray, **kwargs) -> np.ndarray:
# Implementation
pass
def validate_data(self, biomass_data: np.ndarray) -> bool:
return biomass_data.ndim == 3 and biomass_data.shape[0] > 0When reporting issues, please include:
- Description of the problem
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment (OS, Python version, GridFIA version)
- Error messages or stack traces if applicable
- Open a GitHub Discussion
- Check existing Issues
By contributing, you agree that your contributions will be licensed under the MIT License.