Thanks for your interest in improving timescaledb. This guide covers setting up
a development environment, running the tests and checks, and the release process.
By contributing you agree that your work is licensed under the project's MIT License.
- Python 3.11, 3.12, 3.13, or 3.14
- Docker running locally (Docker Desktop, Colima, OrbStack, …). The test
suite starts a real TimescaleDB container via
testcontainers, so a working Docker daemon is required to run the tests.
Either uv or a plain venv works. The CI uses
uv.
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install the package in editable mode
uv pip install -e .
# Install the dev/test tooling
uv pip install -r requirements.dev.txtpython -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
pip install -r requirements.dev.txtrequirements.dev.txt pulls in tox, coverage, pytest, bump2version,
pre_commit, and testcontainers[postgres].
The tests need no manual database setup; testcontainers starts a
throwaway TimescaleDB container and tears it down afterwards. Make sure Docker is
running first.
Run the tests directly with pytest:
python -m pytest testsOr run them across an interpreter with tox (the locked dependency sets for
each Python version live in tests/requirements/):
# all configured interpreters (py311–py314)
tox
# a single interpreter, e.g. 3.12
tox run -f py312The first run is slow because Docker pulls the TimescaleDB image; subsequent runs reuse the cached image.
tox runs the suite under coverage. To combine results and view a report
(CI fails under 85%):
coverage combine
coverage reportThe samples/ directory has its own fully-tested example projects
with their own dependencies. See samples/README.md for
how to run those suites.
For manual experimentation against a persistent database instead of throwaway
containers, a compose.yaml is provided:
docker compose up -d
# DATABASE_URL=postgresql+psycopg://timescaledb:timescaledb@localhost:5432/timescaledb
docker compose down -v # stop + wipe when finishedBoth run in CI and should pass before opening a PR.
# flake8 (config lives in the [flake8] section of tox.ini)
flake8 src tests
# mypy (strict mode, configured in [tool.mypy] in pyproject.toml)
mypy src/timescaledbImports are sorted with isort (force_single_line, black profile); see the
[tool.isort] config in pyproject.toml. A pre-commit config can be installed
with pre-commit install if you use it.
- Keep PRs focused on a single change.
- Add or update tests for any behavior change; new helpers should ship with coverage (CI enforces an 85% floor).
- Make sure
flake8,mypy, and the test suite pass locally. - Update the
README.mdand/orsamples/when you add or change public API. - Do not bump the version in your PR; releases are cut separately (see below).
Releases are published to PyPI by CI
when a tag is pushed. Versioning is MAJOR.MINOR.PATCH and driven by
bump2version (config in
.bumpversion.cfg, which updates pyproject.toml and
src/timescaledb/__init__.py).
-
On
main, bump the version.bump2versionis configured to create the commit and the git tag automatically (commit = True,tag = True):bump2version patch # or: minor / major -
Push the commit and the tag:
git push origin main --follow-tags
-
The
Releaseworkflow (.github/workflows/workflow.yaml) runs lint, type checks, and the full test matrix. When the pushed ref is a tag and everything passes, thereleasejob builds the package withuv buildand publishes it to PyPI via trusted publishing (OIDC) usingpypa/gh-action-pypi-publish.
No PyPI token is needed locally; publishing happens entirely in CI.