Skip to main content

csv-quality-gate

CI PyPI Python License: MIT

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.

csv-quality-gate preview

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:

  • 0 pass
  • 1 warnings only
  • 2 fail (or 2 when the file does not exist)

Profiles

Built-in profiles:

  • generic
    • checks for a required company column, empty company cells, duplicate company values, and empty files
  • outreach
    • requires company and person_name, with higher empty-rate tolerances and an added suspicious company-name heuristic for GTM/contact pipelines

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 company values are real, only whether they are present, unique, and not obviously junk.
  • The outreach profile 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

Use this repository directly as a composite Action. It installs the packaged CLI, runs the selected profile, and always writes a JSON receipt at $GITHUB_WORKSPACE/csv-quality-gate-receipt.json. The status and receipt outputs remain available even when the Action exits with a warning or failure.

- id: csv_gate
  uses: hermes-labs-ai/csv-quality-gate@v0.2.0
  with:
    csv-path: data/leads.csv
    profile: outreach

- run: echo "${{ steps.csv_gate.outputs.status }}"

The only inputs are csv-path and profile (generic or outreach); the Action deliberately accepts no free-form command or shell arguments. It returns the same exit codes as the CLI: 0 for pass, 1 for warn, and 2 for fail. Use continue-on-error: true on a calling step if your workflow needs to inspect warning or failure outputs before deciding how to proceed.

The receipt path is fixed per workspace, so do not run more than one instance in parallel in the same workspace. The Action validates the package's existing CSV heuristics only; it does not add schema inference, semantic verification, or arbitrary CLI options.

A ready-to-copy install-based workflow also lives in examples/github-action.yml.

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 AI reliability engineering studio for product and engineering teams shipping production agents and LLM applications. We find the structural AI failures standard evals miss, then harden retrieval, memory, agents, and the language layers around production AI systems with runtime controls and defensible evidence.

Browse the open-source catalog or contact roli@hermes-labs.ai.

License

MIT — see LICENSE.

Citation

If you use this software, please cite it using the metadata in CITATION.cff.

Metadata

Release files for csv-quality-gate 0.2.0

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

Source distribution (sdist)

Source distribution for csv-quality-gate 0.2.0
File Size Uploaded
csv_quality_gate-0.2.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csv-quality-gate 0.2.0
File Interpreter ABI Platform
csv_quality_gate-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / csv_quality_gate-0.2.0.tar.gz

Download URL csv_quality_gate-0.2.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
933991655778aaada6fa713e47c8db54bd70f4fe6d602193d8be3b6f32993487
BLAKE2b-256 checksum
How to use checksums
ae7c395977269f460c3109ebbaab842963bd0dd8f293fae7b7476c7c4220681b
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 Sep 5, 2026.

Transparency log

Release files / csv_quality_gate-0.2.0-py3-none-any.whl

Download URL csv_quality_gate-0.2.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66913af180ca6161dcc221a4652498846979ce0f7c0effb7e66a6370b461fb49
BLAKE2b-256 checksum
How to use checksums
8dcce2ef97ef645ed106f1ab805962fed4b0570c96e42bc05cb4011f2d57e829
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 Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.0

2 release files

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