skillfed

tdda

Test-driven data analysis: command-line tools and Python APIs for data validation, testing analytical pipelines, automatic test generation and more.

tdda v3.3.0 293.2K downloads/30d#7,955 on PyPI310
Permissive license MIT Active released

What it is and what it does

tdda is a Python framework for test-driven data analysis—a methodology where you write tests for data pipelines before or alongside the analysis code itself. It extends unittest and pytest with reference testing (comparing outputs to stored baselines), automatic test generation from command-line scripts, and constraint-based validation. The package also includes utilities for discovering data constraints from existing DataFrames or files, inferring regular expressions from string columns, diffing data across formats, and documenting CSV schemas in portable metadata files.

The core use case is validating analytical pipelines: you define what "correct" data looks like (via constraints or reference outputs), then verify that new data conforms to those rules. It integrates with pandas, polars, and parquet, and can work with relational databases when optional drivers are installed. The reference testing mode is particularly useful for regression detection—if your pipeline's output changes unexpectedly, the test catches it immediately.

Use it for:

  • Write reference tests for data transformation pipelines to catch regressions when code or data changes.
  • Automatically generate baseline tests from existing command-line scripts or programs without manual test writing.
  • Discover and enforce data quality constraints (e.g., non-null columns, value ranges) on incoming datasets.
  • Infer regex patterns from sample string data to validate or extract structured text fields.
  • Compare two versions of a dataset (Parquet or CSV) and report row-level and column-level differences visually.
  • Document CSV and flat-file formats in portable metadata files compatible with CSVW and Frictionless standards.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

tdda provides test-driven data analysis tools: reference testing for data pipelines, automatic test generation, constraint discovery and validation, regex inference, data diffing, and metadata documentation for CSV/flat files.

Yes, if you work with data pipelines and want automated validation. tdda fills a real gap between unit testing and data quality tools—reference testing catches regressions cheaply, and constraint discovery is faster than manual validation rules. Active maintenance, permissive license, and no security vulnerabilities. The 12-package dependency footprint is substantial but standard for data work; install it in projects where pandas or polars are already present.

Install

tdda on PyPI

pip

pip install tdda

uv

uv add tdda

poetry

poetry add tdda

Installing tdda

Before you install

Low friction: pure Python wheel, active maintenance (last commit 2026-07-13), and a substantial dependency stack (numpy, pandas, pyarrow, pyyaml, pytest, chardet, rich, regex, tomli_w, tomli, polars, requests) that will be installed together. Suitable for projects already using data science libraries.

License in practice

MIT license is permissive; you can use, modify, and distribute tdda freely in commercial and private projects with minimal restrictions.

Quickstart

pip install tdda

from tdda.referencetest import ReferenceTestCase
import unittest

class MyDataTest(ReferenceTestCase):
    def test_pipeline(self):
        result = my_analysis_function()
        self.assertDataFrameCorrect(result, 'expected.csv')

Requires Python >=3.8; optional database support (PostgreSQL, MySQL/MariaDB, MongoDB) requires separate driver installation.

Verify before relying

  • Whether constraint discovery works on databases other than those listed in optional setup.
  • Performance characteristics when working with very large Parquet files or DataFrames.
  • Compatibility of CSVW and Frictionless metadata conversion with all format variants.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 12 — numpy, pandas, pyarrow, pyyaml, pytest, chardet, rich, regex, tomli_w, tomli, polars, requests
Maintenance actively maintained — 32 days since the last release
Last repo commit
First released
Downloads 293,247/month — #7,955 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tdda-3.3.0-py3-none-any.whl

Keywords: tdda, constraint, referencetest, rexpy

Tags

data validation testingconstraint discovery pandasreference testing data pipelinesautomatic test generationdata quality constraintsregex inference from datadata diff comparison
data-validationtest-generationconstraint-discovery

More Testing packages