Metadata-Version: 2.4
Name: clearmetric-core
Version: 0.3.0
Summary: ClearMetric Core — local compiler, graph engine, and CLI foundation.
Author: ClearMetric Labs
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/ClearMetric-Labs/ClearMetric-Core
Project-URL: Source, https://github.com/ClearMetric-Labs/ClearMetric-Core
Project-URL: Issues, https://github.com/ClearMetric-Labs/ClearMetric-Core/issues
Keywords: catalog,lineage,metadata,graph,sql,dbt,powerbi,analytics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: jsonschema>=4.0
Requires-Dist: pydantic>=2.10.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: sqlglot>=25.0.0
Requires-Dist: pbi-parsers>=0.9.5
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: PyYAML>=6.0; extra == "dev"
Provides-Extra: release
Requires-Dist: build>=1.2.2; extra == "release"
Requires-Dist: twine>=5.1.1; extra == "release"

# clearmetric-core

One PyPI package. All ClearMetric Core modules ship inside this distribution.

## Install

```bash
python -m pip install clearmetric-core
```

## CLI (project-first)

```bash
cm init
cm connect warehouse --information-schema ./warehouse_schema.json
cm scan
cm compile --format json > graph.json
cm impact orders.amount --upstream
cm clean
cm contract graph.json
```

If `cm` is occupied on your PATH:

```bash
python -m clearmetric.cli --project-dir . compile --format json
```

## Modules

| Module | Purpose |
|--------|---------|
| `clearmetric.compiler` | Discover → adapters → merge → policy/cleaner spine |
| `clearmetric.core` | Artifact schema, canonical IDs, merge, validation |
| `clearmetric.lineage` | Project-level SQL lineage from dbt manifests and SQL folders |
| `clearmetric.query` | Single-statement SQL structure mapping |
| `clearmetric.powerbi` | PBIP file lineage (not in v0 warehouse CLI registry) |
| `clearmetric.cli` | `cm` command router |

## Imports

```python
from pathlib import Path
from clearmetric.compiler import compile
from clearmetric.core import CatalogArtifact, merge, parse_column_selection
from clearmetric.lineage import (
    build_catalog_artifact_from_project,
    load_project,
    trace_upstream_from_project,
)
```

For local development:

```bash
python -m pip install -e ".[dev,release]"
```

## Contract

The source of truth for the shared artifact contract is
[`docs/contract.md`](docs/contract.md).

Project config schema: [`../../spec/clearmetric-project.schema.json`](../../spec/clearmetric-project.schema.json)

Example project: [`../../examples/wedge-jaffle`](../../examples/wedge-jaffle)
