Installation
This guide covers installing detectkit and its dependencies.
Requirements
Section titled “Requirements”- Python: 3.10 or higher
- pip: Latest version recommended
- Database: ClickHouse (20.3+), PostgreSQL (12+), or MySQL (8.0+) — all fully supported
Basic Installation
Section titled “Basic Installation”Install detectkit from PyPI:
pip install detectkitThis installs:
- Core detectkit library
- Basic statistical detectors (MAD, Z-Score, IQR, Manual Bounds)
- CLI tool (
dtkcommand) - numpy, pydantic, click dependencies
Database Drivers
Section titled “Database Drivers”detectkit requires a database driver to be installed separately.
ClickHouse (Recommended)
Section titled “ClickHouse (Recommended)”pip install detectkit[clickhouse]Or install driver manually:
pip install clickhouse-driverSupported versions: ClickHouse 20.3+
PostgreSQL
Section titled “PostgreSQL”pip install detectkit[postgres]Or install driver manually:
pip install psycopg2-binarySupported versions: PostgreSQL 12+. See the PostgreSQL guide for the profile shape.
pip install detectkit[mysql]Or install driver manually:
pip install pymysqlSupported versions: MySQL 8.0+. See the MySQL guide for the profile shape.
Multiple Databases
Section titled “Multiple Databases”Install drivers for all databases you’ll use:
pip install detectkit[clickhouse,postgres,mysql]# or the shorthand:pip install detectkit[all-db]Advanced Detectors (Optional)
Section titled “Advanced Detectors (Optional)”Not yet implemented. The
prophetandtimesfmextras install the underlying libraries, but detectkit does not ship Prophet or TimesFM detector classes yet — the only detectortype:s that exist today are the statistical detectors (mad,zscore,iqr) andmanual_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.
Prophet Detector (planned)
Section titled “Prophet Detector (planned)”Time-series forecasting with Facebook Prophet (extra reserved; detector not yet available):
pip install detectkit[prophet]Note: Prophet has heavy dependencies (compiled Stan backend). Only install if needed.
TimesFM Detector (planned)
Section titled “TimesFM Detector (planned)”Google’s TimesFM model for time-series (extra reserved; detector not yet available):
pip install detectkit[timesfm]Note: Pulls in heavy ML dependencies. Only install if needed.
All Advanced Detectors
Section titled “All Advanced Detectors”Install both Prophet and TimesFM (no database drivers):
pip install detectkit[advanced-detectors]Everything
Section titled “Everything”The [all] extra installs everything — all database drivers plus
Prophet and TimesFM, not just the advanced detectors:
pip install detectkit[all]Development Installation
Section titled “Development Installation”For contributing to detectkit:
1. Clone Repository
Section titled “1. Clone Repository”git clone https://github.com/alexeiveselov92/detectkit.gitcd detectkit2. Create Virtual Environment
Section titled “2. Create Virtual Environment”python -m venv venvsource venv/bin/activate # On Windows: venv\Scripts\activate3. Install in Editable Mode
Section titled “3. Install in Editable Mode”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):
pip install -e ".[dev,all-db]" # tooling + all DB driverspip install -e ".[dev,all-db,integration]" # also pulls testcontainers for integration tests4. Run Tests
Section titled “4. Run Tests”Unit tests (no external services required):
python -m pytest tests/unitIntegration tests need the integration extra (testcontainers) and a
running Docker daemon:
pip install -e ".[integration]"python -m pytest tests/integrationVerifying Installation
Section titled “Verifying Installation”Check that detectkit is installed correctly:
dtk --versionThis prints the installed package version:
detectkit, version x.y.zOptional: AI Onboarding
Section titled “Optional: AI Onboarding”If you use Claude Code, dtk init-claude drops detectkit context (rules and
skills) into your project so the assistant understands the project layout:
dtk init-claudeIt 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.
Upgrading
Section titled “Upgrading”Upgrade to the latest version:
pip install --upgrade detectkitUninstalling
Section titled “Uninstalling”Remove detectkit:
pip uninstall detectkitDocker Installation (Optional)
Section titled “Docker Installation (Optional)”Create a Dockerfile for containerized deployment:
FROM python:3.11-slim
# Install detectkit with ClickHouse driverRUN pip install detectkit[clickhouse]
# Copy project filesCOPY . /appWORKDIR /app
# Run detectkitCMD ["dtk", "run", "--select", "*"]Build and run:
docker build -t my-detectkit .docker run -v $(pwd):/app my-detectkitTroubleshooting
Section titled “Troubleshooting”ImportError: No module named ‘detectkit’
Section titled “ImportError: No module named ‘detectkit’”Solution: Ensure detectkit is installed in the active Python environment:
pip list | grep detectkitClickHouse driver not found
Section titled “ClickHouse driver not found”Solution: Install ClickHouse driver:
pip install clickhouse-driverPermission denied on Linux
Section titled “Permission denied on Linux”Solution: Install with —user flag:
pip install --user detectkitSSL certificate errors
Section titled “SSL certificate errors”Solution: Upgrade pip and certifi:
pip install --upgrade pip certifiOld version installed
Section titled “Old version installed”Solution: Force reinstall:
pip install --force-reinstall detectkitNext Steps
Section titled “Next Steps”After installation:
- Quickstart Guide - Create your first metric
- Configuration Guide - Learn configuration options
- CLI Reference - Explore CLI commands
- Run
dtk init-claudefor optional Claude Code onboarding (re-run after upgrades)