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.0 KB
Raw Blame
import marimo

__generated_with = "0.0.0"
app = marimo.App(app_title="Test Notebook")


@app.cell
def _():
    import marimo as mo

    return (mo,)


@app.cell
def _(mo):
    mo.md("""
    # Code blocks in code blocks
    Output code for Hello World!
    ```python
    print("Hello World")
    ```
    Execute print
    ```python {.marimo}
    print("Hello World")
    ```
    """)


@app.cell
def _(mo):
    mo.md(f"""
    with f-string too!
    ```python {{.marimo}}
    print("Hello World")
    ```
    """)


@app.cell
def _(mo):
    mo.md(f"""
        Not markdown
        ```python {{.marimo}}
        print("1 + 1 = {1 + 1}")
        ```
    """)


@app.cell(hide_code=True)
def _(mo):
    mo.md(r"""
    Nested fence
    ````text
    The guards are
    ```python {.marimo}
    ````
    """)


@app.cell
def _():
    """
    ```
    """


@app.cell
def _(mo):
    mo.md("""
    Cross cell injection
    ```python
    """)


@app.cell
def _():
    1 + 1


@app.cell
def _():
    # Actual print
    print("Hello World")


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