Contributing to piblin-jax
We welcome contributions to piblin-jax! This guide will help you get started.
Development Setup
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/piblin_jax.git cd piblin-jax
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
Code Style
piblin-jax follows these style guidelines:
ruff for code formatting and linting (line length 100, replaces black/isort/flake8)
mypy for type checking (strict mode)
NumPy-style docstrings for documentation
Pre-commit hooks will automatically check these before each commit.
Running Tests
Run the full test suite:
pytest
Run tests with coverage:
pytest --cov=piblin_jax --cov-report=html
Run only fast tests:
pytest -m "not slow"
Run benchmarks:
pytest -m benchmark
Type Checking
Run mypy type checking:
mypy piblin_jax
Building Documentation
Build the documentation locally:
cd docs
make html
open _build/html/index.html
Adding New Features
Adding a New Transform
Create the transform class in
piblin_jax/transform/Inherit from appropriate base class (DatasetTransform, etc.)
Implement
_apply()method with JAX operationsAdd NumPy fallback if needed
Write tests in
tests/transform/Add docstring with NumPy style
Add to API documentation
Adding a New Bayesian Model
Create model class in
piblin_jax/bayesian/models/Inherit from
BayesianModelImplement
model()method with NumPyroDefine priors for parameters
Write tests in
tests/bayesian/models/Add usage example in docstring
Pull Request Process
Create a feature branch:
git checkout -b feature/your-feature-name
Make your changes with clear, atomic commits
Write tests for your changes (>95% coverage required)
Update documentation as needed
Run the full test suite and pre-commit hooks
Push to your fork and create a pull request
Pull Request Checklist
[ ] Tests pass locally
[ ] Code coverage >95%
[ ] Pre-commit hooks pass
[ ] Documentation updated
[ ] Changelog entry added
[ ] Type hints added
[ ] NumPy-style docstrings
Reporting Issues
When reporting bugs, please include:
Python version
piblin-jax version
Operating system
JAX version and backend (CPU/GPU)
Minimal reproducible example
Error messages and stack traces
Questions and Support
GitHub Issues: Bug reports and feature requests
Discussions: Questions and general discussion
License
By contributing to piblin-jax, you agree that your contributions will be licensed under the MIT License.