Thank you for your interest in contributing to Koality! We welcome contributions from the community.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to pit@ottogroup.com.
If you find a bug, please open an issue with:
- A clear, descriptive title
- Steps to reproduce the issue
- Expected vs. actual behavior
- Your environment (Python version, OS, koality version)
Feature suggestions are welcome! Please open an issue describing:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
- Fork the repository and create your branch from
main - Set up your development environment (see below)
- Make your changes and ensure tests pass
- Submit a pull request with a clear description of your changes
- Python 3.12 or higher
- uv (recommended) or pip
# Clone your fork
git clone https://github.com/YOUR_USERNAME/koality.git
cd koality
# Create a virtual environment and install dependencies
uv sync --group dev
# Also install the docs tools (Zensical needs a regular, not free-threaded, CPython such as 3.13)
uv sync --group dev --group docs
# Or with pip
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e . --group dev --group docs # pip >= 25.1# Run all tests
poe test
# Run unit tests only
poe test_unit
# Run integration tests only
poe test_integration
# Run all tests with line and branch coverage (fails below the 85% set in pyproject.toml;
# CI additionally runs the live BigQuery tests, so its coverage is a little higher)
pytest --cov=koality --cov-report=term-missing tests/Codecov checks pull requests against an 85% project target and an 80% target for the changed lines.
tests/integration/test_backend_contract.py runs every check type on every
backend. Besides the local backends, it covers backends that need a service,
emulated in Docker containers that testcontainers
starts and removes for the test session:
| Backend | Emulation |
|---|---|
| Postgres | postgres image, attached with DuckDB's postgres extension; results are also written to it |
| Parquet and CSV files on S3 | moto server, read with httpfs |
| Iceberg | apache/iceberg-rest-fixture with its warehouse on moto, attached with the iceberg extension; results are also written to it |
| BigQuery | goccy/bigquery-emulator, attached with the bigquery extension |
These tests are marked services and excluded from poe test. They need Docker
and the services dependency group:
uv sync --group services
poe test_services # sets KOALITY_SERVICES=1, without which the tests are skippedWith Colima instead of Docker Desktop, point testcontainers at Colima's socket first:
export DOCKER_HOST="unix://$HOME/.colima/default/docker.sock"
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sockThese are emulators, not the real services: they check the SQL koality writes and
the DuckDB extensions it goes through, not every behaviour of the service. Only
Postgres is the real database; moto is a community S3 mock, the Iceberg image is
the Iceberg project's REST catalog test fixture, and the BigQuery emulator is a
community project (Google has none). For BigQuery, the live tests below remain the
authoritative check. The images are pinned in the test module. The BigQuery emulator serves the Storage
Read API without TLS, which the bigquery extension does not support, so these
tests read results through the REST API (BigQueryBackend.query_options). CI runs
the suite in the Tests workflow's "Contract suite against emulated services" job.
tests/live/ contains tests that run against a real BigQuery project instead
of DuckDB's in-memory engine. They are excluded from poe test and skipped
automatically unless explicitly enabled, since they require real GCP
credentials, a fixture table, and may incur BigQuery costs.
To run them locally, authenticate with Application Default
Credentials
(e.g. gcloud auth application-default login, or a Workload Identity
Federation-derived credential), then:
export KOALITY_BIGQUERY_LIVE=1
export KOALITY_BIGQUERY_PROJECT=my-gcp-project
export KOALITY_BIGQUERY_DATASET=my_dataset
export KOALITY_BIGQUERY_TABLE=my_table
export KOALITY_BIGQUERY_COLUMN=my_column
poe test_bigquery_liveIn CI, this suite runs as part of the Tests workflow (single ubuntu-latest
- Python 3.15 leg only, to avoid running it 5x per push across the full OS/
Python matrix) and the
Coverageworkflow, authenticating through Workload Identity Federation rather than a static service account key. Pull requests from forks, and Dependabot's, get no repository secrets, so both workflows skip the live tests there (with a notice in the log); the rest of the suite still runs, and its coverage alone stays above the threshold. Codecov's patch check can then count lines only the live tests reach (e.g. in the BigQuery backend) as uncovered. A push or manual run always runs the live tests, so a missing secret fails it.
We use Ruff for linting and formatting. It also formats the Python examples in
docstrings (>>> doctests and ```python blocks), but doesn't lint them. poe test and poe test_unit run
the doctests in src/, and tests/unit/test_docstring_examples.py runs every ```python (or unlabeled)
example on its own and checks it with ruff and ty, so an example imports what it uses.
Ruff's formatter drops the blank line after a non-Python code block (e.g. ```yaml) that ends a
docstring, which the linter requires (D413), so put such an example before the docstring's last section.
# Format code
poe format
# Check linting
poe lint# Check for vulnerable dependencies
poe check_vulnerable_dependencies
# Check for unused dependencies
poe check_unused_dependencies
# Check GitHub Actions security
poe check_githubactionsThe docs are built with Zensical, configured in zensical.toml; the API reference is
rendered by mkdocstrings from the source in src/. Custom icons (e.g. the footer's one.O marks) live in
overrides/.icons/koality/; overrides/404.html redirects links to the former versioned docs. Zensical needs a
regular (not free-threaded) CPython build.
# Serve docs locally with live reload
poe docs_serve
# Build the docs into site/, failing on Zensical warnings such as broken links (griffe docstring warnings do not fail it)
poe docs_buildCI runs the same strict build on every pull request (the Lint workflow's docs job).
The docs are not versioned: publishing a release (not a pre-release) builds them and deploys them to GitHub Pages
(.github/workflows/release.yml), so https://ottogroup.github.io/koality/ shows the newest release. The deploy waits
until the release's version is on PyPI (uploaded by the same workflow's release job), and fails if it isn't after 10
minutes; a release older than the newest one (e.g. a backport) doesn't replace the docs. A release's docs show its
version in the header; docs built from another ref (e.g. a manual run from main) show a banner saying they describe
the development version, and local builds (poe docs_serve) one saying they're a local build (overrides/main.html).
This needs the repository's Pages source set to "GitHub Actions" (Settings → Pages) and the github-pages
environment's deployment rules to allow release tags (v*), since the workflow deploys from the release's tag; both
are set. To redeploy the docs, run the workflow manually from the latest release's tag. A manual run publishes to
PyPI only when its publish input is checked and it runs from a release tag.
- Follow the existing code style
- Write clear commit messages
- Add tests for new functionality
- Update documentation as needed
- Keep pull requests focused on a single change
- Ensure all CI checks pass
koality/
├── src/koality/ # Main source code
├── tests/ # Test files
├── docs/ # Documentation
└── pyproject.toml # Project configuration
Feel free to open an issue or reach out to the maintainers.
Thank you for contributing!