Marimo-based notebook framework for ML/DS work — standalone tools and embeddable learningfoundry exercises from one source
Project description
nbfoundry
Marimo-based notebook framework for ML/DS work. One notebook source compiles into two
artifacts: a standalone runnable application and an ExerciseBlock-compatible artifact
that drops into a learningfoundry curriculum.
For the why, see docs/specs/concept.md. For the what, see
docs/specs/features.md. For the how, see
docs/specs/tech-spec.md.
Installation
nbfoundry targets Python 3.12.13 with Pyve + venv (exclusively — no conda or
micromamba). The Metal ML stack is fully pip-installable on Apple Silicon, so each
scaffolded project ships per-stage pip requirements instead of a conda env file:
requirements-base.txt— framework-agnostic core (thedata_*stages).requirements-torch.txt— torch-family stack (themodel_*stages);-r-includes the base.requirements-tf.txt— TensorFlow-family option;-r-includes the base.
These ship as package data: nbfoundry init copies the stage-appropriate file into
every scaffolded project, and the standalone artifact emitter falls back to
requirements-base.txt when the source carries none.
Apple Silicon quickstart
The stack defaults to Apple Silicon with Metal/MPS acceleration: PyTorch via the bare
torch MPS wheel, TensorFlow via tensorflow-macos + tensorflow-metal, and the
bundled Keras 3 namespace from TF 2.16+. The torch stack also ships the wider
cross-project set (HuggingFace transformers / datasets / peft, Optuna, the
plotly/seaborn/pyarrow utility set, and the Pointmatic-internal ml-datarefinery).
Scaffold a project and build its venv with plain pip — no micromamba:
nbfoundry init demo --template model_experimentation
cd demo
pyve init # creates the project venv
pip install -r requirements-torch.txt # torch + HuggingFace + Optuna on MPS
A data_* scaffold instead emits requirements-base.txt (no ML framework). Because
torch and tensorflow are never co-installed in one venv, a learner cannot hit the
PyTorch-MPS / TensorFlow-Metal co-residence crash.
Framework Metal verification is done dev-side via the lazy named smoke envs (
pyve test --env smoke-torch …/--env smoke-tensorflow …); seedocs/specs/env-dependencies.md.
Cross-platform users (CUDA / CPU-only)
The requirements files ship comment-delimited swap guidance:
- PyTorch CUDA: install torch from the PyTorch index instead of the bare line, e.g.
pip install torch --index-url https://download.pytorch.org/whl/cu128(cpu/cu126/cu128). - TensorFlow CPU-only or Linux+CUDA: in
requirements-tf.txt, replace thetensorflow-macos/tensorflow-metallines withtensorflow>=2.16(CPU-only) ortensorflow[and-cuda]>=2.16(Linux + CUDA).
Both notes are documented inline at the top of the relevant requirements file.
Development setup (Pyve two-env)
pyve init
pyve run pip install -e .
pyve env init
pyve env run pip install -e .
pyve env install -r requirements-dev.txt
Run the suite with pyve test (lint: pyve env run ruff check .; types:
pyve env run mypy). Hardware smokes are opt-in: pyve test --env smoke-torch …
/ --env smoke-tensorflow … -m hardware.
Usage
nbfoundry exposes four commands. Compile and validate are offline,
deterministic, and side-effect-free — they read only the files you point them at
and never touch the network.
1. Scaffold a notebook — init
nbfoundry init demo --template data_exploration
--template is one of the five lifecycle stages: data_exploration,
data_preparation, model_experimentation, model_optimization,
model_evaluation (defaults to data_exploration). The scaffold contains a
reactive Marimo notebook.py plus the stage-appropriate requirements-*.txt.
2. Run it as a standalone app — compile
nbfoundry compile demo --out dist
Produces a self-contained artifact directory (the compiled notebook(s), the
requirements-*.txt, and a launch.py entry point) that runs locally with no
server or cloud dependency.
3. Compile to a learningfoundry exercise — compile-exercise
Author an exercise YAML whose sections carry (or reference, via code_file) the
notebook code, plus instructional metadata:
# exercise.yaml
title: Explore a dataset
description: Load, describe, and visualize the data.
sections:
- title: Load
description: Read the CSV into a DataFrame.
code: |
import pandas as pd
df = pd.read_csv("data.csv")
nbfoundry compile-exercise exercise.yaml --out exercise.json # or omit --out for stdout
The output is an ExerciseBlock-compatible dict (the BR-1 wire shape) that drops
into a learningfoundry curriculum. The full schema — instructions, hints,
expected outputs, and the BR-4 submission block with client-side grading — is
defined in docs/specs/learningfoundry/dependency-spec.md.
4. Validate without compiling — validate
nbfoundry validate exercise.yaml # exit 0 when clean; exit 1 with all errors on stdout
Two surfaces from one source (AC-3)
The same notebook source feeds both outputs: compile turns it into a
runnable standalone app, while compile-exercise (whose sections reference that
same notebook via code_file) turns it into an embeddable curriculum exercise —
no rewrite when the purpose shifts. That dual-surface compile is the core of
nbfoundry's value (see docs/specs/concept.md).
Further reading
docs/specs/concept.md— why nbfoundry exists (problem/solution space).docs/specs/features.md— what it does (requirements, behavior, acceptance criteria).docs/specs/tech-spec.md— how it is built (architecture, dependencies, testing strategy).docs/specs/learningfoundry/dependency-spec.md— theExerciseBlockcontract the compiled exercise targets.docs/specs/env-dependencies.md— the dev/test environment topology.
Releasing to PyPI
Releases ship through .github/workflows/publish.yml,
which is triggered by pushing a v* tag. The workflow builds an sdist + wheel with
hatch build and publishes via PyPI trusted publishing
(OIDC, no long-lived API tokens).
One-time PyPI setup: register nbfoundry on PyPI and add a pending trusted publisher
under the project's Publishing settings — owner pointmatic, repository nbfoundry,
workflow publish.yml, environment pypi.
Per-release procedure:
- Land the version-bump story on
main(package version insrc/nbfoundry/_version.pyand a matchingCHANGELOG.mdentry). - Tag the commit with the matching
v<version>(e.g.git tag v0.29.0 && git push origin v0.29.0). - The workflow verifies the tag matches
hatch version, builds the distributions, and publishes to PyPI under thepypiGitHub environment.
The workflow refuses to publish if the tag and hatch version disagree, so the only way
to ship a release is to tag the same commit that owns the version bump.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbfoundry-0.45.0.tar.gz.
File metadata
- Download URL: nbfoundry-0.45.0.tar.gz
- Upload date:
- Size: 460.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9070205e696d73bdcd2b30ab53564f7b78fa414b9221c775181172698cfb9e01
|
|
| MD5 |
6f5c8378bac7568d90a943e8100d342c
|
|
| BLAKE2b-256 |
82efb8d43d746df7dd970a649eb48846d8dd9e4ed0b4a0cb5cb8c0767777ea02
|
Provenance
The following attestation bundles were made for nbfoundry-0.45.0.tar.gz:
Publisher:
publish.yml on pointmatic/nbfoundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbfoundry-0.45.0.tar.gz -
Subject digest:
9070205e696d73bdcd2b30ab53564f7b78fa414b9221c775181172698cfb9e01 - Sigstore transparency entry: 1855930678
- Sigstore integration time:
-
Permalink:
pointmatic/nbfoundry@90e97d3b046633f4705290145baeb16953496830 -
Branch / Tag:
refs/tags/v0.45.0 - Owner: https://github.com/pointmatic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90e97d3b046633f4705290145baeb16953496830 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nbfoundry-0.45.0-py3-none-any.whl.
File metadata
- Download URL: nbfoundry-0.45.0-py3-none-any.whl
- Upload date:
- Size: 36.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6488168329f323a078bc3718c3be3a4ff9eea350b0f87043b183c05d98c22e3c
|
|
| MD5 |
621519ec07dc852b114be904e0777af6
|
|
| BLAKE2b-256 |
063babac0aa3cfff66fcfda0b4ce79ca2119c56a12de0142c2be257a136c1128
|
Provenance
The following attestation bundles were made for nbfoundry-0.45.0-py3-none-any.whl:
Publisher:
publish.yml on pointmatic/nbfoundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbfoundry-0.45.0-py3-none-any.whl -
Subject digest:
6488168329f323a078bc3718c3be3a4ff9eea350b0f87043b183c05d98c22e3c - Sigstore transparency entry: 1855930731
- Sigstore integration time:
-
Permalink:
pointmatic/nbfoundry@90e97d3b046633f4705290145baeb16953496830 -
Branch / Tag:
refs/tags/v0.45.0 - Owner: https://github.com/pointmatic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90e97d3b046633f4705290145baeb16953496830 -
Trigger Event:
push
-
Statement type: