Skip to content

Cookbook

One short page per common scenario. Each recipe is a 20–30 line runnable example with just enough prose to explain when to use it.

First visit?

If you have not run PyCharter yet, start with Start here, then pick a recipe below.

For deeper walkthroughs, see the tutorials.

Recipe When to use it
Validate a CSV in 30 seconds You have a CSV on disk and want a one-shot pass/fail report.
Validate a pandas DataFrame You're already in Python with a DataFrame in hand.
Validate a file from the shell You want a pass/fail exit code — locally or as a CI gate — without writing Python.
Gate a FastAPI endpoint with a contract Reject malformed request bodies before they reach your handler.
Emit a quality score to Prometheus You run pycharter in production and want a scrape endpoint.
Consume a Kafka topic with a contract Reject bad messages off a stream and route them to a DLQ.

If you can't find what you're looking for, the API reference covers the full public surface and the Concepts page explains how schemas, contracts, and pipelines fit together.