Skip to main content

dgk-lab-runtime

Lab notebook runtime utilities from the Digital Gardening Kit.

Designed for Marimo notebooks that live alongside an Obsidian vault — handles the runtime boundary between local ETL (filesystem, secrets, network) and the published HTML/WASM notebook. Works with any vault layout; the defaults follow the vault-seed conventions (lab/ as the notebooks path, public/lab/ as the dataset directory) which you can override via environment variables or function arguments.

Install

pip install dgk-lab-runtime
# with scraping support (Playwright)
pip install "dgk-lab-runtime[scraping]"
# with OCR support (Tesseract)
pip install "dgk-lab-runtime[ocr]"

Usage

from dgk_lab_runtime import (
    lab_runtime_context,
    read_lab_json,
    load_lab_manifest,
    read_lab_dataset,
    write_local_json_snapshot,
    lab_altair_chart,
    lab_altair_status_color,
    fetch_wasm_feed,
    fetch_wasm_json,
    fetch_local_feed,
    fingerprint_data,
    with_data_provenance,
)

ctx = lab_runtime_context()
# {"runtime": "local", "isPackaged": False, "capabilities": {...}, ...}

# Read a dataset from the Lab manifest (local or Pyodide/WASM)
data = read_lab_dataset("my-dataset")

# Write a local JSON snapshot for the ETL/export boundary
write_local_json_snapshot(".dgk/my-dataset.json", data)

# Keep charts aligned with the Lab shell instead of Vega defaults
chart = lab_altair_chart(chart.encode(color=lab_altair_status_color("status:N")))

Configuration

Environment variable Default Description
VAULT_NOTEBOOKS_PATH lab URL segment where notebooks are published

Runtime boundary

Every function that writes files, reads secrets, or makes local outbound requests calls require_local_runtime() and raises RuntimeError when running inside a packaged HTML/WASM notebook. Browser-safe helpers such as fetch_wasm_json() and fetch_wasm_feed() use Pyodide's pyfetch with cache="no-store". This boundary is intentional: ETL logic runs locally before export; the published notebook only reads pre-generated snapshots or public CORS-friendly endpoints.

Vault-seed compatibility

If you use vault-seed, the _lab_notebook_runtime.py shim in 99 - Meta e Anexos/Notebooks/ imports this package transparently when installed, so existing notebooks work unchanged. Without installation the shim uses an inline fallback — same API, no external dependency.

License

GPL-3.0-only — see LICENSE.md in the repository root.

Metadata

Release files for dgk-lab-runtime 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 dgk-lab-runtime 0.2.1
File Size Uploaded
dgk_lab_runtime-0.2.1.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dgk-lab-runtime 0.2.1
File Interpreter ABI Platform
dgk_lab_runtime-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / dgk_lab_runtime-0.2.1.tar.gz

Download URL dgk_lab_runtime-0.2.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d198dca69c82a39da074b63d58741058458512246ad7794605a82cf4bbef5114
BLAKE2b-256 checksum
How to use checksums
f54e595ed4ea41021c1217360cba38c53288e4cd3c3a4430e4bbbb79e6f08234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jun 21, 2026.

Transparency log

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

Download URL dgk_lab_runtime-0.2.1-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
714ac24d49c41ed15890b0533f4a72fb1e568c570c6849f5cbe10e004a8c4559
BLAKE2b-256 checksum
How to use checksums
90e38531eb3b09c4d10d37d26723ac914ce2a6fe0196b6a390278c5ed8bb9af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jun 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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