Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

1.3 KB
Raw Blame
# /// script
# [tool.marimo.runtime]
# auto_instantiate = true
# ///
import marimo

__generated_with = "0.0.5"
app = marimo.App(width="columns")


@app.cell(column=0)
def __(deep_and_far_variable, far_away_variable):
    # Two matches in this cell, so find-next must step through both before
    # leaving the column.
    usage_of_far_away = far_away_variable + 1
    another_usage = far_away_variable * 2
    usage_of_deep_and_far = deep_and_far_variable + 1
    return (another_usage, usage_of_deep_and_far, usage_of_far_away)


@app.cell(column=1)
def __():
    filler_one = "filler"
    return (filler_one,)


@app.cell(column=2)
def __():
    filler_two = "filler"
    return (filler_two,)


@app.cell(column=3)
def __():
    far_away_variable = 42
    return (far_away_variable,)


@app.cell(column=4)
def __():
    import marimo as mo

    return (mo,)


@app.cell(column=4)
def __(mo):
    # Tall enough to push the cell below into needing a vertical scroll too
    # (viewport height is 720px), unlike far_away_variable, which only ever
    # needs a horizontal scroll.
    mo.ui.text_area(value="filler", rows=80, full_width=True)
    return


@app.cell(column=4)
def __():
    deep_and_far_variable = 99
    return (deep_and_far_variable,)


if __name__ == "__main__":
    app.run()