Skip to main content

Sraosha

Enforcement and governance runtime for YAML data contracts. Validates with datacontract-cli, exposes a REST API, an operator CLI (serve, db, worker, beat), optional Soda-based database checks, and a React SPA served from the API at /app/ (bundled under sraosha/web/dist in the wheel, or frontend/dist in a dev checkout).

License: MIT Python 3.11+

Contents

Features

Area Notes
Contract validation YAML contracts; engine wraps datacontract-cli
Enforcement REST API, Celery schedules, or embed ContractEngine
Connections Encrypted DB credentials via /api/v1/connections for validation and DQ
Data quality (optional) Soda Core checks per connection; install e.g. soda-core-postgres as needed
Operations PostgreSQL persistence, Celery + Redis for validation and DQ schedules
UI SPA at /app/ (included in pip install; dev: make sync-web-dist or build in frontend/), OpenAPI at /docs

Install

pip install sraosha

Dev extras (tests, lint, types): pip install -e ".[dev]"

Data quality (Soda Core): contract validation works without Soda. Install Soda only when you want to run DQ scans—same Python environment as the API and any Celery workers that execute dq_scan (packages are not declared in this project; pick versions for your stack):

pip install soda-core soda-core-postgres   # example: Postgres

For containers, add equivalent pip install lines to your image Dockerfile.

Celery: DQ scans run in the worker process. After changing code that affects Soda or MySQL connections, restart the worker (make stop && make start, or uv run sraosha worker if you run workers separately) so dq_scan loads the update.

Schema introspection: PyMySQL (MySQL / ClickHouse wire) and a current DuckDB wheel are included for table/column discovery. Soda DQ still needs pip install soda-core soda-core-<connector>; common driver libraries (mysql-connector-python, trino, oracledb, pyodbc, boto3, BigQuery/Snowflake/Athena/Azure clients, etc.) are core dependencies so missing sub-dependencies are rarer.

MySQL / ClickHouse (Soda): In the connection Advanced JSON (extra_params), you can set charset, use_unicode, collation, and use_pure. They are merged into the Soda YAML and applied during DQ scans. The runner defaults to charset=utf8mb4 and use_pure=true (pure-Python connector); the C extension default can still trigger legacy utf8 errors on some servers.

Note: soda-core-duckdb 3.5.x expects an older DuckDB (below 1.1), while sraosha pins a newer DuckDB for Python 3.13+ wheels. If you need that exact Soda connector, use a separate venv or Python 3.11 where compatible builds exist.

Quickstart

Local development (no Docker) — install PostgreSQL and Redis yourself, then:

cp .sraosha.example .sraosha   # point DATABASE_URL and REDIS_URL at your local services
make sync && make db
make start    # builds SPA; starts API (serves UI), Celery worker, and beat in background — logs .sraosha-start-*.log
# make stop   # stops those PIDs plus anything on :8000 / :5173 (e.g. stray Vite)

Foreground API only (no worker/beat): make serve. Vite on :5173: make frontend. Celery alone: uv run sraosha worker / uv run sraosha beat (with Redis from .sraosha).

UI when using make serve: http://localhost:8000/app/ (make sync-web-dist builds the SPA into sraosha/web/dist and frontend/dist).

Docker Compose (API + built UI): the Dockerfile runs npm run build in a Node stage and copies the build into sraosha/web/dist in the image. The api service is the only HTTP entrypoint; it serves the React app under /app/ (and / redirects there when the SPA is present). There is no separate frontend container.

cp .sraosha.example .sraosha   # ensure env matches compose (compose overrides DATABASE_URL / REDIS_URL)
docker compose up --build      # builds the image including the UI, starts postgres, redis, api, worker, beat
# UI: http://localhost:8000/app/   ·   API docs: http://localhost:8000/docs

docker-compose.yml is not wired into the Makefile.

Local CLI:

pip install sraosha
cp .sraosha.example .sraosha
sraosha serve

Config path: sraosha --config /path/to/.sraosha serve or SRAOSHA_CONFIG=/path/to/.sraosha.

Register and validate via the API (POST /api/v1/contracts) or the UI at /app/ once the server is running.

How it works

  • Validation: the REST API, Celery-triggered runs, or embedded ContractEngine run checks via datacontract-cli. With block mode, failed checks surface as API errors where applicable; results persist when a database is configured.
  • Background: Celery beat drives periodic jobs (validation and DQ schedule polling); workers execute them. Details: ARCHITECTURE.md.
  • Data quality: Optional Soda checks are configured per connection (/api/v1/data-quality); they sit alongside contract validation.

Lineage nodes include a platform string from contract servers.*.type for display.

Architecture

  • FastAPI: JSON /api/v1/*, SPA /app/* when built.
  • PostgreSQL: Contracts, runs, teams, schedules, DQ metadata.
  • Redis: Celery broker; production uses one sraosha beat and one or more sraosha worker processes.
REST API / UI / Celery
        → ContractEngine → datacontract-cli
        → PostgreSQL
FastAPI (:8000)  +  Celery workers

More diagrams and layout: ARCHITECTURE.md.

CLI

sraosha [--config PATH] <command>

sraosha serve [--host 0.0.0.0] [--port 8000] [--reload]
sraosha db
sraosha worker [--loglevel info] [--concurrency 4] [--hostname worker@%h]
sraosha beat [--loglevel info]
sraosha version

Configuration

Dotenv-style .sraosha: copy .sraosha.example — it lists every SraoshaSettings field from sraosha/config.py (same names as env vars). Resolution: --config, SRAOSHA_CONFIG, ./.sraosha, ~/.sraosha. Env vars override the file.

OpenAPI / typed clients: schema is at /openapi.json (same host as the API). Example: npx openapi-typescript http://localhost:8000/openapi.json -o ./src/api/schema.d.ts from your frontend repo.

Development

Use make help for commands. Typical flow: make sync, make db, then make start (or make serve if you only need the API + built UI). See Quickstart.

uv sync --extra dev    # or: pip install -e ".[dev]"
pre-commit install
make db && make start

Make: sync, sync-web-dist, db, start, stop, serve, frontend, lint, fix, test, clean — see Makefile. Full guide: CONTRIBUTING.md.

Contributing & license

See CONTRIBUTING.md. Licensed under MIT — LICENSE.

Metadata

Release files for sraosha 0.2.1

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

Source distribution (sdist)

Source distribution for sraosha 0.2.1
File Size Uploaded Provenance Actions
sraosha-0.2.1.tar.gz 612.3 kB With provenance Details for sraosha-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sraosha 0.2.1
File Interpreter ABI Platform Actions
sraosha-0.2.1-py3-none-any.whl Python 3 none any Details for sraosha-0.2.1-py3-none-any.whl

Total release size: 959.7 kB

Release files / sraosha-0.2.1.tar.gz

Download URL sraosha-0.2.1.tar.gz
Size 612.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a360bcd5144b1db8ea16a3cd7cf514ddb92801bf788637b04a2808cd56262fe5
BLAKE2b-256 checksum
How to use checksums
8a3656aa6c3f5034323a273ad839a1236491d965112110acf225b0c43e859685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / sraosha-0.2.1-py3-none-any.whl

Download URL sraosha-0.2.1-py3-none-any.whl
Size 347.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
188b128de35b3e068bca81acb78341593b90d7a3a6ec5edb38e8b2c076335e64
BLAKE2b-256 checksum
How to use checksums
ec66bb7a64041d04bfe67c532ea81725429e0fe9e2a9ef6e32b19a1c13902e04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Security for sraosha 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sraosha-0.2.1.tar.gz

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 Apr 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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