Contributing to Open Geodata APIο
We welcome contributions from the community! This guide will help you get started with contributing to Open Geodata API.
Ways to Contributeο
- π Bug Reports
Found a bug? Report it on our GitHub Issues page with detailed information.
- β¨ Feature Requests
Have an idea for a new feature? Create a feature request issue.
- π Documentation
Help improve our documentation, examples, or tutorials.
- π» Code Contributions
Submit bug fixes, new features, or performance improvements.
- π§ͺ Testing
Help expand our test coverage or improve existing tests.
- π Examples
Create real-world examples and use cases.
Getting Startedο
Development Setupο
Fork the repository on GitHub
Clone your fork:
git clone https://github.com/YOUR_USERNAME/open-geodata-api.git
cd open-geodata-api
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install development dependencies:
pip install -e .[dev]
Install pre-commit hooks:
pre-commit install
Run tests to verify setup:
pytest
Development Workflowο
Create a feature branch:
git checkout -b feature/your-feature-name
Make your changes following our coding standards
Run tests:
pytest
pytest --cov=open_geodata_api # With coverage
Check code style:
black .
flake8
mypy open_geodata_api/
Commit your changes:
git add .
git commit -m "feat: add your feature description"
Push to your fork:
git push origin feature/your-feature-name
Create a Pull Request on GitHub
Coding Standardsο
Code Styleο
We use Black for code formatting and flake8 for linting:
# Format code
black .
# Check style
flake8
# Type checking
mypy open_geodata_api/
Key Style Guidelines:
Use Black default formatting (88 character line length)
Follow PEP 8 naming conventions
Use type hints for all public functions
Write descriptive docstrings for all public APIs
Keep functions focused and single-purpose
Documentation Styleο
Docstring Format (Google style):
def search_items(collections, bbox=None, datetime=None):
"""Search for satellite data items.
Args:
collections: List of collection names to search
bbox: Bounding box as [west, south, east, north]
datetime: Date range as string or datetime objects
Returns:
STACItemCollection: Collection of found items
Raises:
ValueError: If collection names are invalid
Example:
>>> pc = ogapi.planetary_computer()
>>> results = pc.search(['sentinel-2-l2a'], bbox=[-122, 47, -121, 48])
>>> items = results.get_all_items()
"""
Comment Guidelines:
Use comments sparingly for complex logic
Prefer self-documenting code with clear variable names
Add TODO comments for future improvements
Use docstrings for all public functions and classes
Testing Guidelinesο
Test Structureο
We use pytest for testing:
tests/
βββ conftest.py # Shared fixtures
βββ test_clients.py # Client class tests
βββ test_core.py # Core STAC class tests
βββ test_utils.py # Utility function tests
βββ test_integration.py # Integration tests
βββ fixtures/ # Test data
βββ sample_item.json
βββ sample_collection.json
Writing Testsο
Test Naming:
def test_search_returns_items():
"""Test that search returns expected items."""
def test_search_with_invalid_collection_raises_error():
"""Test error handling for invalid collections."""
Test Structure:
def test_feature_functionality():
# Arrange
client = create_test_client()
expected_result = "expected_value"
# Act
result = client.some_method()
# Assert
assert result == expected_result
Mocking External APIs:
@patch('requests.post')
def test_search_calls_api_correctly(mock_post):
mock_post.return_value.json.return_value = sample_response
client = PlanetaryComputerCollections()
result = client.search(['sentinel-2-l2a'])
mock_post.assert_called_once()
Test Coverageο
Aim for >90% test coverage
Test happy paths and error conditions
Include integration tests for complete workflows
Mock external API calls in unit tests
Use real API calls in integration tests (sparingly)
Run coverage reports:
pytest --cov=open_geodata_api --cov-report=html
open htmlcov/index.html # View coverage report
Pull Request Processο
Pull Request Guidelinesο
Before Submitting:
β All tests pass
β Code follows style guidelines
β Documentation is updated
β CHANGELOG.md is updated (for significant changes)
β Commit messages follow convention
PR Description Template:
## Description
Brief description of changes made.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Added tests for new functionality
- [ ] All existing tests pass
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Documentation updated
- [ ] Self-review completed
Commit Message Conventionο
We follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types: - feat: New feature - fix: Bug fix - docs: Documentation changes - style: Code style changes (formatting, etc.) - refactor: Code refactoring - test: Adding or updating tests - chore: Maintenance tasks
Examples:
feat(core): add support for asset filtering
fix(cli): resolve URL encoding issue in download command
docs(examples): add real-world agricultural monitoring example
test(utils): increase coverage for download functions
Review Processο
What We Look For:
β Functionality: Does the code work as intended?
β Testing: Are there adequate tests?
β Documentation: Is the change properly documented?
β Style: Does it follow our coding standards?
β Performance: Any performance implications?
β Breaking Changes: Are they necessary and documented?
Review Timeline: - Initial response: Within 1-2 weeks - Code review: Depends on complexity - Merge: After approval and CI passes
Release Processο
Versioningο
We follow Semantic Versioning (SemVer):
MAJOR (X.0.0): Breaking changes
MINOR (0.X.0): New features, backwards compatible
PATCH (0.0.X): Bug fixes, backwards compatible
Release Workflowο
Create release branch:
release/vX.Y.ZUpdate version in
__init__.pyUpdate CHANGELOG.md
Run full test suite
Create release PR
Tag release after merge
Publish to PyPI (automated)
Community Guidelinesο
Code of Conductο
We follow the Contributor Covenant Code of Conduct:
Be respectful and inclusive
Be collaborative and helpful
Be patient with newcomers
Focus on the project goals
Respect different perspectives
Communicationο
Preferred Channels: - GitHub Issues: Bug reports, feature requests - GitHub Discussions: Questions, sharing ideas - Pull Requests: Code review and discussion
Response Expectations: - We aim to respond to issues within a week - Complex issues may take longer to resolve - Community contributions help everyone
Getting Recognitionο
Contributors Hall of Fameο
All contributors are recognized in:
README.md: Contributors section
Documentation: Acknowledgments page
Release Notes: Major contribution highlights
Recognition Levels: - Contributor: Any merged PR - Regular Contributor: Multiple significant PRs - Core Contributor: Ongoing significant contributions - Maintainer: Trusted with repository access
Becoming a Maintainerο
Path to Maintainer Status:
Consistent Contributions: Regular, high-quality PRs
Community Involvement: Helping others, reviewing PRs
Domain Expertise: Deep understanding of codebase
Reliability: Following through on commitments
Leadership: Guiding project direction
Maintainer Responsibilities: - Review and merge pull requests - Triage issues and discussions - Guide project roadmap - Mentor new contributors - Maintain code quality standards
Resources for Contributorsο
Learning Resources: - Python packaging guide - Pytest documentation - STAC specification
Development Tools: - Black code formatter - Flake8 linter - MyPy type checker - Pre-commit hooks
Project Resources: - GitHub Repository: https://github.com/Mirjan-Ali-Sha/open-geodata-api - Documentation: https://open-geodata-api.readthedocs.io - PyPI Package: https://pypi.org/project/open-geodata-api - Examples Repository: https://github.com/Mirjan-Ali-Sha/open-geodata-api-examples
Thank you for contributing to Open Geodata API! Your contributions help make satellite data more accessible to everyone. ππ°οΈ