Metadata-Version: 2.4
Name: strata-lang
Version: 0.1.6
Summary: Strata — declarative, versioned, immutable data transformations (compiles to SQL)
Author-email: Strata <hello@strata-lang.org>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Tzinny-dev/strata
Project-URL: Repository, https://github.com/Tzinny-dev/strata
Project-URL: Issues, https://github.com/Tzinny-dev/strata/issues
Keywords: sql,data-engineering,dbt,duckdb,data-contracts,lineage
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Intended Audience :: Developers
Classifier: Topic :: Database
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: duckdb<2.0,>=1.0
Requires-Dist: PyYAML<7.0,>=6.0
Provides-Extra: postgres
Requires-Dist: psycopg2-binary<3.0,>=2.9; extra == "postgres"
Provides-Extra: bigquery
Requires-Dist: google-cloud-bigquery<4.0,>=3.0; extra == "bigquery"
Provides-Extra: snowflake
Requires-Dist: snowflake-connector-python<4.0,>=3.0; extra == "snowflake"
Provides-Extra: airflow
Requires-Dist: apache-airflow<3.0,>=2.8; extra == "airflow"
Provides-Extra: prefect
Requires-Dist: prefect<3.0,>=2.14; extra == "prefect"
Provides-Extra: portalocker
Requires-Dist: portalocker<3.0,>=2.8; extra == "portalocker"
Provides-Extra: iceberg
Requires-Dist: pyiceberg[pyarrow]<1.0,>=0.7; extra == "iceberg"
Provides-Extra: dev
Requires-Dist: pytest<9.0,>=8.0; extra == "dev"
Requires-Dist: pytest-cov<6.0,>=5.0; extra == "dev"
Requires-Dist: coverage<8.0,>=7.0; extra == "dev"
Requires-Dist: psycopg2-binary<3.0,>=2.9; extra == "dev"
Requires-Dist: ruff<0.17,>=0.16.0; extra == "dev"
Requires-Dist: mypy<2.0,>=1.10.0; extra == "dev"
Requires-Dist: hypothesis<7.0,>=6.90; extra == "dev"
Provides-Extra: all
Requires-Dist: psycopg2-binary<3.0,>=2.9; extra == "all"
Requires-Dist: google-cloud-bigquery<4.0,>=3.0; extra == "all"
Requires-Dist: snowflake-connector-python<4.0,>=3.0; extra == "all"
Requires-Dist: apache-airflow<3.0,>=2.8; extra == "all"
Requires-Dist: prefect<3.0,>=2.14; extra == "all"
Requires-Dist: portalocker<3.0,>=2.8; extra == "all"
Dynamic: license-file

# Strata — prototype

