Contexta
Local-first observability for ML systems.
Quickstart | Product Surface | Docs Map
Contexta is a local-first ML observability library. It provides one canonical import root, one canonical CLI, one canonical workspace, and one consistent contract for writing, storing, querying, comparing, and recovering observability data — without a cloud backend.
Why Contexta
- One product surface
Start from
from contexta import Contextainstead of stitching together separate tools. - Canonical local workspace
Keep metadata, records, artifacts, reports, and recovery state in a local
.contexta/workspace. - Read-oriented investigation Query runs, compare outcomes, inspect diagnostics, follow lineage, and build reports from canonical data.
- Recovery built in Replay, backup, restore, and artifact transfer are first-class features, not separate utilities.
- Framework-agnostic Works alongside scikit-learn, PyTorch, HuggingFace Transformers, vLLM, or any other ML stack.
Quickstart
Install
pip install contexta
or with uv:
uv add contexta
Run your first example
The fastest way to see Contexta in action is the sklearn tabular example — no GPU required:
pip install contexta "scikit-learn>=1.6"
uv run python examples/quickstart/qs01_sklearn_tabular.py
This trains an SVM and a Random Forest on the UCI Wine dataset, logs CV fold metrics and evaluation metrics to a local .contexta/ workspace, then compares the two runs and registers the best model as a deployment.
For deep learning and LLM examples see examples/quickstart/.
Minimal usage
from datetime import datetime, timezone
from contexta import Contexta
from contexta.config import UnifiedConfig, WorkspaceConfig
from contexta.contract import (
Project, Run, StageExecution,
MetricPayload, MetricRecord, RecordEnvelope,
)
ctx = Contexta(config=UnifiedConfig(
project_name="my-project",
workspace=WorkspaceConfig(root_path=".contexta"),
))
store = ctx.metadata_store
now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
store.projects.put_project(Project(project_ref="project:my-project", name="my-project", created_at=now))
store.runs.put_run(Run(run_ref="run:my-project.run-01", project_ref="project:my-project",
name="run-01", status="completed", started_at=now, ended_at=now))
ctx.record_store.append(MetricRecord(
envelope=RecordEnvelope(
record_ref="record:my-project.run-01.r00001", record_type="metric",
recorded_at=now, observed_at=now, producer_ref="my-script",
run_ref="run:my-project.run-01",
completeness_marker="complete", degradation_marker="none",
),
payload=MetricPayload(metric_key="accuracy", value=0.95, value_type="float64"),
))
snapshot = ctx.get_run_snapshot("run:my-project.run-01")
report = ctx.build_snapshot_report("run:my-project.run-01")
print(report.title)
store.close()
Optional dependencies
Contexta's core runtime only requires duckdb. Install framework extras only for what you use:
pip install "contexta[sklearn]" # + scikit-learn
pip install "contexta[torch]" # + PyTorch
pip install "contexta[transformers]" # + HuggingFace Transformers + PyTorch
pip install "contexta[all-integrations]" # all of the above
Product Surface
| Surface | Status | Role | When To Start Here |
|---|---|---|---|
Contexta |
Stable | Unified facade | Default starting point |
contexta.config |
Stable | Config models, profiles, env overrides | When you need explicit config control |
contexta.contract |
Stable | Canonical models, validation, serialization | When you work directly with schema-level types |
contexta.capture |
Stable | Runtime capture scopes and emissions | When facade-level capture is not enough |
contexta.store.metadata |
Stable | Metadata truth plane | Advanced store access |
contexta.store.records |
Stable | Record truth plane | Replay, scan, export, integrity workflows |
contexta.store.artifacts |
Stable | Artifact truth plane | Artifact ingest, verify, export, import |
contexta.interpretation |
Stable | Query, compare, diagnostics, lineage, reports | Read and investigation flows |
contexta.recovery |
Advanced | Replay, backup, restore | Operator and recovery work |
The internal namespaces contexta.api, contexta.runtime, contexta.common, and contexta.surfaces are not public API targets.
Documentation Map
Core Entry Points
README.md— product overview, install, quickstartdocs/index.md— document hub
User Guide
docs/user-guide/getting-started.mddocs/user-guide/key-features.mddocs/user-guide/tools-and-surfaces.mddocs/user-guide/core-concepts.mddocs/user-guide/common-workflows.mddocs/user-guide/advanced.mddocs/user-guide/case-studies.md
Reference
docs/reference/api-reference.mddocs/reference/cli-reference.md
Operations And Contribution
docs/operations.mddocs/faq.mdCONTRIBUTING.mdSECURITY.md
Examples
examples/quickstart/— qs01 (sklearn), qs02 (PyTorch CNN), qs03 (BERT), qs04 (vLLM RAG)examples/case_studies/— 12 real-world observability scenariosexamples/recovery/— operator-oriented recovery workflows
Design Notes
- local-first: all data stays on your machine
- schema-first: every record follows a canonical contract
- reproducibility-oriented: environment snapshots and provenance are first-class
- explicit about degraded or incomplete states
Internally, Contexta separates truth-owning planes for metadata, records, and artifact bodies, then builds query, report, and recovery surfaces over those planes.
Metadata
Release files for contexta 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| contexta-1.0.0.tar.gz | 440.6 kB | Without provenance | Details for contexta-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| contexta-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for contexta-1.0.0-py3-none-any.whl |
Total release size: 689.0 kB
Release files / contexta-1.0.0.tar.gz
| Download URL | contexta-1.0.0.tar.gz |
|---|---|
| Size | 440.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9e95d895d1a4f30705dee21325824ba1ebb6c71b7675189c7c289f4c3706244
|
|
BLAKE2b-256 checksum How to use checksums |
08efc69d3aa2f4a5d22e81baa59e3b5e5b4538428e2db933e3930c3dfe200801
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / contexta-1.0.0-py3-none-any.whl
| Download URL | contexta-1.0.0-py3-none-any.whl |
|---|---|
| Size | 248.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
890b48af025806e30a590c71a4d3569a88ccf96bdb44f61959a4452b79c5a939
|
|
BLAKE2b-256 checksum How to use checksums |
247b1c2baaf3e50a9a737c2215fe95e99c0a71fd626c0027315408c708fddc2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for contexta 1.0.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.