Measure data quality. Keep the decisions yours.¶
Kontra is a developer-first measurement engine for data contracts. It evaluates declarative rules against files, databases, and DataFrames, then returns structured results for humans, CI systems, and agents.
import kontra
from kontra import rules
result = kontra.validate("users.parquet", rules=[
rules.not_null("user_id"),
rules.unique("email"),
rules.range("age", min=0, max=120),
])
result.passed
result.to_dict() # structured output
result.to_llm() # compact agent context
Runs where the data lives¶
Kontra resolves rules from metadata first, pushes eligible work into SQL, and uses Polars only for the remaining measurements.
One result model¶
CLI, Python, CI, and MCP consumers receive the same deterministic counts, execution sources, severity metadata, and bounded explanations.
Designed for composition¶
Kontra measures. Your application decides what blocks a deployment, opens an incident, or needs human review.
Choose a path¶
| If you want to… | Start here |
|---|---|
| Validate a file or table | Getting started |
| Use DataFrames or inline rules | Python API |
| Define a reusable contract | Contracts |
| Inspect all built-in measurements | Rules |
| Compare transformation inputs and outputs | Transformation probes |
| Connect Claude, Codex, Cursor, or another MCP client | Agents and MCP |
| Understand execution cost and exact counts | Performance |
Supported data sources¶
Parquet, CSV, PostgreSQL, SQL Server, ClickHouse, S3-compatible object storage, Azure ADLS Gen2, Polars DataFrames, pandas DataFrames, and Python records all enter the same measurement API.
Kontra is open source under the Apache License 2.0.