[![CI](https://github.com/Tzinny-dev/strata/actions/workflows/ci.yml/badge.svg)](https://github.com/Tzinny-dev/strata/actions/workflows/ci.yml) [![Binary](https://github.com/Tzinny-dev/strata/actions/workflows/binary.yml/badge.svg)](https://github.com/Tzinny-dev/strata/actions/workflows/binary.yml) [![Publish](https://github.com/Tzinny-dev/strata/actions/workflows/publish.yml/badge.svg)](https://github.com/Tzinny-dev/strata/actions/workflows/publish.yml) [![PyPI](https://img.shields.io/pypi/v/strata-lang)](https://pypi.org/project/strata-lang/) [![Python](https://img.shields.io/pypi/pyversions/strata-lang)](https://pypi.org/project/strata-lang/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Coverage 80%](https://img.shields.io/badge/coverage-80%25-brightgreen)](htmlcov/index.html)

Declarative, versioned, immutable data transformations. Compiles to SQL (DuckDB/Postgres/BigQuery/Snowflake), with column-level lineage and 3-phase contract pins.

> Working title v0.1 — prototype lives in `prototype/`. Spec in `../spec/`.

## Install (dev)

```bash
cd prototype
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
strata --help
```

Or without venv after publish:

```bash
pip install strata-lang
strata --help
```

### uv (standalone tool, no venv)

```bash
# from PyPI (once published) — package is strata-lang, entry point stays `strata`
uv tool install strata-lang
strata --help

# from Git (before PyPI, or dev)
uv tool install git+https://github.com/Tzinny-dev/strata --from prototype
strata --help

# upgrade
uv tool upgrade strata-lang
pip install --upgrade strata-lang
```

## Quick start

```bash
# typecheck + contracts + lineage (no DB)
strata build examples/daily_orders.strata

# emit SQL for a dialect
strata compile examples/daily_orders.strata --dialect postgres

# materialize in DuckDB (with demo fixtures)
strata run examples/daily_orders.strata --seed -o /tmp/demo.duckdb
strata test examples/daily_orders.strata --seed
```

See `docs/getting-started.md` and `docs/tutorial.md` for the full walkthrough (every code block was run against the CLI before writing).

## Warehouses

| Warehouse | SQL emit (`compile --dialect`) | Engine run (`run -o` / `exec`) | Driver |
|---|---|---|---|
| DuckDB | ✅ | ✅ `DuckDBWarehouse` + `dbcompat` (`duckdb` default dep) | `duckdb` |
| Postgres | ✅ | ✅ `cli.open_warehouse("postgres://...")` → `dbcompat.PGConn` (tested against ephemeral Postgres 16) — `adapters.get_adapter("postgres")` remains stub E095 intentionally | `pip install strata[postgres]` |
| BigQuery | ✅ | ✅ `BigQueryWarehouse` → `dbcompat.BigQueryConn` (`bigquery://project/dataset?location=US`) + `get_adapter("bigquery")` | `pip install strata[bigquery]` |
| Snowflake | ✅ | ✅ `SnowflakeWarehouse` → `dbcompat.SnowflakeConn` (`snowflake://user:pass@account/db/schema?warehouse=WH&role=ROLE`) + `get_adapter("snowflake")` | `pip install strata[snowflake]` |

## Experimental modules

| Module | Status | Notes |
|---|---|---|
| `strata.integrations` | scaffolding only | `airflow_dag_factory`/`prefect_flow_factory` return *strings* of Python source; `airflow`/`prefect` not installed by default (`pip install strata[airflow]` / `[prefect]`). No real DAG/flow is instantiated — see `plan-hito-2.md` §B. |
| `strata.testing` | fixture helpers only | `create_test_source`/`FreshnessTestHelper` emit `.strata` text or temp tables; not wired to the executor for e2e. Use `strata.exec` for real freshness gates. |
| `strata.observability` | connected | `MetricsCollector` is imported by `strata.exec._run_locked` and exposed via `get_metrics()`; exporters are formatters (Prometheus/StatsD/JSON) without external deps. |

## Standalone binary

```bash
# curl | bash (detects OS/arch, pulls from GH Releases)
curl -fsSL https://raw.githubusercontent.com/Tzinny-dev/strata/main/install.sh | bash
strata --help
# or pin version / custom dir
curl -fsSL .../install.sh | bash -s -- --version 0.1.6 --to /usr/local/bin
```

```bash
# Homebrew (tap — formula in homebrew/strata-lang.rb, sha256 replaced on release)
brew tap Tzinny-dev/strata  # or: brew tap Tzinny-dev/homebrew-strata if split
brew install strata-lang
strata --help
```

## Docker

```bash
# from GHCR (after tag push triggers docker.yml)
docker pull ghcr.io/tzinny-dev/strata:0.1.6
docker run --rm ghcr.io/tzinny-dev/strata:0.1.6 --help
docker run --rm -v $PWD:/work -w /work ghcr.io/tzinny-dev/strata:0.1.6 build examples/daily_orders.strata
docker run --rm -v $PWD:/work -w /work ghcr.io/tzinny-dev/strata:0.1.6 run examples/daily_orders.strata --seed -o /tmp/demo.duckdb

# local build (no docker daemon required on host for CI build via GHA)
docker build -t ghcr.io/tzinny-dev/strata:0.1.6 -f Dockerfile .
```

## VS Code extension

```bash
# marketplace (id: Tzinny-dev.strata-tzinny, version aligned with strata-lang)
code --install-extension Tzinny-dev.strata-tzinny
```

Syntax highlighting for `.strata` + LSP client over `strata lsp`:
diagnostics (the same `Checker` as `strata check`), completion of
models/sources/columns, type hover and go-to-definition for
columns. Requires `strata` on the `PATH` or the setting
`strata.binaryPath`. Local rebuild: `cd vscode && npm install &&
npm run compile && npx vsce package`. See `docs-site/guide/vscode.md`.

## Development

```bash
.venv/bin/pytest -q
.venv/bin/pytest --cov=strata --cov-fail-under=80
```

Coverage gate: 80% (`pyproject.toml` / `pytest.ini`).
