Skip to main content

Digital Gardening Kit — Lab notebook runtime utilities for Marimo notebooks in Obsidian vaults

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dgk_lab_runtime-0.2.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dgk_lab_runtime-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file dgk_lab_runtime-0.2.0.tar.gz.

File metadata

  • Download URL: dgk_lab_runtime-0.2.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dgk_lab_runtime-0.2.0.tar.gz
Algorithm Hash digest
SHA256 036cf377d66402651cc03aaca2326c07edc844bb4e69088596f7a42d1d85602d
MD5 a31d5165b5032c67a75de1a1b77ba70a
BLAKE2b-256 a5feb28e6ce1e5c540d56e526af6a87ee5f99c781ac20a485d697137eab5de08

See more details on using hashes here.

Provenance

The following attestation bundles were made for dgk_lab_runtime-0.2.0.tar.gz:

Publisher: publish-lab-runtime.yml on aretw0/vault-seed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dgk_lab_runtime-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dgk_lab_runtime-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc895e594be7b2a99f247128bcadcfcf03e32d93fe698636cafdb71f30015d56
MD5 d42a71d30910a177e12f894e657c67a2
BLAKE2b-256 349f0f2dbe76d4aefd4687b2edb653fc397a6335147ec11cae09f9211de8cef2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dgk_lab_runtime-0.2.0-py3-none-any.whl:

Publisher: publish-lab-runtime.yml on aretw0/vault-seed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page