csv-quality-gate
csv-quality-gate is a command-line data quality gate that runs CSV preflight validation, failing fast before a pipeline ingests broken, incomplete, duplicated, or junk input.
It runs batch quality checks on a single CSV and returns pass, warn, or fail (with matching exit codes) before expensive pipeline steps burn time on bad input. It checks for missing required columns, empty files, empty critical cells, duplicate rows, and — under the outreach profile — suspicious company-name patterns. It is stdlib-only: no third-party runtime dependencies.
The problems it is built for:
- "We keep running expensive pipeline steps on broken CSVs."
- "A batch run fails 20 minutes in because the input CSV was junk."
- "We only discover missing required columns after the job already started."
- "Duplicate rows and empty contact fields keep polluting our batch runs."
- "I want CSV preflight validation, not a whole data platform."
Quickstart (60 seconds)
pip install csv-quality-gate
csv-quality-gate check leads.csv --profile outreach
Example output for a CSV with a missing column and a borderline duplicate rate:
csv-quality-gate: FAIL
file: leads.csv
profile: outreach
rows: 125
ERROR: missing required column: person_name
WARNING: duplicate rate 12% exceeds warning threshold 10%
The process exits 0 on pass, 1 on warnings only, and 2 on fail, so you can wire it directly into a shell script or CI step.
Install
pip install csv-quality-gate
For development:
pip install -e ".[dev]"
Usage
csv-quality-gate check leads.csv
csv-quality-gate check leads.csv --profile outreach
csv-quality-gate check leads.csv --profile generic --json
Exit codes:
0pass1warnings only2fail (or2when the file does not exist)
Profiles
Built-in profiles:
generic- checks for a required
companycolumn, emptycompanycells, duplicatecompanyvalues, and empty files
- checks for a required
outreach- requires
companyandperson_name, with higher empty-rate tolerances and an added suspicious company-name heuristic for GTM/contact pipelines
- requires
The thresholds for each profile are defined in src/csv_quality_gate/profiles.py.
Output
Text mode (default):
csv-quality-gate: FAIL
file: leads.csv
profile: outreach
rows: 125
ERROR: missing required column: person_name
WARNING: duplicate rate 12% exceeds warning threshold 10%
JSON mode (--json) emits an object with path, profile, rows, status, and issues[]:
csv-quality-gate check leads.csv --json
Limitations / What it does not do
- Heuristics are intentionally simple: empty-rate, duplicate-rate, and regex-based name patterns. They do not learn from your data.
- It validates shape and obvious noise, not semantic correctness — it cannot tell whether
companyvalues are real, only whether they are present, unique, and not obviously junk. - The
outreachprofile is opinionated. Its suspicious-name patterns and thresholds were chosen for GTM contact lists and should not be treated as universal truth. - Duplicate and empty checks operate on a fixed set of columns per profile (
company,person_name); it does not auto-detect which columns matter. - It validates one CSV file at a time and assumes UTF-8 (BOM-tolerant) input.
- It is not a data quality platform: no lineage, no profiling reports, no schema inference, no row-level remediation.
When to use it
- Before enrichment, outreach, ETL, or batch scoring runs
- In CI for checked-in CSV inputs
- As a preflight gate before expensive pipeline work
When not to use it
- When you need semantic validation of the data itself
- When your input is not CSV
- When you need a full data quality framework with lineage and profiling
CI / GitHub Actions
A ready-to-copy workflow lives in examples/github-action.yml. It installs the package and runs a check so a bad checked-in CSV fails the build.
Development
pip install -e ".[dev]"
ruff check .
python3 -m pytest -q
Part of the Hermes Labs reliability stack
csv-quality-gate is part of the Hermes Labs reliability stack — open-source tools that catch silent failure modes in production AI and data pipelines. csv-quality-gate guards the data that goes into a pipeline; it is complementary to, not a replacement for, the agent- and prompt-level tools in the stack.
About Hermes Labs
Hermes Labs is an independent AI-reliability lab building open-source tools that catch silent failure modes in production AI. More at hermes-labs.ai.
License
MIT — see LICENSE.
Citation
If you use this software, please cite it using the metadata in CITATION.cff.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csv_quality_gate-0.1.2.tar.gz.
File metadata
- Download URL: csv_quality_gate-0.1.2.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7e378932c0c1cccfbd0f9c45d630eedd9a7ee2c8e382ef6cb7e45057bb76bb6
|
|
| MD5 |
c1a42e167ea1e0bdf3b379adf57d7785
|
|
| BLAKE2b-256 |
f08447b90c95d3cbb1a0f2d6d79bae1ae119b2415f8330be45c6de71e3afcb1d
|
Provenance
The following attestation bundles were made for csv_quality_gate-0.1.2.tar.gz:
Publisher:
publish.yml on hermes-labs-ai/csv-quality-gate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csv_quality_gate-0.1.2.tar.gz -
Subject digest:
c7e378932c0c1cccfbd0f9c45d630eedd9a7ee2c8e382ef6cb7e45057bb76bb6 - Sigstore transparency entry: 2341141364
- Sigstore integration time:
-
Permalink:
hermes-labs-ai/csv-quality-gate@4a88d55a32770024ee189c5f48661df10a032a90 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/hermes-labs-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a88d55a32770024ee189c5f48661df10a032a90 -
Trigger Event:
release
-
Statement type:
File details
Details for the file csv_quality_gate-0.1.2-py3-none-any.whl.
File metadata
- Download URL: csv_quality_gate-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
720eb71d667b34dcccab79ad0422b2c532bb8a09a8ac4e714482b19aa7ccb22f
|
|
| MD5 |
c6260c9545676bda07ccc79702b626fe
|
|
| BLAKE2b-256 |
24147a435f61c0ce11cbcc437575068baf880216a46314c37d6716d9c902280b
|
Provenance
The following attestation bundles were made for csv_quality_gate-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on hermes-labs-ai/csv-quality-gate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csv_quality_gate-0.1.2-py3-none-any.whl -
Subject digest:
720eb71d667b34dcccab79ad0422b2c532bb8a09a8ac4e714482b19aa7ccb22f - Sigstore transparency entry: 2341141372
- Sigstore integration time:
-
Permalink:
hermes-labs-ai/csv-quality-gate@4a88d55a32770024ee189c5f48661df10a032a90 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/hermes-labs-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a88d55a32770024ee189c5f48661df10a032a90 -
Trigger Event:
release
-
Statement type: