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.1.tar.gz (9.9 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.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dgk_lab_runtime-0.2.1.tar.gz
  • Upload date:
  • Size: 9.9 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.1.tar.gz
Algorithm Hash digest
SHA256 d198dca69c82a39da074b63d58741058458512246ad7794605a82cf4bbef5114
MD5 4a774bbf4d66814d6bd5acccda19cf70
BLAKE2b-256 f54e595ed4ea41021c1217360cba38c53288e4cd3c3a4430e4bbbb79e6f08234

See more details on using hashes here.

Provenance

The following attestation bundles were made for dgk_lab_runtime-0.2.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dgk_lab_runtime-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 714ac24d49c41ed15890b0533f4a72fb1e568c570c6849f5cbe10e004a8c4559
MD5 238fa5f25701fcbb84b6876d7c6def45
BLAKE2b-256 90e38531eb3b09c4d10d37d26723ac914ce2a6fe0196b6a390278c5ed8bb9af3

See more details on using hashes here.

Provenance

The following attestation bundles were made for dgk_lab_runtime-0.2.1-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