--- id: tdda version: "3.3.0" license: MIT license_treatment: permissive maintenance: active --- # tdda — Test-driven data analysis: command-line tools and Python APIs for data validation, testing analytical pipelines, automatic test generation and more. License: permissive · Maintenance: active · Downloads: 293.2K/mo ## 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 above — 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 pip install tdda uv add tdda 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_current - Install friction: low - Maintenance: active - Downloads: 293.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags data validation testing, constraint discovery pandas, reference testing data pipelines, automatic test generation, data quality constraints, regex inference from data, data diff comparison, data-validation, test-generation, constraint-discovery [View on SkillFed](https://skillfed.io/packages/tdda) · [View on PyPI](https://pypi.org/project/tdda/)