Contributing¶
How to contribute to PILS.
Getting Started¶
Prerequisites¶
- Python 3.10+
- Git
- Conda (recommended)
Development Setup¶
# Fork and clone
git clone https://github.com/YOUR_USERNAME/pils.git
cd pils
# Create conda environment
conda create -n dm python=3.10
conda activate dm
# Install in development mode
pip install -e ".[dev]"
# Verify installation
pytest tests/ -v
Git Workflow¶
Branch Naming¶
Commit Messages¶
Follow conventional commits:
feat: add barometer sensor support
fix: correct GPS timestamp parsing
docs: update installation guide
test: add IMU synchronization tests
refactor: simplify loader interface
Pull Request Process¶
- Create branch from
main - Write tests first (TDD)
- Implement feature
- Run tests and linting
- Push and create PR
- Address review comments
- Merge when approved
# Create feature branch
git checkout -b feature/new-feature
# Make changes and commit
git add .
git commit -m "feat: add new feature"
# Push to fork
git push origin feature/new-feature
# Create PR on GitHub
Code Standards¶
Must Follow¶
- [x] Type hints on all functions
- [x] Docstrings for public functions
- [x] Tests before implementation (TDD)
- [x] Polars for all DataFrames
- [x] Pathlib for file operations
- [x] F-strings for formatting
- [x] Logging, not print statements
Formatting¶
# Format code
black pils/ tests/
# Sort imports
isort pils/ tests/
# Lint
flake8 pils/ tests/
# Type check
mypy pils/
# Run all
black pils/ && isort pils/ && flake8 pils/ && mypy pils/
Test-Driven Development¶
TDD Cycle¶
- RED: Write failing test
- GREEN: Write minimal code to pass
- REFACTOR: Improve code quality
Example¶
# 1. Write test first
def test_barometer_load():
"""Test barometer data loading."""
baro = Barometer(file=Path("baro.csv"))
assert baro.data.shape[0] > 0
# 2. Run test - it fails (RED)
# pytest tests/test_barometer.py -v
# 3. Write implementation
class Barometer:
def __init__(self, file: Path):
self.file = file
self._data = None
@property
def data(self) -> pl.DataFrame:
if self._data is None:
self._data = pl.read_csv(self.file)
return self._data
# 4. Run test - it passes (GREEN)
# 5. Refactor if needed
Adding New Features¶
New Sensor¶
See Adding Sensors guide.
New Loader¶
- Create
pils/loader/new_loader.py - Implement
load_single_flight()method - Add tests in
tests/test_new_loader.py - Update documentation
New Analysis Module¶
- Create
pils/analyze/new_analysis.py - Follow existing patterns (PPK, RTK)
- Add comprehensive tests
- Document API and usage
Pull Request Template¶
## Description
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation
- [ ] Refactoring
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] Code formatted (black, isort)
- [ ] Linting passes (flake8)
- [ ] Type hints added
- [ ] All tests pass
## Related Issues
Fixes #123
Code Review¶
What We Look For¶
- [ ] Tests cover new functionality
- [ ] Code follows style guide
- [ ] Type hints present
- [ ] Docstrings complete
- [ ] No breaking changes (or documented)
- [ ] Performance considerations
Review Etiquette¶
For Reviewers:
- Be constructive and specific
- Explain the "why" behind suggestions
- Approve when ready, don't nitpick
For Authors:
- Respond to all comments
- Ask clarifying questions
- Don't take feedback personally
Issue Reporting¶
Bug Reports¶
Include:
- Environment: Python version, OS, PILS version
- Steps to reproduce: Minimal code example
- Expected behavior: What should happen
- Actual behavior: What happens
- Error messages: Full traceback
Feature Requests¶
Include:
- Use case: Why is this needed?
- Proposed solution: How might it work?
- Alternatives: Other approaches considered
Documentation¶
When to Update Docs¶
- New features → Add to relevant section
- API changes → Update API reference
- Bug fixes → Update if behavior changed
- Examples → Add practical examples
Doc Standards¶
- Use MkDocs Material syntax
- Include code examples
- Cross-reference related pages
- Keep examples tested and working
Release Process¶
Versioning¶
PILS uses Semantic Versioning:
MAJOR.MINOR.PATCH
1.0.0 → 1.0.1 # Patch: Bug fixes
1.0.1 → 1.1.0 # Minor: New features (backward compatible)
1.1.0 → 2.0.0 # Major: Breaking changes
Release Checklist¶
- [ ] All tests pass
- [ ] Changelog updated
- [ ] Version bumped
- [ ] Documentation current
- [ ] Tag created
Getting Help¶
- Questions: Open a Discussion
- Bugs: Open an Issue
- Security: Email security@polocalc.com
See Also¶
- Testing - Testing practices
- Code Style - Style guide
- Adding Sensors - Extend PILS