Contributing

Dev setup

Clone the repository and set up the development environment:

$ git clone <repo-url>
$ cd sawmill
$ source sourceme

The sourceme script creates a virtual environment in .venv/ using uv and installs all dependencies (including dev extras). To recreate the environment from scratch:

$ source sourceme --clean

Running tests

Run the full test suite:

$ pytest tests/ -v

Run a specific test file:

$ pytest tests/core/test_filter.py -v

Run with coverage:

$ pytest tests/ --cov=sawmill --cov-report=term-missing

Test file naming mirrors the source structure: sawmill/core/filter.py maps to tests/core/test_filter.py.

Pre-commit hooks

The project uses pre-commit with hooks configured in .pre-commit-config.yaml:

  • Trailing whitespace and end-of-file fixers

  • YAML/TOML syntax validation

  • Debug statement detection

  • Ruff linting and formatting

  • mypy type checking

Install hooks:

$ pre-commit install

Run manually:

$ pre-commit run --all-files

Building docs

Install documentation dependencies and build:

$ uv sync --all-extras
$ python -m sphinx -b html docs docs/_build/html

The built documentation is in docs/_build/html/. Open docs/_build/html/index.html in a browser to review.