Python Notebooks: Marimo, Reactivity, and Runtime
This section describes how Python code executes inside Boardflare workbooks, including the Marimo reactive model, interactive UI controls for App mode, imports and dependencies, and the Pyodide WebAssembly environment.
The Marimo Reactive Model
Boardflare uses Marimo as its notebook engine. Unlike traditional Jupyter notebooks, execution order is determined by a Directed Acyclic Graph (DAG) of variable references, not top-to-bottom cell order.
Imports and Dependencies
Notebooks have no PEP 723 # /// script block. Do not write one: the runtime injects its own block (pandas and the boardflare wheel) when it loads the notebook, and notebook headers start at import marimo:
import marimo
app = marimo.App(width="medium")Just import what you need. Imports resolve from the Pyodide lockfile, which includes the pre-bundled companion packages, plus the Python standard library. Nothing is fetched from PyPI.
Why no declarations: Marimo sends every declared dependency that is not already loaded to micropip.install, which fetches from PyPI and fails under the notebook’s connect-src 'self' policy. A declaration adds nothing for packages the lockfile already provides, and only adds a failure path for packages it does not.
The Pyodide WebAssembly Runtime
Boardflare executes Python in the user’s browser using Pyodide (Python compiled to WebAssembly).
Security and Network Isolation
- Zero-Network Sandbox: The notebook execution iframe runs under a strict Content Security Policy (
connect-src 'self'). It has no access to external internet addresses, raw sockets, or local filesystem resources. - No Runtime Pip Installation: Dynamic package installation at runtime via pip or network fetching is disabled. Packages cannot be installed at runtime; imports resolve from the Pyodide lockfile, which includes the pre-bundled companion packages.
Pre-bundled Companion Packages
To provide rich analytical and data capabilities without external network access, the Boardflare runtime pre-bundles 15 pure-Python companion packages directly into the Pyodide image lockfile:
| Package | Version | Primary Import Name(s) | Description |
|---|---|---|---|
babel |
2.18.0 | babel |
Internationalization and formatting utilities |
chardet |
7.6.0 | chardet |
Universal character encoding detector |
colorcet |
3.2.1 | colorcet |
Perceptually uniform colormaps |
defusedxml |
0.7.1 | defusedxml |
XML bomb and entity expansion protection |
et-xmlfile |
2.0.0 | et_xmlfile |
Low-memory XML generator for OpenPyXL |
humanize |
4.16.0 | humanize |
Human-readable numbers, times, and file sizes |
intervaltree |
3.2.1 | intervaltree |
Interval tree data structures |
jmespath |
1.1.0 | jmespath |
Declarative JSON query language |
openpyxl |
3.0.9 | openpyxl |
Excel spreadsheet reading and writing |
plotly |
7.1.0 | plotly, _plotly_utils |
Interactive visualization library |
python-slugify |
9.0.0 | slugify |
String slugification library |
seaborn |
0.13.2 | seaborn |
Statistical data visualization |
tabulate |
0.10.0 | tabulate |
Pretty-print tabular data |
text-unidecode |
1.3 | text_unidecode |
Unicode to ASCII transliteration |
textdistance |
4.6.3 | textdistance |
Distance and similarity algorithms between sequences |
These packages can be imported immediately in any notebook without installation:
import humanize
import plotly.express as px
import seaborn as snsVerified Package List
- Human-readable package catalog: https://notebook.boardflare.com/python/packages.html
- Machine-readable JSON inventory: https://notebook.boardflare.com/python/packages.json
Only packages available in Pyodide or included on the companion list can be imported. Attempting to import an unavailable package raises ModuleNotFoundError.