Contributing¶
Thank you for your interest in contributing to TracePipe!
Development Setup¶
Prerequisites¶
- Python 3.9+
- uv (recommended) or pip
Setup¶
# Clone the repository
git clone https://github.com/tracepipe/tracepipe.git
cd tracepipe
# Install with uv (recommended)
uv sync --all-extras
# Or with pip
pip install -e ".[dev]"
Verify Setup¶
# Run tests
uv run pytest tests/ -v
# Run linting
uv run task lint
# Run full checks
uv run task check
Development Workflow¶
1. Create a Branch¶
2. Make Changes¶
- Write code following the existing style
- Add tests for new functionality
- Update documentation as needed
3. Run Tests¶
# Run all tests
uv run pytest tests/ -v
# Run specific test file
uv run pytest tests/test_api.py -v
# Run with coverage
uv run pytest tests/ --cov=tracepipe --cov-report=term-missing
4. Run Linting¶
5. Submit PR¶
- Push your branch
- Create a Pull Request
- Fill out the PR template
Code Style¶
Python Style¶
- Follow PEP 8
- Use type hints for all public functions
- Maximum line length: 100 characters
- Use Black for formatting
- Use Ruff for linting
Docstrings¶
Use Google-style docstrings:
def example_function(param1: str, param2: int = 10) -> bool:
"""Short description of the function.
Longer description if needed. Can span multiple lines.
Args:
param1: Description of param1.
param2: Description of param2. Defaults to 10.
Returns:
Description of return value.
Raises:
ValueError: When param1 is empty.
Example:
>>> example_function("test")
True
"""
Testing¶
- Place tests in
tests/directory - Name test files
test_*.py - Name test functions
test_* - Use pytest fixtures for setup
- Aim for high coverage on new code
Project Structure¶
tracepipe/
├── tracepipe/ # Main package
│ ├── __init__.py # Public API exports
│ ├── api.py # Core API functions
│ ├── contracts.py # Contract builder
│ ├── convenience.py # check/trace/why functions
│ ├── core.py # Configuration and context
│ ├── instrumentation/ # Pandas monkey-patching
│ │ ├── pandas_inst.py # Main instrumentation
│ │ ├── filter_capture.py
│ │ └── ...
│ └── storage/ # Lineage storage
│ ├── lineage_store.py
│ └── row_identity.py
├── tests/ # Test suite
├── examples/ # Example scripts
├── docs/ # Documentation
└── benchmarks/ # Performance benchmarks
Adding Features¶
1. New Pandas Operation Support¶
To add tracking for a new pandas operation:
- Identify the operation type (filter, transform, merge, etc.)
- Add wrapper in appropriate
tracepipe/instrumentation/module - Register in
pandas_inst.py - Add tests in
tests/ - Document in README and docs
2. New Contract Expectation¶
To add a new contract expectation:
- Add method to
ContractBuilderincontracts.py - Implement validation logic
- Add tests in
tests/test_contracts.py - Document in
docs/guide/contracts.md
Running Benchmarks¶
Documentation¶
Local Preview¶
# Install mkdocs
pip install mkdocs mkdocs-material mkdocstrings[python]
# Serve locally
mkdocs serve
Building Docs¶
Release Process¶
Releases are managed by maintainers:
- Update version in
pyproject.toml - Update CHANGELOG.md
- Create git tag
- GitHub Actions builds and publishes to PyPI
Getting Help¶
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Tag maintainers for urgent issues
Code of Conduct¶
Please be respectful and inclusive. We follow the Contributor Covenant.