App¶
- class marimo.App(**kwargs: Any)¶
A marimo notebook.
A marimo notebook is a dataflow graph, with each node computing a Python function.
- async embed() AppEmbedResult ¶
Embed a notebook into another notebook.
The
embed
method lets you embed the output of a notebook into another notebook and access the values of its variables.Example.
from my_notebook import app
# execute the notebook result = await app.embed()
# view the notebook's visual output result.output
# access the notebook's defined variables result.defs
Running
await app.embed()
executes the notebook and results an object encapsulating the notebook visual output and its definitions.Embedded notebook outputs are interactive: when you interact with UI elements in an embedded notebook’s output, any cell referring to the
app
object is marked for execution, and its internal state is automatically updated. This lets you notebooks as building blocks or components to create higher-level notebooks.Multiple levels of nesting are supported: it’s possible to embed a notebook that in turn embeds another notebook, and marimo will do the right thing.
Returns.
An object
result
with two attributes:result.output
(visual output of the notebook) andresult.defs
(a dictionary mapping variable names defined by the notebook to their values).