Skip to main content

weaveforge (Python SDK)

Push ML experiments into the same dashboard as your papers and thesis plan.

The WeaveForge web app tracks literature, milestones, and report progress. This package connects your training scripts to that same database (Postgres on the project's OCI server, reached through the web app's /api/sdk/*) — runs, step-indexed curves, and figure artifacts show up under Experiments without a separate wandb/MLflow silo.

Why use it

Problem This SDK
Experiment logs live in TensorBoard; thesis context lives elsewhere One DB: link runs to related_paper, compare sweeps in the PWA
Wiring a custom API for every project Same RLS + migrations as the web app — self-host once
Heavy MLOps platforms Lightweight decorator + optional Lightning/Keras callbacks

Install

pip install weaveforge                 # core (supabase + httpx)
pip install 'weaveforge[figures]'      # matplotlib/Pillow artifacts
pip install 'weaveforge[tensorboard]'  # tbparse import
pip install 'weaveforge[wandb]'        # wandb import
pip install 'weaveforge[all,dev]'      # everything + pytest

Sync sources register at import time but stay unavailable until their extra is installed (clear error if you call one without deps).

Configure

Generate a personal access token in the web app (Settings → Python SDK access tokens). Tokens are created on demand, stored hashed server-side, and shown once — like GitHub or PyPI. Use them with the weaveforge package:

pip install weaveforge
export WEAVEFORGE_TOKEN=tt_...
export WEAVEFORGE_API_URL=http://localhost:3000
export WEAVEFORGE_PROJECT="My Thesis"   # or WEAVEFORGE_PROJECT_ID=<uuid>

The SDK sends the token to your WeaveForge instance, which validates it and applies row-level security as your user.

Against the desktop app, with no account

The desktop app serves the same routes from the database in your folder, so a training script can write into a copy that has never signed in. Open a project's Experiments → Experiment actions → Python SDK token (or Settings → Access tokens to pick permissions and expiry), create a token, copy it once — only its hash is kept — and point the SDK at the loopback port:

export WEAVEFORGE_TOKEN=<the token the app shows once>
export WEAVEFORGE_API_URL=http://127.0.0.1:27123
export WEAVEFORGE_PROJECT="My Thesis"

Nothing else changes: the same track(...), the same runs and curves, and the app shows them under Experiments as they arrive. The app has to be running, and the port only listens on 127.0.0.1 — no other machine can reach it.

Apply migrations through at least 0017 (metrics + artifacts bucket) — see root README § Database.

Quick example

from weaveforge import track_experiment

@track_experiment(name="beta-vae sweep", config={"latent_dim": 32},
                  sync={"tensorboard": "runs/beta4"})
def train(run, beta=4.0):
    for step in range(100):
        run.log_metric("val_loss", loss(step), step=step)
    run.log_figure(fig, name="reconstruction")
    return {"val_loss": 0.11}

train(beta=4.0)
  • @track_experiment — creates row (running), pins git state, logs metrics, uploads figures, sets done/failed on exit.
  • with track(...) as run: — same without a decorator.
  • Callbacks — weaveforge.integrations.lightning.WeaveForgeCallback, .keras.WeaveForgeCallback.

Keep W&B too

A run can be carried into Weights & Biases while it happens, so a lab that already watches W&B dashboards keeps watching them:

with weaveforge.track("beta-vae", config={"beta": 4.0}, mirror="wandb") as run:
    run.log_metrics({"loss": 0.4}, step=step)

Every number logged here is logged there, and the mirrored run is closed with this one (done → exit code 0, failed → 1). Two deliberate choices:

  • W&B never breaks training. The first failure to reach it logs a warning, switches mirroring off, and the run carries on writing where it always was.
  • No login prompt. With no WANDB_API_KEY, the mirror starts in W&B's offline mode — the run lands in a local directory to wandb sync later. Set WANDB_MODE yourself to override, and WANDB_PROJECT to name the project.

The other direction still exists: run.sync_wandb("entity/project/run_id") imports a run somebody else already finished.

CLI

weaveforge list --project "My Thesis"
weaveforge import-tb runs/beta4 --name "beta-vae sweep"
weaveforge import-wandb entity/project/run_id

Extend (Open/Closed)

Implement MetricSource (id, available(), read(ref)), register on default_registry, use track(sync={"my_source": ref}). Example: examples/custom_source.py.

Architecture

Mirrors the web app: features/experiments/{domain,application,infrastructure}, container.py composition root, repository interfaces tested with in-memory fakes. No duplicate schema — migrations in ../supabase/migrations/ are the contract.

Test

pip install -e '.[dev]'
pytest   # offline; the database integration test skips without env creds

More

Metadata

Release files for weaveforge 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weaveforge 0.7.0
File Size Uploaded
weaveforge-0.7.0.tar.gz 78.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weaveforge 0.7.0
File Interpreter ABI Platform
weaveforge-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 152.8 kB

Release files / weaveforge-0.7.0.tar.gz

Download URL weaveforge-0.7.0.tar.gz
Size 78.1 kB
Tags Source
SHA-256 checksum
How to use checksums
34234041830991c352b76111838aed210b7e3eee766ace8c3c4f5dbc7d6e80d7
BLAKE2b-256 checksum
How to use checksums
83f31fb55b72fb5829622c81a2a34dedde11df4b5436223d2604df78330c4216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / weaveforge-0.7.0-py3-none-any.whl

Download URL weaveforge-0.7.0-py3-none-any.whl
Size 74.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bac4d9ac8de4e593c21411bea6b7e7927a501b1ff4c09181e618003bd1f1d6e3
BLAKE2b-256 checksum
How to use checksums
741c7ecdf7e7a82a44a92dc7373d160b5abe60f45dc921a932b2b0dae4fa9828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.7.1

2 release files

This release

0.7.0 This release

2 release files

0.6.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