PyCatalyst
Make the data, grade the data, train the model, ship the artifact.
PyCatalyst is a configuration-driven toolkit for synthetic data and model training. Three artifacts, all YAML, all versioned:
| Artifact | Declares | Command |
|---|---|---|
| recipe | how to make data | pycatalyst generate -r recipe.yaml |
| experiment | how to train a model | pycatalyst train -c experiment.yaml |
| distillation | how a teacher becomes a student | pycatalyst distill -c distill.yaml |
A REST API, an optional web UI, schema inference, and substitutable storage (SQLite, Postgres, MongoDB) sit around that core.
Sixty seconds
pip install pycatalyst
pycatalyst recipe new orders # a starter recipe you can edit
pycatalyst generate -r orders.yaml -n 5
{
"id": "a31c06bd-463e-4923-bc1a-adbde48b1697",
"name": "Bruno Barros",
"email": "ben.chen518@example.com",
"quantity": 72,
"status": "pending",
"created_at": "2024-08-20T01:46:55+00:00"
}
The same recipe also checks data, so fixtures and ingest validation cannot drift apart:
import pycatalyst
built = pycatalyst.build_recipe(pycatalyst.parse_recipe_file("orders.yaml"))
violations = pycatalyst.validate_records(incoming_rows, built.schema)
Documentation
-
Published (GitHub Pages): optophi.github.io/pycatalyst — start with Getting Started → Quick Start.
-
Local docs (from repo root):
pip install "pycatalyst[docs]" pycatalyst docs serve
Opens at http://127.0.0.1:5005 by default. Static site:
pycatalyst docs build→site/. -
Live API (when the server is running): http://127.0.0.1:8005/docs (Swagger).
Tutorial index in the doc site: Quick Start, API authentication, generate, recipes, infer schema, workbench, and the distillation reference.
Installation
pip install pycatalyst
API server, DB, and common extras:
pip install "pycatalyst[api,db,inference]"
From source (editable):
git clone https://github.com/optophi/pycatalyst
cd pycatalyst
pip install -e ".[dev]"
Quick Start (CLI)
pycatalyst recipe new orders # scaffold a recipe
pycatalyst recipe validate orders.yaml # check it without running it
pycatalyst generate -r orders.yaml -n 100 # generate
pycatalyst generate -r orders.yaml --format ndjson | jq .
pycatalyst api # serve on 127.0.0.1:8005
Every command takes -v/--verbose, -q/--quiet, --log-level and --debug,
and --help carries worked examples.
See the Quick Start page in the docs for database setup, UI, and REST examples.
Training and distillation
pycatalyst train -c experiment.yaml # sklearn / PyTorch / HuggingFace
pycatalyst distill -c distill.yaml --dry-run # validate; spend nothing
pycatalyst distill -c distill.yaml --stages generate
pycatalyst distill -c distill.yaml # generate, train, bench, export
Distillation declares its data contract once, and that one declaration renders
the teacher prompt, grades the completion, splits the datasets and scores the
bench — so the prompt and the grader cannot drift apart. Stages are separable
because their costs differ by orders of magnitude, and --dry-run plus a cost
estimate come before anything is spent. See
Distillation.
Streaming mock data
Python — same sequence as batch generation for a fixed seed:
from pycatalyst import GenerationEngine, SchemaBuilder
engine = GenerationEngine()
schema = SchemaBuilder("events").add_uuid("id").add_string("kind").build()
for row in engine.iter_records(schema, seed=123, limit=1000):
process(row)
HTTP (Server-Sent Events) — POST /api/v1/stream/sse with the same field list as /generate, plus max_records and optional interval_ms. Use curl -N and a Bearer token when auth is enabled:
curl -N -H "Authorization: Bearer YOUR_JWT" -H "Content-Type: application/json" \
-d '{"name":"x","fields":[{"name":"n","type":"int"}],"max_records":5,"seed":1}' \
http://127.0.0.1:8005/api/v1/stream/sse
CLI — NDJSON to stdout (one JSON object per line):
pycatalyst stream ndjson --schema my.json -n 500 --seed 1
CLI — Kafka (pip install pycatalyst[kafka]):
export PYCATALYST_STREAM_KAFKA_BOOTSTRAP=localhost:9092
export PYCATALYST_STREAM_KAFKA_TOPIC=test-topic
pycatalyst stream kafka --schema my.json -n 2000 --batch 100
Server caps (optional): PYCATALYST_STREAM_MAX_RECORDS, PYCATALYST_STREAM_MAX_INTERVAL_MS.
Development
- Lint & format:
ruff check . && ruff format . - Type check:
mypy src/ - Tests:
pytest - Coverage:
pytest --cov=pycatalyst --cov-report=term-missing
Publishing
- Bump version in
pyproject.tomlandCHANGELOG.md. - Create a release tag:
git tag v0.1.0 && git push origin v0.1.0. - The GitHub Action uses PyPI Trusted Publishing; configure the publisher on PyPI for this repo, then the workflow will publish on tag push.
License
MIT
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 pycatalyst-0.0.18.tar.gz.
File metadata
- Download URL: pycatalyst-0.0.18.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a081d20576c274575b7cf7a5be6692a0ec28677cd3b479ebc1ef409467e6cc1f
|
|
| MD5 |
9bbed0ab6efc895058eb48305b312b8b
|
|
| BLAKE2b-256 |
4920acd0da8724c7b64e5b38a28a739c469360bc8cb3ffc3796e01aad3e00a95
|
Provenance
The following attestation bundles were made for pycatalyst-0.0.18.tar.gz:
Publisher:
publish.yml on optophi/pycatalyst
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycatalyst-0.0.18.tar.gz -
Subject digest:
a081d20576c274575b7cf7a5be6692a0ec28677cd3b479ebc1ef409467e6cc1f - Sigstore transparency entry: 2817377537
- Sigstore integration time:
-
Permalink:
optophi/pycatalyst@436bfc8fd0e1641c3d028982593db22bf2a47d6c -
Branch / Tag:
refs/tags/v0.0.18 - Owner: https://github.com/optophi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@436bfc8fd0e1641c3d028982593db22bf2a47d6c -
Trigger Event:
push
-
Statement type:
File details
Details for the file pycatalyst-0.0.18-py3-none-any.whl.
File metadata
- Download URL: pycatalyst-0.0.18-py3-none-any.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb390a29e233109391b1a4e526d029a2e05cf5827c8a0db1c3fa2fb07bb011d4
|
|
| MD5 |
488d1cbda8f45b00904a521afdc5bad2
|
|
| BLAKE2b-256 |
0a5727520c6ddd8bb6da856489710f8a1ce2bed603ef2a0af9e1cb8f5c9b91b6
|
Provenance
The following attestation bundles were made for pycatalyst-0.0.18-py3-none-any.whl:
Publisher:
publish.yml on optophi/pycatalyst
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycatalyst-0.0.18-py3-none-any.whl -
Subject digest:
cb390a29e233109391b1a4e526d029a2e05cf5827c8a0db1c3fa2fb07bb011d4 - Sigstore transparency entry: 2817377598
- Sigstore integration time:
-
Permalink:
optophi/pycatalyst@436bfc8fd0e1641c3d028982593db22bf2a47d6c -
Branch / Tag:
refs/tags/v0.0.18 - Owner: https://github.com/optophi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@436bfc8fd0e1641c3d028982593db22bf2a47d6c -
Trigger Event:
push
-
Statement type: