Metadata-Version: 2.4
Name: drtoller
Version: 0.1.4
Summary: DrToller pipeline framework: DRTML spec, processing, runtime, integration
Author-email: DrToller contributors <drtoller@gmail.com>
Maintainer-email: DrToller <drtoller@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/drtoller/DrToller.Framework
Project-URL: Documentation, https://framework.drtoller.com/docs/
Project-URL: Repository, https://github.com/drtoller/DrToller.Framework
Project-URL: Issues, https://github.com/drtoller/DrToller.Framework/issues
Project-URL: Changelog, https://github.com/drtoller/DrToller.Framework/blob/main/CHANGELOG.md
Project-URL: Security, https://github.com/drtoller/DrToller.Framework/security
Keywords: drtml,pipeline,ontology,parquet,ray
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: pyyaml>=6
Requires-Dist: pydantic>=2
Requires-Dist: pyarrow>=14
Requires-Dist: prometheus_client>=0.22
Requires-Dist: numpy>=1.24
Requires-Dist: eval_type_backport>=0.2; python_version < "3.10"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"
Requires-Dist: moto>=5; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: ruff>=0.8; extra == "dev"
Requires-Dist: pre-commit>=3.5; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5; extra == "docs"
Provides-Extra: ray
Requires-Dist: ray>=2.40; extra == "ray"
Provides-Extra: s3
Requires-Dist: boto3>=1.34; extra == "s3"
Provides-Extra: pg
Requires-Dist: psycopg2-binary>=2.9; extra == "pg"
Provides-Extra: ui
Requires-Dist: streamlit>=1.28; extra == "ui"
Requires-Dist: requests>=2.31; extra == "ui"
Requires-Dist: tomli>=2; python_version < "3.11" and extra == "ui"
Dynamic: license-file

# drtoller

