Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Data Contract Checker

Validate data contracts against configurable rules — with human-readable output.

PyPI version Python versions License

📖 Full documentation: godatadriven.github.io/contract-checker

Data Contract Checker is an open source Python package for defining, enforcing, and maintaining validation rules across your data contracts. Define the best practices and naming conventions you care about once — required fields, naming patterns, accepted values — then enforce them consistently across a large number of contracts. Run the CLI and get clear pass/fail feedback on every contract in your repository.

This makes it practical to keep a large, growing set of data contracts consistent: instead of reviewing each contract by hand, you codify your team's conventions as checks and let the tool enforce them everywhere.

It supports the two major open data contract standards out of the box, with custom JSON Schema support for everything else.


Supported standards

Standard Versions
DCS — Data Contract Specification 0.9.0 – 1.2.1
ODCS — Open Data Contract Standard 2.2.1 – 3.2.0
Custom JSON Schema any

See the documentation for the full version-compatibility detail per standard.


Installation

pip install contract-checker
# or with uv
uv add contract-checker

Requires Python 3.11–3.15.


Quick start

1. Create a data-contract-checks.yml file in your project root:

data_contract_specification: dcs   # or "odcs" / "custom"

data_contracts_path:
  path: ./contracts/               # where your contracts live
  exclude_paths:
    - archive/**                   # optional glob filters

data_contract_checks:
  - attribute: info.title
    checks:
      - required: true
      - pattern: "^[A-Z]"          # title must start with a capital letter

  - attribute: info.version
    checks:
      - required: true
      - pattern: "^\\d+\\.\\d+\\.\\d+$"  # must be semver

  - attribute: models.*.fields.*.description
    checks:
      - required: true             # every field must have a description

  - attribute: servers.type
    checks:
      - accepted_values:
          - s3
          - gcs
          - azure_blob

2. Run the checker against your contracts:

contract-checker

To also show passing checks and fully passing contracts:

contract-checker --output-mode full

For a one-line-per-contract scoreboard use --output-mode summary, and for machine-readable output use --format json. --verbose / -v enables debug logging.

To validate a different location (or a single contract) ad hoc, override the configured path with --contract-path:

contract-checker --contract-path ./contracts/orders.yaml

To also validate each contract against its full JSON Schema (the built-in DCS/ODCS schema, or your custom one) — the equivalent of datacontract lint — enable linting. It's off by default:

contract-checker --lint

For the full config-file schema — path filtering, severity overrides, linting, and custom schemas — see the configuration guide.


Available checks

Check YAML key Description
Required required: true Field must exist and be non-null
Pattern pattern: "^regex$" Value must match a regular expression (for list attributes, every item must match)
Accepted values accepted_values: [a, b] Value must be one of the listed options
Min items min_items: 2 List or mapping must contain at least N items; skipped if missing, fails if not a collection
Max items max_items: 10 List or mapping must contain at most N items; skipped if missing, fails if not a collection
At least one at_least_one: {unique: true} At least one item in a collection must match the key-value condition (point attribute at the collection, e.g. models.*.fields)
Exactly one exactly_one: {primaryKey: true} Exactly one item in a collection must match the key-value condition, e.g. a single primary key per model

Only required checks whether a field exists: every other check skips an absent field, and every check fails a field that is present but null. See missing vs null values.

See the checks reference for full details and examples of each check type.


Key features

  • Wildcard path support — apply checks across all models and fields with models.*.fields.*.unique
  • Severity levels — --severity error (default) fails the run when checks fail; --severity warn prints the same report but always exits 0
  • Contract filtering — include or exclude contracts with glob patterns (domain/**, **/draft_*.yaml); filtering by field value (e.g. only status: active contracts) is planned
  • Schema validation (lint) — opt into full JSON Schema validation with --lint, against the built-in DCS/ODCS schema or your own custom schema (like datacontract lint)
  • Custom JSON Schema — validate contracts against your own schema, on top of your configured checks
  • Rich output — colour-coded pass/fail tables per contract plus a summary across all contracts, or JSON with --format json
  • GitHub Actions annotations — failed checks are emitted as error annotations automatically when running in GitHub Actions
  • Extensible — implement the Check abstract base class to add your own check types via the Python API

Configuration reference

The full configuration schema — including path filtering, severity overrides, and custom schema options — is documented at godatadriven.github.io/contract-checker.


Contributing

Bug reports, feature requests, and pull requests are all welcome. See CONTRIBUTING.md for dev setup, how to add a new check type, and the PR process.

Metadata

Release files for contract-checker 0.1.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contract-checker 0.1.0rc1
File Size Uploaded Provenance Actions
contract_checker-0.1.0rc1.tar.gz 300.1 kB With provenance Details for contract_checker-0.1.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for contract-checker 0.1.0rc1
File Interpreter ABI Platform Actions
contract_checker-0.1.0rc1-py3-none-any.whl Python 3 none any Details for contract_checker-0.1.0rc1-py3-none-any.whl

Total release size: 455.0 kB

Release files / contract_checker-0.1.0rc1.tar.gz

Download URL contract_checker-0.1.0rc1.tar.gz
Size 300.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ccb8599dd4930718bc753d8690e10082bc5c002aee5c4b2c65947c7ee92bfb53
BLAKE2b-256 checksum
How to use checksums
86a4a3bc4f0b7d562ac4334a7679d3b98d5a9b5ec3001d3eb14474887518e657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / contract_checker-0.1.0rc1-py3-none-any.whl

Download URL contract_checker-0.1.0rc1-py3-none-any.whl
Size 154.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bebbcb4c332017c9a2837499e369ff1b4501ffc2b128654da43401f47aec9d69
BLAKE2b-256 checksum
How to use checksums
22d22e2962dc50f3865175a35c63ac214e342624eccf7a62bac49fb12d61841b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for contract-checker 0.1.0rc1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for contract_checker-0.1.0rc1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page