Skip to content

Installation

This guide covers installing detectkit and its dependencies.

  • Python: 3.10 or higher
  • pip: Latest version recommended
  • Database: ClickHouse (20.3+), PostgreSQL (12+), or MySQL (8.0+) — all fully supported

Install detectkit from PyPI:

Terminal window
pip install detectkit

This installs:

  • Core detectkit library
  • Basic statistical detectors (MAD, Z-Score, IQR, Manual Bounds)
  • CLI tool (dtk command)
  • numpy, pydantic, click dependencies

detectkit requires a database driver to be installed separately.

Terminal window
pip install detectkit[clickhouse]

Or install driver manually:

Terminal window
pip install clickhouse-driver

Supported versions: ClickHouse 20.3+

Terminal window
pip install detectkit[postgres]

Or install driver manually:

Terminal window
pip install psycopg2-binary

Supported versions: PostgreSQL 12+. See the PostgreSQL guide for the profile shape.

Terminal window
pip install detectkit[mysql]

Or install driver manually:

Terminal window
pip install pymysql

Supported versions: MySQL 8.0+. See the MySQL guide for the profile shape.

Install drivers for all databases you’ll use:

Terminal window
pip install detectkit[clickhouse,postgres,mysql]
# or the shorthand:
pip install detectkit[all-db]

Not yet implemented. The prophet and timesfm extras install the underlying libraries, but detectkit does not ship Prophet or TimesFM detector classes yet — the only detector type:s that exist today are the statistical detectors (mad, zscore, iqr) and manual_bounds. These extras are placeholders for planned detectors; installing them adds the dependencies but no new detector. Track progress in the changelog before relying on them.

Time-series forecasting with Facebook Prophet (extra reserved; detector not yet available):

Terminal window
pip install detectkit[prophet]

Note: Prophet has heavy dependencies (compiled Stan backend). Only install if needed.

Google’s TimesFM model for time-series (extra reserved; detector not yet available):

Terminal window
pip install detectkit[timesfm]

Note: Pulls in heavy ML dependencies. Only install if needed.

Install both Prophet and TimesFM (no database drivers):

Terminal window
pip install detectkit[advanced-detectors]

The [all] extra installs everything — all database drivers plus Prophet and TimesFM, not just the advanced detectors:

Terminal window
pip install detectkit[all]

For contributing to detectkit:

Terminal window
git clone https://github.com/alexeiveselov92/detectkit.git
cd detectkit
Terminal window
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Terminal window
pip install -e .[dev]

This installs:

  • detectkit in editable mode
  • Development tooling only (pytest, pytest-cov, pytest-mock, requests-mock, black, mypy, ruff)

The dev extra does not include any database drivers. For the full suite, add the DB extras you need (and Docker-backed integration tests):

Terminal window
pip install -e ".[dev,all-db]" # tooling + all DB drivers
pip install -e ".[dev,all-db,integration]" # also pulls testcontainers for integration tests

Unit tests (no external services required):

Terminal window
python -m pytest tests/unit

Integration tests need the integration extra (testcontainers) and a running Docker daemon:

Terminal window
pip install -e ".[integration]"
python -m pytest tests/integration

Check that detectkit is installed correctly:

Terminal window
dtk --version

This prints the installed package version:

detectkit, version x.y.z

If you use Claude Code, dtk init-claude drops detectkit context (rules and skills) into your project so the assistant understands the project layout:

Terminal window
dtk init-claude

It installs three skills: dtk-setup-project (configure the database connection and a first alert channel), dtk-new-metric (scaffold a validated metric), and dtk-feedback (file a redacted bug report, feature request, or feedback as a GitHub issue upstream).

Re-run it after upgrading detectkit to refresh the shipped context.

Upgrade to the latest version:

Terminal window
pip install --upgrade detectkit

Remove detectkit:

Terminal window
pip uninstall detectkit

Create a Dockerfile for containerized deployment:

FROM python:3.11-slim
# Install detectkit with ClickHouse driver
RUN pip install detectkit[clickhouse]
# Copy project files
COPY . /app
WORKDIR /app
# Run detectkit
CMD ["dtk", "run", "--select", "*"]

Build and run:

Terminal window
docker build -t my-detectkit .
docker run -v $(pwd):/app my-detectkit

ImportError: No module named ‘detectkit’

Section titled “ImportError: No module named ‘detectkit’”

Solution: Ensure detectkit is installed in the active Python environment:

Terminal window
pip list | grep detectkit

Solution: Install ClickHouse driver:

Terminal window
pip install clickhouse-driver

Solution: Install with —user flag:

Terminal window
pip install --user detectkit

Solution: Upgrade pip and certifi:

Terminal window
pip install --upgrade pip certifi

Solution: Force reinstall:

Terminal window
pip install --force-reinstall detectkit

After installation:

  1. Quickstart Guide - Create your first metric
  2. Configuration Guide - Learn configuration options
  3. CLI Reference - Explore CLI commands
  4. Run dtk init-claude for optional Claude Code onboarding (re-run after upgrades)