[![Framework unit](https://github.com/drtoller/DrToller.Framework/actions/workflows/framework-unit.yml/badge.svg)](https://github.com/drtoller/DrToller.Framework/actions/workflows/framework-unit.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

**DrToller pipeline framework** — run data/NLP ontology steps from declarative **DRTML** manifests: storage, partition/mapping/reduce, probe, Prometheus metrics, Airflow/Ray/Streamlit integrations.

Domain steps live in separate packs (`drtoller.edge` / `drtoller.ops`). This package is the reusable runtime.

**License:** [Apache License 2.0](LICENSE)  
**Status:** Developer preview (`0.x`) — [CHANGELOG.md](CHANGELOG.md)  
**Docs:** [framework.drtoller.com/docs](https://framework.drtoller.com/docs/)  
**Security:** [SECURITY.md](SECURITY.md)  
**Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md) · [Code of Conduct](CODE_OF_CONDUCT.md)  
**Repository:** [github.com/drtoller/DrToller.Framework](https://github.com/drtoller/DrToller.Framework)

## Quick start

```bash
pip install drtoller
# or from a clone:
pip install -e ".[dev]"
# optional extras: ray, pg, s3, ui

drtoller version
drtoller init my-pipeline
python3 -m pytest -q examples/hello-step examples/hello-plugin examples/hello-mapping examples/agent-pipeline-loop
```

Canonical CLI and PyPI name: **`drtoller`** (see [docs/CLI_MIGRATION.md](docs/CLI_MIGRATION.md)).  
Import path stays `drtoller.framework.*`.  
AI loop: [docs/ai-automation/ai-quickstart.md](docs/ai-automation/ai-quickstart.md).

Canonical docs: **[framework.drtoller.com/docs](https://framework.drtoller.com/docs/)** · in-repo tutorial: **[docs/tutorial-write-a-step.md](docs/tutorial-write-a-step.md)**.  
Release / PyPI: **[docs/PUBLISHING.md](docs/PUBLISHING.md)**.

### 1. Install

```bash
pip install -e ".[dev]"
```

Editable install from this directory (no need to set `PYTHONPATH` to edge/ops).

### Optional extras

| Extra | Install | Provides |
|-------|---------|----------|
| `dev` | `pip install -e ".[dev]"` | pytest, moto, build, ruff, pre-commit, mypy, pytest-cov |
| `docs` | `.[docs]` | MkDocs (`mkdocs serve`) |
| `ray` | `.[ray]` | Ray parallel backends |
| `pg` | `.[pg]` | PostgreSQL (`psycopg2`) |
| `s3` | `.[s3]` | MinIO/S3 (`boto3`) |
| `ui` | `.[ui]` | Streamlit launcher |

Combine: `pip install -e ".[dev,pg,ray]"`.

### 2. Validate a manifest

```bash
drtoller validate path/to/step.drtml
# also compile storage/feed plans:
drtoller validate path/to/step.drtml --compile
```

### 2b. Inspect capability catalog

```bash
drtoller inspect
drtoller inspect --format json
drtoller inspect sgns_v1 --kind algorithm
```

Agent-oriented docs: [docs/ai-automation/overview.md](docs/ai-automation/overview.md).  
Example loop (no LLM): [examples/agent-pipeline-loop](examples/agent-pipeline-loop/).

### 3. Run examples

```bash
python3 -m pytest -q examples/hello-step      # partition: parquet → greet → parquet
python3 -m pytest -q examples/hello-plugin    # Extension SDK pattern register
python3 -m pytest -q examples/hello-mapping   # mapping hash-merge
python3 -m pytest -q examples/agent-pipeline-loop  # catalog → validate → repair
```

Walkthroughs: [hello-step](examples/hello-step/README.md), [hello-plugin](examples/hello-plugin/README.md), [hello-mapping](examples/hello-mapping/README.md), [agent-pipeline-loop](examples/agent-pipeline-loop/README.md).

Local docs preview:

```bash
pip install -e ".[docs]"
mkdocs serve
```

### 4. Framework-only tests

```bash
env -u PYTHONPATH ONTOBUILDER_ROOT= python3 -m pytest -q \
  -m "not requires_ops and not requires_platform and not integration"
# or:
./src/drtoller/framework/dev/scripts/run-tests.sh
```

Contract tests that load sibling `drtoller.edge` / `drtoller.ops` (when present):  
`RUN_OPS_TESTS=1 ./src/drtoller/framework/dev/scripts/run-tests.sh`

## Public API (`0.x`)

Stable surface for this preview (also listed in package `__all__`):

| Symbol | Role |
|--------|------|
| `run_from_manifest` | Execute a step from a `*.drtml` path |
| `load_manifest_path` / `compile_step_manifest` / `merged_params_from_manifest` | DRTML load / compile / params |
| `StorageSession` | Run-scoped storage façade |
| `ProcessResult` | Processor output (logical row dicts) |
| `load_plugins` | Discover `drtoller.plugins` entry points |
| `drtoller.framework.ext` | Extension SDK (`register_*`) |

Everything else under `drtoller.framework.*` is **internal** and may change in `0.x`.  
Details: [docs/public-api.md](docs/public-api.md), [docs/internals.md](docs/internals.md).

## Write your own step (sketch)

1. Author `my_step.drtml` (`drtml: 4`, `run.type: partition|mapping|…`).
2. Implement a processor that returns `ProcessResult` (logical row dicts).
3. Point `run.processor.batch` at `my_pkg.module:process_batch`.
4. `drtoller validate my_step.drtml --compile`.

Guides: [docs/tutorial-write-a-step.md](docs/tutorial-write-a-step.md), [docs/writing-a-step.md](docs/writing-a-step.md), [docs/plugins.md](docs/plugins.md), [docs/EXTENSION_SDK.md](docs/EXTENSION_SDK.md).

## Layout

```text
.
  src/drtoller/framework/   # package sources (import: drtoller.framework.*)
    drtml/          # load / validate / compile DRTML
    processing/     # partition_loop, mapping, reduce, probe, …
    storage/        # parquet/feed/session
    db/             # postgres / qdrant transport
    algorithms/     # embed / cluster / metrics math
    telemetry/      # Prometheus + Grafana codegen
    integration/    # airflow, local, ui, ray
    ext/            # Extension SDK
    cli.py          # drtoller
    dev/tests/      # framework unit tests
  docs/             # quickstart, public API, steps, plugins
  examples/         # hello-step, hello-plugin, hello-mapping
```

Full file map (RU, inventory): **[FILES.md](FILES.md)** — start with [docs/](docs/) for onboarding.

## Step flow (short)

1. Load `*.drtml` → merge params  
2. `processing/dispatch.py` → pattern / `execution.entry`  
3. Framework feeds storage → domain processor → `ProcessResult` → session write  
4. Metrics emit from DRTML plans (steps never call Prometheus)

## Algorithms

Pure embed/cluster/metric math lives in `algorithms/`. K-selection / probe **decide** policy stays in domain steps.
