Thanks for your interest in contributing to Timber! This guide will help you get set up.
# Clone the repo
git clone https://github.com/kossisoroyce/timber.git
cd timber
# Install in development mode with all dependencies
pip install -e ".[dev]"
# Verify everything works
pytest tests/ -vRequirements:
- Python 3.10+
- A C compiler (
gccorclang) for shared library compilation pytestfor testing (installed with[dev]extras)
# Full suite (146 tests)
pytest tests/ -v
# Specific test file
pytest tests/test_store.py -v
# Specific test
pytest tests/test_store.py::TestModelStore::test_load_model -v
# With coverage
pytest tests/ --cov=timber --cov-report=htmltimber/
├── ir/ # Intermediate Representation (data model)
├── frontends/ # Model format parsers
│ ├── xgboost_parser.py
│ ├── lightgbm_parser.py
│ ├── sklearn_parser.py
│ ├── catboost_parser.py
│ ├── onnx_parser.py
│ └── auto_detect.py
├── optimizer/ # IR optimization passes (6 passes)
│ ├── pipeline.py # Pass orchestration
│ ├── dead_leaf.py
│ ├── constant_feature.py
│ ├── threshold_quant.py
│ ├── branch_sort.py
│ ├── pipeline_fusion.py
│ └── vectorize.py
├── codegen/ # Code generation backends
│ ├── c99.py # Primary C99 emitter
│ ├── wasm.py # WebAssembly emitter
│ └── misra_c.py # MISRA-C compliance emitter
├── runtime/ # Python ctypes predictor
├── audit/ # Audit report generation
├── store.py # Local model store (~/.timber/models/)
├── serve.py # HTTP inference server
└── cli.py # CLI entry point
- Create
timber/frontends/<framework>_parser.py - Implement a
parse_<framework>_model(path: str) -> TimberIRfunction - Register it in
timber/frontends/auto_detect.py:- Add format detection in
detect_format() - Add dispatch in
parse_model()
- Add format detection in
- Add tests in
tests/test_<framework>_parser.py
- Create
timber/optimizer/<pass_name>.py - Implement the pass as a function taking
TimberIRand returningTimberIR - Register it in
timber/optimizer/pipeline.pyin therun()method - Add tests
- Create
timber/codegen/<backend>.py - Follow the pattern of
c99.py— take aTimberIR, return adict[str, str]of filename → content - Add tests
- Follow existing code patterns and naming conventions
- Type hints on all function signatures
- Docstrings on public classes and functions
- No additional comments unless they clarify non-obvious logic
- Fork the repo and create a feature branch from
main - Write tests for your changes
- Ensure all 146+ tests pass:
pytest tests/ -v - Keep commits focused and well-described
- Open a PR with a clear description of what and why
Use GitHub Issues with the provided templates:
- Bug Report: Include model format, error message, and steps to reproduce
- Feature Request: Describe the use case and proposed approach
By contributing, you agree that your contributions will be licensed under Apache-2.0.