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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: trim `return` for ruff formatting (#11430)
Dylan Madisettia61726dcda47
diff --git a/marimo/_ast/codegen.py b/marimo/_ast/codegen.pyindex 68e58a4305..d7645635ac 100644--- a/marimo/_ast/codegen.py+++ b/marimo/_ast/codegen.py@@ -158,6 +158,24 @@ def _needs_trailing_blank_line(mod: ast.Module, code: str) -> bool:return last_stmt.end_lineno == code_lines+def _can_strip_bare_return(cell: CellImpl) -> bool:+ """Returns True if a bare return can be safely omitted (ruff-compatible)."""+ # Comment only case+ if not cell.mod.body:+ return False+ # If the user has explicit \n, then we leave it+ if cell.code.rstrip(" \t") != cell.code.rstrip(" \t\r\n"):+ return False+ # A single function/class def would trigger toplevel reclassification+ return not (+ len(cell.mod.body) == 1+ and isinstance(+ cell.mod.body[0],+ (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef),+ )+ )++def to_decorator(config: CellConfig | None,fn: Decorators = "cell",@@ -375,19 +393,20 @@ def to_functiondef(elif body := indent_text(cell.code):definition_body.append(body)- returns = format_tuple_elements(- "return (...)",- defs,- indent=True,- allowed_naked=True,- # maybe consider "return Edges(...)"- # Such that the return type can simply be 'Edges'- )- # Add blank line before return for ruff compatibility when last statement- # is an import, function def, or class def- if _needs_trailing_blank_line(cell.mod, cell.code):- definition_body.append("")- definition_body.append(returns)+ if defs or not _can_strip_bare_return(cell):+ returns = format_tuple_elements(+ "return (...)",+ defs,+ indent=True,+ allowed_naked=True,+ # maybe consider "return Edges(...)"+ # Such that the return type can simply be 'Edges'+ )+ # Add blank line before return for ruff compatibility when last statement+ # is an import, function def, or class def+ if _needs_trailing_blank_line(cell.mod, cell.code):+ definition_body.append("")+ definition_body.append(returns)return "\n".join(definition_body)diff --git a/marimo/_cli/development/commands.py b/marimo/_cli/development/commands.pyindex f2ebbc42bd..64946e681f 100644--- a/marimo/_cli/development/commands.py+++ b/marimo/_cli/development/commands.py@@ -232,7 +232,6 @@ def print_routes() -> None:print_all_routes(route.app, new_base_path)print_all_routes(app)- return@click.command(cls=ColoredCommand, help="Preview a marimo file as static HTML")diff --git a/marimo/_cli/export/commands.py b/marimo/_cli/export/commands.pyindex 2c5a2d325a..5a85858d89 100644--- a/marimo/_cli/export/commands.py+++ b/marimo/_cli/export/commands.py@@ -172,7 +172,6 @@ def watch_and_export(output.write_bytes(result.bytez)else:echo(result.text)- returnif output:output_path = Path(output)diff --git a/marimo/_output/md.py b/marimo/_output/md.pyindex 7c2bf047f3..8c384014f7 100644--- a/marimo/_output/md.py+++ b/marimo/_output/md.py@@ -444,4 +444,3 @@ def latex(# Append the LaTeX to the output, in case this# is not the last expression of the celloutput.append(_md(f"$$\n{latex_text.strip()}\n$$"))- returndiff --git a/marimo/_runtime/context/script_context.py b/marimo/_runtime/context/script_context.pyindex be331cd024..bcad5eb3ce 100644--- a/marimo/_runtime/context/script_context.py+++ b/marimo/_runtime/context/script_context.py@@ -112,7 +112,6 @@ class ScriptRuntimeContext(RuntimeContext):def register_state_update(self, state: State[Any]) -> None:del state- return@contextmanagerdef with_cell_id(self, cell_id: CellId_t) -> Iterator[None]:diff --git a/marimo/_runtime/kernel_request_handlers.py b/marimo/_runtime/kernel_request_handlers.pyindex 758669e0b3..d614d31a45 100644--- a/marimo/_runtime/kernel_request_handlers.py+++ b/marimo/_runtime/kernel_request_handlers.py@@ -278,4 +278,3 @@ class KernelRequestHandlers:async def _handle_stop(self, request: StopKernelCommand) -> None:del request- returndiff --git a/marimo/_session/events.py b/marimo/_session/events.pyindex 80124d6010..f04fd164ee 100644--- a/marimo/_session/events.py+++ b/marimo/_session/events.py@@ -30,12 +30,10 @@ class SessionEventListener:async def on_session_created(self, session: Session) -> None:"""Called when a session is created."""del session- returnasync def on_session_closed(self, session: Session) -> None:"""Called when a session is closed."""del session- returnasync def on_session_resumed(self, session: Session, old_id: SessionId@@ -43,7 +41,6 @@ class SessionEventListener:"""Called when a session is resumed with a new ID."""del sessiondel old_id- returnasync def on_session_notebook_renamed(self, session: Session, old_path: str | None@@ -51,7 +48,6 @@ class SessionEventListener:"""Called when a session notebook is renamed."""del sessiondel old_path- returndef on_notification_sent(self, session: Session, notification: KernelMessage@@ -59,7 +55,6 @@ class SessionEventListener:"""Called before a session notification is broadcast to consumers."""del sessiondel notification- returndef on_received_command(self,@@ -71,13 +66,11 @@ class SessionEventListener:del sessiondel requestdel from_consumer_id- returndef on_received_stdin(self, session: Session, stdin: str) -> None:"""Called when stdin is received."""del sessiondel stdin- returnclass SessionEventBus:diff --git a/marimo/_tutorials/dataflow.py b/marimo/_tutorials/dataflow.pyindex 485dfc7eaa..16922e237b 100644--- a/marimo/_tutorials/dataflow.py+++ b/marimo/_tutorials/dataflow.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.23.6"+__generated_with = "0.25.2"app = marimo.App()@@ -26,7 +26,6 @@ def _(mo):To provide reactive execution, marimo creates a dataflow graph out of yourcells.""")- return@app.cell(hide_code=True)@@ -42,7 +41,6 @@ def _(mo):runtime puts you in control over when cells are run, while still givingguarantees about the notebook state.""")- return@app.cell(hide_code=True)@@ -63,7 +61,6 @@ def _(mo):The rule for reactive execution can be restated in terms of the graph: whena cell is run, its descendants are run automatically.""")- return@app.cell(hide_code=True)@@ -74,7 +71,6 @@ def _(mo):The next four cells plot a sine wave with a given period and amplitude.Each cell is labeled with its refs and defs.""")- return@app.cell(hide_code=True)@@ -91,7 +87,6 @@ def _(mo):"""})- return@app.cell@@ -102,7 +97,6 @@ def _(amplitude, mo, period, plot_wave):- `refs: {mo.refs()}`- `defs: {mo.defs()}`""")- return@app.cell@@ -162,7 +156,6 @@ def _(mo):`amplitude`, then click the run button ( ▷ ) to register your changes.See what happens to the sine wave.""")- return@app.cell(hide_code=True)@@ -190,7 +183,6 @@ def _(mo):The last cell, which doesn't define anything, produces the plot.""")- return@app.cell(hide_code=True)@@ -202,7 +194,6 @@ def _(mo):surprising if you are not used to dataflow programming. We list thesebelow.""")- return@app.cell(hide_code=True)@@ -215,7 +206,6 @@ def _(mo):traditional notebooks. It also lets you place boilerplate, likeimports or long markdown strings, at the bottom of the editor.""")- return@app.cell(hide_code=True)@@ -230,21 +220,18 @@ def _(mo):If you violate this constraint, marimo provides a helpfulerror message, like below:""")- return@app.celldef _():planet = "Mars"planet- return@app.celldef _():planet = "Earth"planet- return@app.cell(hide_code=True)@@ -253,7 +240,6 @@ def _(mo):**🌊 Try it!** In the previous cell, change the name `planet` to `home`,then run the cell.""")- return@app.cell(hide_code=True)@@ -266,19 +252,16 @@ def _(mo):**🌊 Try it!** Get rid of the following errors by merging the next twocells into a single cell.""")- return@app.celldef _():count = 0- return@app.celldef _():count += 1- return@app.cell(hide_code=True)@@ -293,28 +276,24 @@ def _(mo):**Example**.""")- return@app.celldef _():_private_variable, _ = 1, 2_private_variable, _- return@app.celldef _():_private_variable, _ = 3, 4_private_variable, _- return@app.celldef _():# `_private_variable` and `_` are not defined in this cell_private_variable, _- return@app.cell(hide_code=True)@@ -327,7 +306,6 @@ def _(mo):can arise when state has been deleted from the editor but not from theprogram memory.""")- return@app.cell@@ -347,7 +325,6 @@ def _(mo):@app.celldef _(to_be_deleted):to_be_deleted- return@app.cell(hide_code=True)@@ -357,7 +334,6 @@ def _(mo):Cycles among cells are not allowed. For example:""")- return@app.cell@@ -383,19 +359,16 @@ def _(mo):**🌊 Example**. Change the value of `state.number` in the next cell, thenrun the cell. Notice how the subsequent cell isn't updated.""")- return@app.celldef _(state):state.number = 1- return@app.celldef _(state):state.number- return@app.cell@@ -419,7 +392,6 @@ def _(mo):"""})- return@app.cell(hide_code=True)@@ -431,7 +403,6 @@ def _(mo):mutate an object without running it. So: mutations (such asappending to a list) will not trigger reactive execution.""")- return@app.cell(hide_code=True)@@ -447,7 +418,6 @@ def _(mo):)})- return@app.cell(hide_code=True)@@ -465,13 +435,11 @@ def _(mo):Follow these tips to stay on the marimo way:""")- return@app.celldef _(mo, tips):mo.accordion(tips)- return@app.cell(hide_code=True)@@ -485,7 +453,6 @@ def _(mo):marimo tutorial ui```""")- return@app.celldiff --git a/marimo/_tutorials/external_dependencies.py b/marimo/_tutorials/external_dependencies.pyindex 8ac02d8f7d..7d4c8ba947 100644--- a/marimo/_tutorials/external_dependencies.py+++ b/marimo/_tutorials/external_dependencies.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.23.6"+__generated_with = "0.25.2"app = marimo.App()@@ -23,13 +23,11 @@ def _(mo):[PEP 723](https://peps.python.org/pep-0723/) inline metadata, to declarethe Python version and packages that a notebook needs.""")- return@app.cell(hide_code=True)def _(check_dependencies):check_dependencies()- return@app.cell(hide_code=True)@@ -51,7 +49,6 @@ def _(mo):environment with the right dependencies. The rest of the file remains aregular Python script.""")- return@app.cell(hide_code=True)@@ -62,7 +59,6 @@ def _(mo):Here we'll use `wigglystuff.Slider2D`, an anywidget, and wrap it with`mo.ui.anywidget` so marimo can make it reactive.""")- return@app.cell@@ -89,7 +85,6 @@ def _(mo, widget):f"x = {widget.x:.3f}, y = {widget.y:.3f}; "f"bounds {widget.x_bounds} / {widget.y_bounds}")- return@app.cell(hide_code=True)diff --git a/marimo/_tutorials/fileformat.py b/marimo/_tutorials/fileformat.pyindex 908f69a949..fcb810fc1c 100644--- a/marimo/_tutorials/fileformat.py+++ b/marimo/_tutorials/fileformat.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.19.7"+__generated_with = "0.25.2"app = marimo.App()with app.setup:@@ -38,7 +38,6 @@ def _(mo):- 🐍 usable as Python scripts, with UI elements taking their default values- 🧩 modular, exposing functions and classes that can be imported from the notebook""")- return@app.cell(hide_code=True)@@ -70,7 +69,6 @@ def _(mo):import marimo as mo```""")- return@app.cell(hide_code=True)@@ -116,7 +114,6 @@ def _(mo):Moreover, the cell defining a single pure function `say_hello` was saved "top-level" in the notebook file, making it possible for you to import it into other Python files or notebooks.""")- return@app.cell(hide_code=True)@@ -131,7 +128,6 @@ def _(mo):We explain some properties of marimo's file format below.""")- return@app.cell(hide_code=True)@@ -241,7 +237,6 @@ def _(mo):""",})- return@app.cell(hide_code=True)@@ -253,7 +248,6 @@ def _(mo):functions and classes defined in your notebook into other Python modules. If youdon't intend to do so, you can skip this section.""")- return@app.cell(hide_code=True)@@ -284,7 +278,6 @@ def _(mo):classes. You can add the setup cell from the general menu of the editor under:::lucide:diamond-plus:: Add setup cell.""")- return@app.cell(hide_code=True)@@ -294,7 +287,6 @@ def _(mo):Notebook files expose functions and classes that depend only on variables defined in the setup cell (or on other such functions or classes). For example, the following cell:""")- return@app.function@@ -330,7 +322,6 @@ def _(mo):from my_notebook import roll_die```""")- return@app.cell(hide_code=True)@@ -338,7 +329,6 @@ def _(mo):mo.md(r"""Standalone classes are also exposed:""")- return@app.class_definition@@ -365,7 +355,6 @@ def _(mo):return [roll_die() for _ in range(self.n_rolls)]```""")- return@app.cell(hide_code=True)@@ -381,7 +370,6 @@ def _(mo):For example, this function will not be exposed:""")- return@app.cell@@ -422,7 +410,6 @@ def _(mo):See the docs on [testing](https://docs.marimo.io/guides/testing/).""")- return@app.cell(hide_code=True)@@ -432,7 +419,6 @@ def _(mo):The source code of this notebook is shown below:""")- return@app.cell@@ -445,7 +431,6 @@ def _():@app.celldef _(contents, mo):mo.ui.code_editor(contents)- returnif __name__ == "__main__":diff --git a/marimo/_tutorials/for_jupyter_users.py b/marimo/_tutorials/for_jupyter_users.pyindex 03cdaf91a7..7043185b2f 100644--- a/marimo/_tutorials/for_jupyter_users.py+++ b/marimo/_tutorials/for_jupyter_users.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.23.6"+__generated_with = "0.25.2"app = marimo.App(app_title="marimo for Jupyter users")@@ -20,7 +20,6 @@ def _(mo):This notebook explains important differences between Jupyter and marimo. If you'refamiliar with Jupyter and are trying out marimo for the first time, read on!""")- return@app.cell(hide_code=True)@@ -32,7 +31,6 @@ def _(mo):Try updating the value of x in the next cell, then run it.""")- return@app.cell@@ -44,7 +42,6 @@ def _():@app.celldef _(x):y = x + 1; y- return@app.cell(hide_code=True)@@ -59,7 +56,6 @@ def _(mo):In contrast, Jupyter requires you to manually run each cell.""")- return@app.cell(hide_code=True)@@ -77,7 +73,6 @@ def _(mo):This makes marimo notebooks as reproducible as regular Python scripts.""")- return@app.cell(hide_code=True)@@ -88,7 +83,6 @@ def _(mo):marimo comes with a [large library of UI elements](https://docs.marimo.io/guides/interactivity.html) that are automaticallysynchronized with Python.""")- return@app.cell@@ -108,7 +102,6 @@ def _(mo):@app.celldef _(slider):slider.value- return@app.cell(hide_code=True)@@ -123,7 +116,6 @@ def _(mo):In contrast, Jupyter's lack of reactivity makes IPyWidgets difficult to use.""")- return@app.cell(hide_code=True)@@ -141,7 +133,6 @@ def _(mo):seamless to do so if you want to. In this way, marimo works as a replacementfor both Jupyter and Streamlit.""")- return@app.cell(hide_code=True)@@ -151,13 +142,11 @@ def _(mo):In marimo, cells can be arranged in any order — marimo figures out the one true way to execute them based on variable declarations and references (in a ["topologically sorted"](https://en.wikipedia.org/wiki/Topological_sorting#:~:text=In%20computer%20science%2C%20a%20topological,before%20v%20in%20the%20ordering.) order)""")- return@app.celldef _(z):z.value- return@app.cell@@ -173,7 +162,6 @@ def _(mo):In contrast, Jupyter notebooks implicitly assume a top-to-bottom execution order.""")- return@app.cell(hide_code=True)@@ -183,7 +171,6 @@ def _(mo):marimo disallows variable re-assignment. Here is something commonly done in Jupyter notebooks that cannot be done in marimo:""")- return@app.cell@@ -201,7 +188,6 @@ def _():@app.celldef _(df):results = df.groupby(["my_column"]).sum()- return@app.cell(hide_code=True)@@ -215,7 +201,6 @@ def _(mo):2. prefix variables with an underscore (`_df`) to make them local to the cell3. wrap your code in functions, or give your variables more descriptive names""")- return@app.cell(hide_code=True)@@ -233,7 +218,6 @@ def _(mo):ergonomics for authoring.///""")- return@app.cell@@ -241,7 +225,6 @@ def _(mo, slider):mo.md(f"""The value of {slider} is {slider.value}.""")- return@app.cell(hide_code=True)@@ -254,7 +237,6 @@ def _(mo):_Tip: toggle a markdown view via `Cmd/Ctrl-Shift-M` in an empty cell._""")- return@app.cell(hide_code=True)@@ -274,7 +256,6 @@ def _(mo):marimo is designed so that small changes in your code yield small git diffs!""")- return@app.cell(hide_code=True)@@ -293,7 +274,6 @@ def _(mo):users](https://featured.plutojl.org/basic/pluto%20for%20jupyter%20users).We ❤️ Pluto.jl!_""")- returnif __name__ == "__main__":diff --git a/marimo/_tutorials/intro.py b/marimo/_tutorials/intro.pyindex 17056ee2a2..be88908aee 100644--- a/marimo/_tutorials/intro.py+++ b/marimo/_tutorials/intro.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.23.15"+__generated_with = "0.25.2"app = marimo.App()@@ -37,7 +37,6 @@ def _(mo, slider):{"##" + "🍃" * slider.value}""")- return@app.cell(hide_code=True)@@ -57,7 +56,6 @@ def _(mo):)})- return@app.cell(hide_code=True)@@ -68,7 +66,6 @@ def _(mo):with `marimo edit` at the command line.""").callout(kind="info", title="Creating your own notebooks")- return@app.cell(hide_code=True)@@ -87,7 +84,6 @@ def _(mo):making for a dynamic programming environment that prevents bugs before theyhappen.""")- return@app.cell(hide_code=True)@@ -114,7 +110,6 @@ def _(changed, mo):"""))- return@app.cell@@ -138,7 +133,6 @@ def _(mo):)})- return@app.cell(hide_code=True)@@ -148,7 +142,6 @@ def _(mo):constraint on how names appear in cells: no two cells may define the samevariable.""")- return@app.cell(hide_code=True)@@ -163,7 +156,6 @@ def _(mo):)})- return@app.cell(hide_code=True)@@ -178,7 +170,6 @@ def _(mo):)})- return@app.cell(hide_code=True)@@ -194,7 +185,6 @@ def _(mo):marimo provides a library of UI elements to choose from under`marimo.ui`.""")- return@app.cell@@ -202,7 +192,6 @@ def _(mo):mo.md("""**🌊 Some UI elements.** Try interacting with the below elements.""")- return@app.cell@@ -220,13 +209,11 @@ def _(icon, mo):@app.celldef _(icon, repetitions):icon, repetitions- return@app.celldef _(icon, mo, repetitions):mo.md("# " + icon.value * repetitions.value)- return@app.cell(hide_code=True)@@ -247,7 +234,6 @@ def _(mo):values, and- importable by other modules (more on that in the future).""")- return@app.cell(hide_code=True)@@ -262,7 +248,6 @@ def _(mo):Of course, you can use marimo just to level-up yournotebooking, without ever making apps.""")- return@app.cell(hide_code=True)@@ -319,7 +304,6 @@ def _(mo):In addition to tutorials, we have examples in[our GitHub repo](https://www.github.com/marimo-team/marimo/tree/main/examples).""")- return@app.cell(hide_code=True)@@ -329,13 +313,11 @@ def _(mo):Here are some tips to help you get started with the marimo editor.""")- return@app.celldef _(mo, tips):mo.accordion(tips)- return@app.cell(hide_code=True)@@ -343,7 +325,6 @@ def _(mo):mo.md("""## Finally, a fun fact""")- return@app.cell(hide_code=True)@@ -354,7 +335,6 @@ def _(mo):called a "marimo moss ball". Made of just strands of algae, thesebeloved assemblages are greater than the sum of their parts.""")- return@app.cell(hide_code=True)diff --git a/marimo/_tutorials/layout.py b/marimo/_tutorials/layout.pyindex 2dc0ec8149..1842d734ce 100644--- a/marimo/_tutorials/layout.py+++ b/marimo/_tutorials/layout.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.23.15"+__generated_with = "0.25.2"app = marimo.App()@@ -20,7 +20,6 @@ def _(mo):`marimo` provides functions to help you lay out your output, such asin rows and columns, accordions, tabs, and callouts.""")- return@app.cell(hide_code=True)@@ -30,7 +29,6 @@ def _(mo):Arrange objects into rows and columns with `mo.hstack` and `mo.vstack`.""")- return@app.cell@@ -39,13 +37,11 @@ def _(mo):[mo.ui.text(label="hello"), mo.ui.slider(1, 10, label="slider")],justify="start",)- return@app.celldef _(mo):mo.vstack([mo.ui.text(label="world"), mo.ui.number(1, 10, label="number")])- return@app.cell@@ -71,7 +67,6 @@ def _(mo):plots!).""")- return@app.cell(hide_code=True)@@ -81,7 +76,6 @@ def _(mo):The presentation of stacked elements can be customized with some argumentsthat are best understood by example.""")- return@app.cell@@ -117,7 +111,6 @@ def _(align, boxes, gap, justify, mo, wrap):gap=gap.value,wrap=wrap.value,)- return@app.cell@@ -127,7 +120,6 @@ def _(align, boxes, gap, mo):align=align.value,gap=gap.value,)- return@app.cell@@ -151,7 +143,6 @@ def _(mo):"Documentation: `mo.vstack`": mo.doc(mo.vstack),})- return@app.cell(hide_code=True)@@ -162,7 +153,6 @@ def _(mo):functions, and subclassed by most marimo classes) have a shortcut usingvia their `center`, `right`, and `left` methods.""")- return@app.cell@@ -170,19 +160,16 @@ def _(mo):mo.md("""This markdown is left-justified.""")- return@app.celldef _(mo):mo.md("This markdown is centered.").center()- return@app.celldef _(mo):mo.md("This markdown is right-justified.").right()- return@app.cell(hide_code=True)@@ -194,7 +181,6 @@ def _(mo):"Documentation: `Html.left`": mo.doc(mo.Html.left),})- return@app.cell(hide_code=True)@@ -204,7 +190,6 @@ def _(mo):Create expandable shelves of content using `mo.accordion`:""")- return@app.cell(hide_code=True)@@ -212,7 +197,6 @@ def _(mo):mo.md("""An accordion can contain multiple items:""")- return@app.cell@@ -228,7 +212,6 @@ def _(mo):),})- return@app.cell(hide_code=True)@@ -238,7 +221,6 @@ def _(mo):Use `mo.ui.tabs` to display multiple objects in a single tabbed output:""")- return@app.cell@@ -265,13 +247,11 @@ def _(mo):"🏢 Organization": _organization,})- return@app.cell(hide_code=True)def _(mo):mo.accordion({"Documentation: `mo.ui.tabs`": mo.doc(mo.ui.tabs)})- return@app.cell@@ -292,13 +272,11 @@ def _(mo):{mo.tree(_t)}""")- return@app.cell(hide_code=True)def _(mo):mo.accordion({"Documentation: `mo.tree`": mo.doc(mo.tree)})- return@app.cell(hide_code=True)@@ -309,7 +287,6 @@ def _(mo):Turn any markdown or HTML into an emphasized callout with the `callout`method:""")- return@app.cell@@ -329,13 +306,11 @@ def _(callout_kind, mo):{callout_kind}""").callout(kind=callout_kind.value, title="This is a callout!")- return@app.cell(hide_code=True)def _(mo):mo.accordion({"Documentation: `mo.callout`": mo.doc(mo.callout)})- return@app.celldiff --git a/marimo/_tutorials/markdown.py b/marimo/_tutorials/markdown.pyindex 123056eb7e..e41f090334 100644--- a/marimo/_tutorials/markdown.py+++ b/marimo/_tutorials/markdown.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.23.15"+__generated_with = "0.25.2"app = marimo.App()@@ -37,7 +37,6 @@ def _(mo):)```""")- return@app.cell@@ -57,7 +56,6 @@ def _(mo):a Python f-string; do this by checking the `f` box in the bottom-right corner of themarkdown editor, or with `mo.md(f"...")` in the Python view.""")- return@app.cell(hide_code=True)@@ -74,7 +72,6 @@ def _(mo):Supported kinds include Note, Tip, Hint, Important, Warning, and Danger.///""")- return@app.cell(hide_code=True)@@ -107,7 +104,6 @@ def _(mo):f: \mathbf{R} \to \mathbf{R}.$$""")- return@app.cell(hide_code=True)@@ -117,7 +113,6 @@ def _(mo):Use `r''` strings to remove the need to escape backslashes when writing LaTeX.///""")- return@app.cell(hide_code=True)@@ -130,7 +125,6 @@ def _(mo):https://katex.org/docs/support_table///""")- return@app.cell(hide_code=True)@@ -144,7 +138,6 @@ def _(mo):Here are some examples.""")- return@app.cell@@ -169,7 +162,6 @@ def _(mo, np, plt):{mo.as_html(_sine_plot())}""")- return@app.cell@@ -200,7 +192,6 @@ def _(leaves, mo):mo.md(f"""Your leaves: {"🍃" * leaves.value}""")- return@app.cell(hide_code=True)@@ -213,7 +204,6 @@ def _(mo):"""})- return@app.cell@@ -243,7 +233,6 @@ def _(mo, np):{mo.as_html(make_dataframe())}""")- return@app.cell(hide_code=True)@@ -257,7 +246,6 @@ def _(mo):"""})- return@app.cell(hide_code=True)@@ -269,7 +257,6 @@ def _(mo):everything we've learned: rendering markdown with LaTeX that depends onthe values of Python objects.""")- return@app.cell@@ -305,7 +292,6 @@ def _(amplitude, mo, period):- {amplitude}- {period}""")- return@app.cell@@ -320,7 +306,6 @@ def _(amplitude, mo, period, plotsin):with $x$ ranging from $0$ to $2\pi$.{mo.as_html(plotsin(amplitude.value, period.value))}""")- return@app.cell(hide_code=True)diff --git a/marimo/_tutorials/plots.py b/marimo/_tutorials/plots.pyindex 5770bba1c3..f0423d87b5 100644--- a/marimo/_tutorials/plots.py+++ b/marimo/_tutorials/plots.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.23.6"+__generated_with = "0.25.2"app = marimo.App()@@ -19,13 +19,11 @@ def _(mo):mo.md("""# Plotting""")- return@app.cell(hide_code=True)def _(check_dependencies):check_dependencies()- return@app.cell(hide_code=True)@@ -37,7 +35,6 @@ def _(mo):This tutorial gives examples using matplotlib; other libraries areused similarly.""")- return@app.cell(hide_code=True)@@ -45,7 +42,6 @@ def _(mo):mo.md("""## Matplotlib""")- return@app.cell(hide_code=True)@@ -60,13 +56,11 @@ def _(mo):plt.plot([1, 2])```""")- return@app.celldef _(plt):plt.plot([1, 2])- return@app.cell(hide_code=True)@@ -80,7 +74,6 @@ def _(mo):plt.gca()```""")- return@app.cell@@ -89,13 +82,11 @@ def _(plt):# ... do some work ...# make plt.gca() the last line of the cellplt.gca()- return@app.cell(hide_code=True)def _(mo, plt_show_explainer):mo.accordion(plt_show_explainer)- return@app.cell(hide_code=True)@@ -104,7 +95,6 @@ def _(mo):**A new figure every cell.** Every cell starts with an empty figure forthe imperative `pyplot` API.""")- return@app.cell@@ -118,13 +108,11 @@ def _(plt, x):plt.plot(x, x)plt.plot(x, x**2)plt.gca()- return@app.celldef _(plt, x):plt.plot(x, x**3)- return@app.cell(hide_code=True)@@ -133,7 +121,6 @@ def _(mo):To build a figure over multiple cells, use the object-oriented API andcreate your own axis:""")- return@app.cell@@ -149,7 +136,6 @@ def _(plt, x):def _(axis, x):axis.plot(x, x**3)axis- return@app.cell(hide_code=True)@@ -159,7 +145,6 @@ def _(mo):Draw plots interactively by parametrizing them with UI elements.""")- return@app.cell@@ -200,7 +185,6 @@ def _(exponent, mo, plot_power):{mo.as_html(plot_power(exponent.value))}""")- return@app.cell(hide_code=True)@@ -213,7 +197,6 @@ def _(mo):(shift-drag). Use `fig.value.get_mask(x, y)` to get a boolean maskof the selected points.""")- return@app.cell@@ -229,7 +212,6 @@ def _(mo, np, plt):def _(XY, scatter_fig):_mask = scatter_fig.value.get_mask(XY[:, 0], XY[:, 1])XY[_mask]- return@app.cell(hide_code=True)@@ -237,7 +219,6 @@ def _(mo):mo.md("""## Other libraries""")- return@app.cell(hide_code=True)@@ -255,7 +236,6 @@ def _(mo):If you would like another library to be integrated into marimo, pleaseget in touch.""")- return@app.cell(hide_code=True)diff --git a/marimo/_tutorials/sql.py b/marimo/_tutorials/sql.pyindex 717ea3a243..25287152c3 100644--- a/marimo/_tutorials/sql.py+++ b/marimo/_tutorials/sql.py@@ -16,7 +16,7 @@import marimo-__generated_with = "0.19.7"+__generated_with = "0.25.2"app = marimo.App(width="medium")@@ -27,7 +27,6 @@ def _(mo):_Let's dive into the world of SQL where we don't just address tables, we also join them!_""")- return@app.cell(hide_code=True)@@ -41,7 +40,6 @@ def _(mo):pip install 'marimo[sql]'```""")- return@app.cell(hide_code=True)@@ -95,7 +93,6 @@ def _(has_duckdb_installed, mo):"""))- return@app.cell(hide_code=True)@@ -128,7 +125,6 @@ def _(mo):means it can contain any valid Python code, such as the values of UIelements. This means your SQL statement and results can be reactive! 🚀""")- return@app.cell(hide_code=True)@@ -136,7 +132,6 @@ def _(mo):mo.md("""## Querying dataframes with SQL""")- return@app.cell(hide_code=True)@@ -148,7 +143,6 @@ def _(mo):and in-memory tables that your notebook has access to.///""")- return@app.cell(hide_code=True)@@ -156,7 +150,6 @@ def _(mo):mo.md(r"""Let's take a look at a SQL cell. The next cell generates a dataframe called `df`.""")- return@app.cell(hide_code=True)@@ -207,7 +200,6 @@ def _(mo):mo.md(r"""Next, we create a SQL query, referencing the Python dataframe `df` directly.""")- return@app.cell@@ -221,7 +213,6 @@ def _(df, mo):-- By default, the output variable starts with an underscore (`_df`), making it private to this cell. To access the query result in another cell, change the name of the output variable.""")- return@app.cell(hide_code=True)@@ -229,7 +220,6 @@ def _(mo):mo.md("""## From Python to SQL and back""")- return@app.cell(hide_code=True)@@ -237,7 +227,6 @@ def _(mo):mo.md(r"""You can create SQL statements that depend on Python values, such as UI elements:""")- return@app.cell(hide_code=True)@@ -270,7 +259,6 @@ def _(mo):Since we named the output variable above **`result`**,we can use it back in Python.""")- return@app.cell(hide_code=True)@@ -301,7 +289,6 @@ def _(charting_library, mo, render_chart, token_prefix):render_chart(charting_library.value, _header) if charting_library.value else None- return@app.cell(hide_code=True)@@ -355,7 +342,6 @@ def _(mo):mo.md(r"""## CSVs, Parquet, Postgres, and more ...""")- return@app.cell(hide_code=True)@@ -376,7 +362,6 @@ def _(mo):For this example, we will query an HTTP endpoint for a CSV.""")- return@app.cell@@ -391,7 +376,6 @@ def _(mo):SELECT * from cars;""")- return@app.cell(hide_code=True)@@ -435,7 +419,6 @@ def _(filtered_cars, mo):),])- return@app.cell(hide_code=True)diff --git a/marimo/_tutorials/ui.py b/marimo/_tutorials/ui.pyindex 8453bb13e8..bea19d6ab0 100644--- a/marimo/_tutorials/ui.py+++ b/marimo/_tutorials/ui.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.23.15"+__generated_with = "0.25.2"app = marimo.App()@@ -21,7 +21,6 @@ def _(mo):support for interactive user interface (UI) elements: interactingwith a UI element will automatically run cells that reference it.""")- return@app.cell(hide_code=True)@@ -29,7 +28,6 @@ def _(mo):mo.md("""## marimo.ui""")- return@app.cell@@ -52,7 +50,6 @@ def _(mo, slider):mo.md(f"""and here's its value: **{slider.value}**.""")- return@app.cell(hide_code=True)@@ -68,7 +65,6 @@ def _(mo):drive the execution of your program, letting you buildinteractive notebooks and tools for yourselves and others.""")- return@app.cell(hide_code=True)@@ -97,7 +93,6 @@ def _(mo, slider):),})- return@app.cell(hide_code=True)@@ -105,7 +100,6 @@ def _(mo):mo.md("""### Simple elements""")- return@app.cell(hide_code=True)@@ -113,7 +107,6 @@ def _(mo):mo.md("""marimo has a [large library of simple UI elements](https://docs.marimo.io/api/inputs/index.html). Here are just a few examples:""")- return@app.cell(hide_code=True)@@ -124,7 +117,6 @@ def _(mo):a more detailed reference, see our [API docs](https://docs.marimo.io/api/inputs/).""").callout(kind="info", title="Examples and API reference")- return@app.cell@@ -137,7 +129,6 @@ def _(mo):@app.celldef _(number):number.value- return@app.cell@@ -150,7 +141,6 @@ def _(mo):@app.celldef _(checkbox):checkbox.value- return@app.cell@@ -163,7 +153,6 @@ def _(mo):@app.celldef _(text):text.value- return@app.cell@@ -176,7 +165,6 @@ def _(mo):@app.celldef _(text_area):text_area.value- return@app.cell@@ -189,7 +177,6 @@ def _(mo):@app.celldef _(dropdown):dropdown.value- return@app.cell@@ -202,7 +189,6 @@ def _(mo):@app.celldef _(run_button):"Run button was clicked!" if run_button.value else "Click the run button!"- return@app.cell@@ -215,7 +201,6 @@ def _(mo):@app.celldef _(file_upload):file_upload.value- return@app.cell@@ -223,7 +208,6 @@ def _(basic_ui_elements, mo):mo.md(f"""To see more examples, use this dropdown: {basic_ui_elements}""")- return@app.cell@@ -236,13 +220,11 @@ def _(basic_ui_elements, construct_element, show_element):@app.celldef _(selected_element, value):value(selected_element)- return@app.celldef _(basic_ui_elements, documentation):documentation(basic_ui_elements.value)- return@app.cell(hide_code=True)@@ -250,7 +232,6 @@ def _(mo):mo.md(r"""`mo.ui.matrix` lets you edit 2D numeric data interactively.""")- return@app.cell@@ -270,7 +251,6 @@ def _(mo):@app.celldef _(matrix):matrix.value- return@app.cell(hide_code=True)@@ -285,7 +265,6 @@ def _(mo):create a dynamic set of UI elements, or reduce the number of globalvariables in your program.""")- return@app.cell(hide_code=True)@@ -295,7 +274,6 @@ def _(mo):When you interact with an element in the array, all cells that reference thearray are reactively run. If you instead used a regular Python list, cells referring to the list would _not_ be run.""")- return@app.cell@@ -310,7 +288,6 @@ def _(mo):@app.celldef _(array):array.value- return@app.cell(hide_code=True)@@ -318,7 +295,6 @@ def _(mo):mo.md(r"""marimo also comes with `mo.ui.dictionary`, which is analogous to `mo.ui.array`""")- return@app.cell@@ -337,7 +313,6 @@ def _(mo):@app.celldef _(dictionary):dictionary.value- return@app.cell(hide_code=True)@@ -345,7 +320,6 @@ def _(composite_elements, mo):mo.md(f"""To see additional composite elements, use this dropdown: {composite_elements}""")- return@app.cell@@ -358,13 +332,11 @@ def _(composite_elements, construct_element, show_element):@app.celldef _(composite_element, value):value(composite_element)- return@app.celldef _(composite_elements, documentation):documentation(composite_elements.value)- return@app.cell(hide_code=True)@@ -377,7 +349,6 @@ def _(mo):community. To learn more, [see ourdocs](https://docs.marimo.io/guides/integrating_with_marimo/custom_ui_plugins.html).""")- return@app.cell(hide_code=True)@@ -388,7 +359,6 @@ def _(mo):You can look at their code if you're curious how certain parts of thistutorial were implemented.""")- return@app.celldiff --git a/pyproject.toml b/pyproject.tomlindex dd0a0e2143..6295973eb1 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -378,7 +378,6 @@ ignore = ["PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception"E501", # Line too long, we still trim"D415", # First line should end with a period, question mark, or exclamation point- "PLR1711", # Useless returns. We use this currently to delimit the end of a cell."ASYNC119", # Yield in context manager in async generator; required for streaming generators (LLM/SSE), no clean refactor# Enabled by the Python 3.11 target. Both need deliberate migrations."ASYNC109", # Async function with a `timeout` parameter; callers should use `asyncio.timeout`@@ -465,6 +464,7 @@ extend-select = ["D211", # No blank lines allowed before class docstring"D214", # Section is over-indented"D215", # Section underline is over-indented+ "PLR1711", # Useless return statements"PLW1514", # Unspecified encoding in open()"UP", # Upgrades]diff --git a/tests/_ast/codegen_data/test_app_with_annotation_typing.py b/tests/_ast/codegen_data/test_app_with_annotation_typing.pyindex b909f7c152..8dc5336f22 100644--- a/tests/_ast/codegen_data/test_app_with_annotation_typing.py+++ b/tests/_ast/codegen_data/test_app_with_annotation_typing.py@@ -23,7 +23,6 @@ def _():@app.celldef _(x: int, y: float, z: "int"):_ = x + y + z- returnif __name__ == "__main__":diff --git a/tests/_ast/codegen_data/test_generate_filecontents.py b/tests/_ast/codegen_data/test_generate_filecontents.pyindex 2b1f6d7fd4..2808c72e98 100644--- a/tests/_ast/codegen_data/test_generate_filecontents.py+++ b/tests/_ast/codegen_data/test_generate_filecontents.py@@ -28,7 +28,6 @@ def three(x):def four(np, x, y):# commentz = np.array(x + y)- return@app.celldiff --git a/tests/_ast/codegen_data/test_generate_filecontents_async_long_signature.py b/tests/_ast/codegen_data/test_generate_filecontents_async_long_signature.pyindex 55970d0843..63c42c6c89 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_async_long_signature.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_async_long_signature.py@@ -40,7 +40,6 @@ async def two(async for data_point in client("test", "ws://localhost:8000"):print(data_point)data_point- returnif __name__ == "__main__":diff --git a/tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.py b/tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.pyindex f0afa25b6a..4ddba63f3d 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_shadowed_builtin.py@@ -13,7 +13,6 @@ def one():@app.celldef two(type):type- returnif __name__ == "__main__":diff --git a/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py b/tests/_ast/codegen_data/test_generate_filecontents_single_cell.pyindex fbc0ccb959..f09c424a0d 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py@@ -8,8 +8,6 @@ app = marimo.App()def one():import numpy as np- return-if __name__ == "__main__":app.run()diff --git a/tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.py b/tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.pyindex 72986d475c..e1a66b6726 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_unshadowed_builtin.py@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef one():type- returnif __name__ == "__main__":diff --git a/tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.py b/tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.pyindex 575e5d4340..6e99a9f508 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_with_syntax_error.py@@ -8,8 +8,6 @@ app = marimo.App()def one():import numpy as np- return-app._unparsable_cell(r"""@@ -22,7 +20,6 @@ app._unparsable_cell(@app.celldef _():'all good'- returnapp._unparsable_cell(diff --git a/tests/_ast/codegen_data/test_long_line_in_main.py b/tests/_ast/codegen_data/test_long_line_in_main.pyindex 3fb2e103c0..6d3c99c164 100644--- a/tests/_ast/codegen_data/test_long_line_in_main.py+++ b/tests/_ast/codegen_data/test_long_line_in_main.py@@ -23,7 +23,6 @@ def two(yet_another_very_long_name,):z = i_am_a_very_long_name + i_am_another_very_long_name + yet_another_very_long_name- returnif __name__ == "__main__":diff --git a/tests/_ast/codegen_data/test_unparsable_cell_with_triple_quotes.py b/tests/_ast/codegen_data/test_unparsable_cell_with_triple_quotes.pyindex 92668fcfa0..82378e014b 100644--- a/tests/_ast/codegen_data/test_unparsable_cell_with_triple_quotes.py+++ b/tests/_ast/codegen_data/test_unparsable_cell_with_triple_quotes.py@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef _():x = 1- returnapp._unparsable_cell(diff --git a/tests/_ast/test_cell.py b/tests/_ast/test_cell.pyindex 65c8b0518d..4444a10344 100644--- a/tests/_ast/test_cell.py+++ b/tests/_ast/test_cell.py@@ -413,7 +413,6 @@ class TestCellRun:@app.celldef basic(lots, of_, incorrect, args): # noqa: ARG0011 # noqa: B018- returnassert basic.run() == (1, {})assert len(caplog.records) == 0@@ -433,7 +432,6 @@ class TestCellRun:else:b = ab # noqa: B018- returnassert cyclic.run() == (1, {"a": 1, "b": 1})assert cyclic() == 1@@ -455,7 +453,6 @@ class TestReusableCell:# non transitivex = y - zx # noqa: B018- returnoutput, defs = uses_setup.run()assert output == 0@@ -484,7 +481,6 @@ class TestReusableCell:def uses_setup(y):z = y - xz # noqa: B018- returnoutput, defs = uses_setup.run()assert output == 0@@ -520,7 +516,6 @@ class TestReusableCell:def uses_setup(y):z = 0 * something_normally_scoped_for_a() + y - xz # noqa: B018- returnoutput, defs = uses_setup.run()assert output == 0@@ -621,7 +616,6 @@ def help_smoke() -> None:@app.cellasync def f(x) -> None:await x- return@app.celldef g() -> None:diff --git a/tests/_ast/test_codegen.py b/tests/_ast/test_codegen.pyindex e44e939aa1..91d56075fa 100644--- a/tests/_ast/test_codegen.py+++ b/tests/_ast/test_codegen.py@@ -876,9 +876,7 @@ class TestToFunctionDef:code = "y + 1"cell = compile_cell(code)fndef = codegen.to_functiondef(cell, "foo")- expected = "\n".join(- ["@app.cell", "def foo(y):", " y + 1", " return"]- )+ expected = "\n".join(["@app.cell", "def foo(y):", " y + 1"])assert fndef == expecteddef test_tofunctiondef_empty_cells(self) -> None:@@ -906,11 +904,54 @@ class TestToFunctionDef:code = "print(y)"cell = compile_cell(code)fndef = codegen.to_functiondef(cell, "foo")- expected = "\n".join(- ["@app.cell", "def foo(y):", " print(y)", " return"]- )+ expected = "\n".join(["@app.cell", "def foo(y):", " print(y)"])assert fndef == expected+ def test_bare_return_stripped_unused_def(self) -> None:+ # cell defines x, but x is not referenced by any other cell+ # (used_refs=set()) -> defs=() -> bare return stripped+ code = "x = 1"+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo", used_refs=set())+ assert "return" not in fndef+ expected = "\n".join(["@app.cell", "def foo():", " x = 1"])+ assert fndef == expected++ def test_bare_return_kept_single_trailing_newline(self) -> None:+ # cell.code ends with \n → blank line before return → keep return+ code = "x = 1\n"+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo", used_refs=set())+ assert fndef.endswith(" return")++ def test_bare_return_kept_multiple_trailing_newlines(self) -> None:+ # cell.code ends with \n\n → multiple blank lines before return → keep return+ code = "x = 1\n\n"+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo", used_refs=set())+ assert fndef.endswith(" return")++ def test_bare_return_kept_only_comments(self) -> None:+ # only comments, no AST statements → keep return (function must have a body)+ code = "# just a comment"+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo")+ assert fndef.endswith(" return")++ def test_bare_return_kept_empty_cell(self) -> None:+ # empty cell → keep return (function must have a body)+ code = ""+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo")+ assert fndef.endswith(" return")++ def test_bare_return_kept_single_funcdef(self) -> None:+ # single function def → keep return to prevent toplevel reclassification+ code = "def helper():\n pass"+ cell = compile_cell(code)+ fndef = codegen.to_functiondef(cell, "foo", used_refs=set())+ assert " return" in fndef+def test_tofunctiondef_refs_and_defs(self) -> None:code = "\n".join(["y = x", "z = x", "z = w + y"])cell = compile_cell(code)@@ -1032,7 +1073,6 @@ class TestToFunctionDef:"@app.cell","def cell2(cars_df, empty):"," result = cars_df.filter(lambda x: x > 0); empty",- " return",])in expected@@ -1654,17 +1694,17 @@ def test_needs_trailing_blank_line(code: str, expected: bool) -> None:@pytest.mark.parametrize(("code", "expected_pattern", "unexpected_pattern"),[- # Import only - blank line before return+ # Import only - return stripped (no blank line added)("import datetime",+ " import datetime"," import datetime\n\n return",- None,),- # Import then assignment - no blank line+ # Import then assignment - return stripped (last stmt is assignment)("import datetime\nx = 1",+ " import datetime\n x = 1"," import datetime\n x = 1\n return",- None,),# Function def - blank line before return(@@ -1678,11 +1718,11 @@ def test_needs_trailing_blank_line(code: str, expected: bool) -> None:" # comment\n return"," # comment\n\n return",),- # Multiline import - blank line before return+ # Multiline import - return stripped (no blank line added)("from module import (\n a,\n b,\n)",+ " from module import (\n a,\n b,\n )"," )\n\n return",- None,),],ids=[@@ -2220,8 +2260,7 @@ def _(x):@app.celldef _(foo):- foo()- return\+ foo()\""")diff --git a/tests/_ast/test_pytest_scoped.py b/tests/_ast/test_pytest_scoped.pyindex 929e2f321c..b69d49f89c 100644--- a/tests/_ast/test_pytest_scoped.py+++ b/tests/_ast/test_pytest_scoped.py@@ -50,8 +50,6 @@ def collection_of_tests():def test_uses_fixture(self, example):assert example == "value"- return-@app.celldef _():diff --git a/tests/_ast/test_toplevel.py b/tests/_ast/test_toplevel.pyindex 4c3ee259ba..c7ea622ba4 100644--- a/tests/_ast/test_toplevel.py+++ b/tests/_ast/test_toplevel.py@@ -632,7 +632,6 @@ class TestTopLevelHook:@staticmethoddef method() -> None:print(__class__)- returnstatus = TopLevelStatus.from_cell(cell._cell, BUILTINS)assert status.type == TopLevelType.TOPLEVELdiff --git a/tests/_cli/snapshots/ipynb_to_marimo.txt b/tests/_cli/snapshots/ipynb_to_marimo.txtindex 61e6d27e3b..ce23d540f1 100644--- a/tests/_cli/snapshots/ipynb_to_marimo.txt+++ b/tests/_cli/snapshots/ipynb_to_marimo.txt@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef _():print('Hello, World!')- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/ipynb_to_marimo_with_output.txt b/tests/_cli/snapshots/ipynb_to_marimo_with_output.txtindex ed0a2f6e64..ce3be33aa7 100644--- a/tests/_cli/snapshots/ipynb_to_marimo_with_output.txt+++ b/tests/_cli/snapshots/ipynb_to_marimo_with_output.txt@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef _():print('Hello, Output!')- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/markdown_to_marimo.txt b/tests/_cli/snapshots/markdown_to_marimo.txtindex d5bb28aeb6..d1026fbd94 100644--- a/tests/_cli/snapshots/markdown_to_marimo.txt+++ b/tests/_cli/snapshots/markdown_to_marimo.txt@@ -11,7 +11,6 @@ def _(mo):print('Hello from Markdown!')""")- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/python_script_no_main_to_marimo.txt b/tests/_cli/snapshots/python_script_no_main_to_marimo.txtindex 10873c31b2..efb9a7c30b 100644--- a/tests/_cli/snapshots/python_script_no_main_to_marimo.txt+++ b/tests/_cli/snapshots/python_script_no_main_to_marimo.txt@@ -12,7 +12,6 @@ def _():y = 10result = x + yprint(f"Result: {result}")- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/python_script_to_marimo.txt b/tests/_cli/snapshots/python_script_to_marimo.txtindex 716c594786..60fbc715ce 100644--- a/tests/_cli/snapshots/python_script_to_marimo.txt+++ b/tests/_cli/snapshots/python_script_to_marimo.txt@@ -18,7 +18,6 @@ def _():sys.exit(0)_main_()- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/remote_ipynb_to_marimo.txt b/tests/_cli/snapshots/remote_ipynb_to_marimo.txtindex 9896e3055e..51cbf7ef04 100644--- a/tests/_cli/snapshots/remote_ipynb_to_marimo.txt+++ b/tests/_cli/snapshots/remote_ipynb_to_marimo.txt@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef _():print('Hello from Remote Notebook!')- returnif __name__ == "__main__":diff --git a/tests/_cli/snapshots/remote_markdown_to_marimo.txt b/tests/_cli/snapshots/remote_markdown_to_marimo.txtindex bc669afe15..f3451a0b14 100644--- a/tests/_cli/snapshots/remote_markdown_to_marimo.txt+++ b/tests/_cli/snapshots/remote_markdown_to_marimo.txt@@ -13,7 +13,6 @@ def _(mo):print('Hello from Remote Markdown!')```""")- returnif __name__ == "__main__":diff --git a/tests/_convert/common/test_convert_format.py b/tests/_convert/common/test_convert_format.pyindex c3ff1f0a32..fc0763ee15 100644--- a/tests/_convert/common/test_convert_format.py+++ b/tests/_convert/common/test_convert_format.py@@ -62,13 +62,11 @@ app = marimo.App()@app.celldef _():print('Hello')- return@app.celldef _():x = 5- returnif __name__ == "__main__":@@ -97,13 +95,11 @@ app = marimo.App()@app.cell(hide_code=True)def _():print('Hello')- return@app.celldef _():x = 5- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/cell_config.py b/tests/_convert/ipynb/fixtures/py/cell_config.pyindex e469661a61..9cdc17a6c5 100644--- a/tests/_convert/ipynb/fixtures/py/cell_config.py+++ b/tests/_convert/ipynb/fixtures/py/cell_config.py@@ -22,7 +22,6 @@ def _(mo):mo.md("""# This cell is hidden""")- return@app.cell(disabled=True)@@ -34,13 +33,11 @@ def _(x):@app.celldef _(y):print(y)- return@app.cell(expand_output=True)def _(y):z = y + 1- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/cell_names_and_defs.py b/tests/_convert/ipynb/fixtures/py/cell_names_and_defs.pyindex fa47f3f657..ae2714d58d 100644--- a/tests/_convert/ipynb/fixtures/py/cell_names_and_defs.py+++ b/tests/_convert/ipynb/fixtures/py/cell_names_and_defs.py@@ -21,7 +21,6 @@ def compute(os, sys):@app.celldef display(result):print(result)- return@app.functiondiff --git a/tests/_convert/ipynb/fixtures/py/complex_file_format.py b/tests/_convert/ipynb/fixtures/py/complex_file_format.pyindex bee476da49..b3bc059548 100644--- a/tests/_convert/ipynb/fixtures/py/complex_file_format.py+++ b/tests/_convert/ipynb/fixtures/py/complex_file_format.py@@ -28,7 +28,6 @@ def _():- Feature 1- Feature 2""")- return@app.cell@@ -45,7 +44,6 @@ def disabled_cell():"""This cell is disabled."""x = 42should_not_run = True- return@app.cell@@ -60,14 +58,12 @@ def analysis(df):"""Named cell with analysis and markdown output."""result = df["a"].sum()mo.md(f"The sum is **{result}**")- return@app.celldef _():"""Unnamed cell."""internal_var = 100- return@app.functiondiff --git a/tests/_convert/ipynb/fixtures/py/complex_outputs.py b/tests/_convert/ipynb/fixtures/py/complex_outputs.pyindex 081060b5f8..6e977ac684 100644--- a/tests/_convert/ipynb/fixtures/py/complex_outputs.py+++ b/tests/_convert/ipynb/fixtures/py/complex_outputs.py@@ -18,7 +18,6 @@ def _(mo):This notebook tests various output scenarios.""")- return@app.cell@@ -26,7 +25,6 @@ def _():"""Cell with print statements."""print("Standard output")print("Multiple lines")- return@app.cell@@ -42,7 +40,6 @@ def _(data):"""Cell with calculations and implicit output."""result = sum(data["x"]) + sum(data["y"])result- return@app.cell@@ -52,7 +49,6 @@ def _(mo):print("Debug info")value = 42value- return@app.cell@@ -64,7 +60,6 @@ def error_cell():if hasattr(sys, "never_exists"):raise ValueError("This should not happen")success = True- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/markdown_variants.py b/tests/_convert/ipynb/fixtures/py/markdown_variants.pyindex 75cb11dd41..aaf690494b 100644--- a/tests/_convert/ipynb/fixtures/py/markdown_variants.py+++ b/tests/_convert/ipynb/fixtures/py/markdown_variants.py@@ -24,7 +24,6 @@ def _(mo):Plain triple-quoted markdown.""")- return@app.cell@@ -34,7 +33,6 @@ def _(mo):Raw triple-quoted markdown.""")- return@app.cell@@ -44,7 +42,6 @@ def _(mo):F-string with no interpolation.""")- return@app.cell@@ -54,13 +51,11 @@ def _(mo):FR-string with no interpolation.""")- return@app.celldef _(mo, x):mo.md(f"The value is **{x}**")- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/notebook_metadata.py b/tests/_convert/ipynb/fixtures/py/notebook_metadata.pyindex 7e9efab8d0..b84714ddb0 100644--- a/tests/_convert/ipynb/fixtures/py/notebook_metadata.py+++ b/tests/_convert/ipynb/fixtures/py/notebook_metadata.py@@ -21,7 +21,6 @@ def _():@app.celldef _(x):print(x)- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/setup_cell.py b/tests/_convert/ipynb/fixtures/py/setup_cell.pyindex d24f0c394a..1364dbf79b 100644--- a/tests/_convert/ipynb/fixtures/py/setup_cell.py+++ b/tests/_convert/ipynb/fixtures/py/setup_cell.py@@ -12,13 +12,11 @@ def _():mo.md("""# Hello from setup""")- return@app.celldef _():x = 42- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/fixtures/py/simple.py b/tests/_convert/ipynb/fixtures/py/simple.pyindex 2bd8316c33..0a6467380b 100644--- a/tests/_convert/ipynb/fixtures/py/simple.py+++ b/tests/_convert/ipynb/fixtures/py/simple.py@@ -16,7 +16,6 @@ def _(mo):mo.md("""# Hello, World!""")- return@app.cell@@ -30,7 +29,6 @@ def _():@app.celldef _(z):print(z)- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_cell_metadata.py.txt b/tests/_convert/ipynb/snapshots/converted_cell_metadata.py.txtindex 292aea871b..1c186a5391 100644--- a/tests/_convert/ipynb/snapshots/converted_cell_metadata.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_cell_metadata.py.txt@@ -7,53 +7,45 @@ app = marimo.App()def _():# Cell tags: tag1, tag2print("Hello")- return@app.celldef _():print("World")- return@app.celldef _():# Cell tags: data-processing, importantprint("Cell 1")- return@app.celldef _():print("Cell 2")- return@app.celldef _():# Cell tags: visualizationprint("Cell 3")- return@app.celldef _():# Cell tags: tag1, tag2print("Complex metadata")- return@app.cell(hide_code=True)def _():print("hidden cell")- return@app.cell(hide_code=True)def _():# Cell tags: remove-printprint("hidden cell, with other tags")- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt b/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txtindex 4b27cf5467..4ed9b8e76f 100644--- a/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt@@ -24,7 +24,6 @@ def _():# This variable will be redefined latery = 10 # First definitionprint(y) # Should preserve this comment- return@app.cell@@ -45,7 +44,6 @@ def _():# Comment before magicimport osos.listdir()- return@app.cell@@ -55,7 +53,6 @@ def _(mo):SELECT * FROM table -- Another SQL commentWHERE id > 0 # Python-style comment in SQL""")- return@app.cell@@ -72,7 +69,6 @@ def _(np):# Cell 7: Duplicate import with different comment# This should be deduplicated but preserve one of the commentsarr = np.array([1, 2, 3]) # Create array- return@app.cell@@ -81,7 +77,6 @@ def _(x, y_1):# Calculate something complex# Final comment in cellz = x * 2 + y_1 # Multiply x by 2 # Add y to the result- return@app.cell@@ -90,7 +85,6 @@ def _():counter = 0 # Initialize counter# This should preserve comments during aug assign transformationcounter = counter + 1 # Increment counter (this will be transformed)- return@app.celldiff --git a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_and_aug_assign.py.txt b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_and_aug_assign.py.txtindex 01f4649150..b7596ecc6d 100644--- a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_and_aug_assign.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_and_aug_assign.py.txt@@ -12,7 +12,6 @@ def _():@app.celldef _(x):x- return@app.cell@@ -24,7 +23,6 @@ def _(x):@app.celldef _(x_1):x_1- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_read_before_write.py.txt b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_read_before_write.py.txtindex 4d7804c201..85b61178cf 100644--- a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_read_before_write.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_read_before_write.py.txt@@ -12,7 +12,6 @@ def _():@app.celldef _(x):x- return@app.cell@@ -26,7 +25,6 @@ def _(x):@app.celldef _(x_1):x_1- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_syntax_error.py.txt b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_syntax_error.py.txtindex af6594e572..89afb354f2 100644--- a/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_syntax_error.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_duplicate_definitions_syntax_error.py.txt@@ -14,7 +14,6 @@ app._unparsable_cell(@app.celldef _(x):x- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt b/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txtindex 277646b09f..ba301397c5 100644--- a/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt@@ -15,7 +15,6 @@ def _(mo):mo.md(r"""A markdown cell.""")- return@app.cell(hide_code=True)@@ -24,7 +23,6 @@ def _(mo):mo.md(r"""A markdown cell with tags: ['blah'].""")- return@app.cell(hide_code=True)@@ -33,7 +31,6 @@ def _(mo):mo.md(r"""A markdown cell with tags: ['blah', 'hide-cell'].""")- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_multiple_definitions.py.txt b/tests/_convert/ipynb/snapshots/converted_multiple_definitions.py.txtindex 54aca2a857..0c99875ed4 100644--- a/tests/_convert/ipynb/snapshots/converted_multiple_definitions.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_multiple_definitions.py.txt@@ -7,14 +7,12 @@ app = marimo.App()def _():_x = 1print(_x) # print- return@app.celldef _():_x = 2print(_x) # print- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_multiple_definitions_multiline.py.txt b/tests/_convert/ipynb/snapshots/converted_multiple_definitions_multiline.py.txtindex e0218ec623..861248e128 100644--- a/tests/_convert/ipynb/snapshots/converted_multiple_definitions_multiline.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_multiple_definitions_multiline.py.txt@@ -17,7 +17,6 @@ def _(X_1, nearest_partition, plt):for i_1 in range(X_1.shape[0]):for j in nearest_partition[i_1, :_K + 1]:plt.plot(*zip(X_1[j], X_1[i_1]), color='black')- returnif __name__ == "__main__":diff --git a/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt b/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txtindex 9fc2e05d5f..94e7e9cf37 100644--- a/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt@@ -33,7 +33,6 @@ def _():import numpy as np# packages added via marimo's package management: seaborn !pip install seaborn- return@app.cell@@ -43,7 +42,6 @@ def _(subprocess):subprocess.call(['ls', '-la'])#! echo 'Hello World'subprocess.call(['echo', 'Hello World'])- return@app.celldiff --git a/tests/_convert/ipynb/test_from_ir.py b/tests/_convert/ipynb/test_from_ir.pyindex e2ba28dc48..24c3d96b53 100644--- a/tests/_convert/ipynb/test_from_ir.py+++ b/tests/_convert/ipynb/test_from_ir.py@@ -92,7 +92,6 @@ def test_export_ipynb_marks_hidden_code_cells_for_nbconvert() -> None:@app.cell()def _(x):print(x)- returnipynb_json = json.loads(convert_from_ir_to_ipynb(InternalApp(app), sort_mode="top-down")diff --git a/tests/_convert/markdown/snapshots/frontmatter-test.py.txt b/tests/_convert/markdown/snapshots/frontmatter-test.py.txtindex 3eb81eb427..c8314b6ec8 100644--- a/tests/_convert/markdown/snapshots/frontmatter-test.py.txt+++ b/tests/_convert/markdown/snapshots/frontmatter-test.py.txt@@ -12,13 +12,11 @@ def _(mo):mo.md(r"""# Notebook""")- return@app.celldef _():print("Hello, World!")- returnif __name__ == "__main__":diff --git a/tests/_convert/markdown/snapshots/no-frontmatter.py.txt b/tests/_convert/markdown/snapshots/no-frontmatter.py.txtindex 2ca5378e5e..2b1c08b81e 100644--- a/tests/_convert/markdown/snapshots/no-frontmatter.py.txt+++ b/tests/_convert/markdown/snapshots/no-frontmatter.py.txt@@ -9,13 +9,11 @@ def _(mo):mo.md(r"""# My Notebook""")- return@app.celldef _():print("Hello, World!")- return@app.cell(hide_code=True)@@ -24,7 +22,6 @@ def _(mo):**Appendix**- This is the end of the notebook""")- returnif __name__ == "__main__":diff --git a/tests/_convert/markdown/snapshots/sql-notebook.py.txt b/tests/_convert/markdown/snapshots/sql-notebook.py.txtindex de589726a5..936da875b6 100644--- a/tests/_convert/markdown/snapshots/sql-notebook.py.txt+++ b/tests/_convert/markdown/snapshots/sql-notebook.py.txt@@ -9,7 +9,6 @@ def _(mo):mo.md(r"""# SQL notebook""")- return@app.cell@@ -33,7 +32,6 @@ def _(mem_engine, mo, my_table):@app.celldef _(export, mo):_df = mo.sql("SELECT * FROM export;")- returnif __name__ == "__main__":diff --git a/tests/_convert/markdown/snapshots/unsafe-app.py.txt b/tests/_convert/markdown/snapshots/unsafe-app.py.txtindex d0e42e9d12..5f85844c0d 100644--- a/tests/_convert/markdown/snapshots/unsafe-app.py.txt+++ b/tests/_convert/markdown/snapshots/unsafe-app.py.txt@@ -24,7 +24,6 @@ def _(mo):print("Hello World")```""")- return@app.cell@@ -35,7 +34,6 @@ def _(mo):print("Hello World")```""")- return@app.cell@@ -46,7 +44,6 @@ def _(mo):print("1 + 1 = {1 + 1}")```""")- return@app.cell(hide_code=True)@@ -58,7 +55,6 @@ def _(mo):```python {.marimo}````""")- return@app.cell@@ -66,7 +62,6 @@ def _():"""```"""- return@app.cell@@ -75,20 +70,17 @@ def _(mo):Cross cell injection```python""")- return@app.celldef _():1 + 1- return@app.celldef _():# Actual printprint("Hello World")- returnif __name__ == "__main__":diff --git a/tests/_convert/markdown/snapshots/unsafe-doc.py.txt b/tests/_convert/markdown/snapshots/unsafe-doc.py.txtindex e727c024ed..04e59da1ee 100644--- a/tests/_convert/markdown/snapshots/unsafe-doc.py.txt+++ b/tests/_convert/markdown/snapshots/unsafe-doc.py.txt@@ -14,13 +14,11 @@ def _(mo):<!--\""")- return@app.celldef _():print("Hello, World!")- return@app.cell(hide_code=True)@@ -30,7 +28,6 @@ def _(mo):```marimo run convert document.md```""")- returnapp._unparsable_cell(@@ -50,13 +47,11 @@ def _(mo):<!-- Disabled code block -->""")- return@app.cell(disabled=True)def _():1 + 1- return@app.cell(hide_code=True)@@ -64,13 +59,11 @@ def _(mo):mo.md(r"""<!-- Hidden code block -->""")- return@app.cell(hide_code=True)def _():1 + 1- return@app.cell(hide_code=True)@@ -78,7 +71,6 @@ def _(mo):mo.md(r"""<!-- Empty code block -->""")- return@app.cell@@ -91,7 +83,6 @@ def _(mo):mo.md(r"""<!-- Improperly nested code block -->""")- returnapp._unparsable_cell(@@ -121,7 +112,6 @@ def _(mo):<!-- from the notebook, should remain unchanged -->""")- return@app.cell@@ -132,7 +122,6 @@ def _(mo):# To ambiguous to convert```""")- returnif __name__ == "__main__":diff --git a/tests/_convert/markdown/test_markdown_from_ir.py b/tests/_convert/markdown/test_markdown_from_ir.pyindex 51a116bd1e..68cb60cffc 100644--- a/tests/_convert/markdown/test_markdown_from_ir.py+++ b/tests/_convert/markdown/test_markdown_from_ir.py@@ -120,7 +120,6 @@ def test_convert_from_ir_to_markdown_with_markdown_cell():@app.cell()def __(mo):mo.md("# Hello World")- returninternal_app = InternalApp(app)notebook = internal_app.to_ir()@@ -222,12 +221,10 @@ def test_convert_from_ir_to_markdown_consecutive_markdown_cells():@app.cell()def __(mo):mo.md("# First markdown")- return@app.cell()def __(mo):mo.md("# Second markdown")- returninternal_app = InternalApp(app)notebook = internal_app.to_ir()@@ -253,7 +250,6 @@ def test_convert_from_ir_to_markdown_with_column():@app.cell(column=1)def __(mo):mo.md("# Markdown in column")- returninternal_app = InternalApp(app)notebook = internal_app.to_ir()diff --git a/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt b/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txtindex 18a76645eb..9db02faaaf 100644--- a/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt+++ b/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt@@ -9,7 +9,6 @@ def _(mo):mo.md(r"""This is a simple marimo notebook""")- return@app.cell@@ -22,7 +21,6 @@ def _():def _(x):y = x+1y- return@app.celldiff --git a/tests/_convert/snapshots/minimal_script.py.txt b/tests/_convert/snapshots/minimal_script.py.txtindex 4f37b12132..1b1470c129 100644--- a/tests/_convert/snapshots/minimal_script.py.txt+++ b/tests/_convert/snapshots/minimal_script.py.txt@@ -9,7 +9,6 @@ def _():x = 5y = 10print(x + y)- returnif __name__ == "__main__":diff --git a/tests/_convert/snapshots/pypercent_format.py.txt b/tests/_convert/snapshots/pypercent_format.py.txtindex 09ba7831b1..66e090e0c5 100644--- a/tests/_convert/snapshots/pypercent_format.py.txt+++ b/tests/_convert/snapshots/pypercent_format.py.txt@@ -26,7 +26,6 @@ def _(mo):This is a markdown cellwith multiple lines""")- return@app.cell(hide_code=True)@@ -34,7 +33,6 @@ def _(mo):mo.md(r"""This is a doc string, but also markdown""")- return@app.cell@@ -50,7 +48,6 @@ def _(x):# Cell with titley = x * 2print(y)- returnif __name__ == "__main__":diff --git a/tests/_convert/snapshots/pypercent_markdown_only.py.txt b/tests/_convert/snapshots/pypercent_markdown_only.py.txtindex ebe97f5c3a..a14951ee0e 100644--- a/tests/_convert/snapshots/pypercent_markdown_only.py.txt+++ b/tests/_convert/snapshots/pypercent_markdown_only.py.txt@@ -14,7 +14,6 @@ def _():@app.celldef _():"""Documentation in pypercent format."""- return@app.cell(hide_code=True)@@ -23,7 +22,6 @@ def _(mo):IntroductionThis is a documentation file.""")- return@app.cell(hide_code=True)@@ -32,7 +30,6 @@ def _(mo):UsageHere's how to use this module.""")- returnif __name__ == "__main__":diff --git a/tests/_convert/snapshots/pypercent_with_main.py.txt b/tests/_convert/snapshots/pypercent_with_main.py.txtindex 9ab1eb95ab..5b82633328 100644--- a/tests/_convert/snapshots/pypercent_with_main.py.txt+++ b/tests/_convert/snapshots/pypercent_with_main.py.txt@@ -7,7 +7,6 @@ app = marimo.App()@app.celldef _():"""Script with main block in pypercent."""- return@app.cell@@ -24,7 +23,6 @@ def _(sys):sys.exit(0)_main_()- returnif __name__ == "__main__":diff --git a/tests/_convert/snapshots/simple_script.py.txt b/tests/_convert/snapshots/simple_script.py.txtindex c829a9d81c..6adee23b26 100644--- a/tests/_convert/snapshots/simple_script.py.txt+++ b/tests/_convert/snapshots/simple_script.py.txt@@ -14,7 +14,6 @@ def _():return math.pi * radius ** 2print(calculate_area(5))- returnif __name__ == "__main__":diff --git a/tests/_export/test_exporter.py b/tests/_export/test_exporter.pyindex 640e7f2412..3903c40260 100644--- a/tests/_export/test_exporter.py+++ b/tests/_export/test_exporter.py@@ -325,14 +325,12 @@ async def test_run_notebook_with_stack_trace() -> None:@app.cell()def _():print("running internal tests")- return@app.cell()def _():import syssys.stderr.write("internal error\n")- return@app.cell()def _():@@ -341,7 +339,6 @@ async def test_run_notebook_with_stack_trace() -> None:raise ValueError("Failed to authenticate. The correct password is 's3cret'.")- returnfile_manager = AppFileManager.from_app(InternalApp(app))@@ -606,7 +603,6 @@ def test_export_as_html_omits_getpass_response(import getpass_password = getpass.getpass("Password: ")- returninternal_app = InternalApp(app)cell_id = next(iter(internal_app.cell_manager.cell_ids()))diff --git a/tests/_runtime/test_pytest_runtime.py b/tests/_runtime/test_pytest_runtime.pyindex 0d653d30d1..80186050f5 100644--- a/tests/_runtime/test_pytest_runtime.py+++ b/tests/_runtime/test_pytest_runtime.py@@ -178,8 +178,6 @@ def test_live_collection_ignores_stale_disk(tmp_path) -> None:def test_renamed_target():assert True- return-_, lcls = app.run()lcls = dict(lcls)defs = {"test_values", "test_added", "test_renamed_target"}@@ -508,8 +506,6 @@ def test_rerun_keeps_lazily_imported_modules(tmp_path, monkeypatch) -> None:fake_torch.seed()assert local_helper.VALUE == 1- return-notebook = tmp_path / "notebook.py"notebook.write_text("import marimo\napp = marimo.App()\n")@@ -588,8 +584,6 @@ def test_collection_skips_entries_beside_the_notebook_path(def test_anchor():assert True- return-previous = os.environ.get("PYTEST_CURRENT_TEST", "")os.environ.pop("PYTEST_CURRENT_TEST", None)try:@@ -642,8 +636,6 @@ def test_working_dir_conftest_applies_to_notebook_below_it(def test_shared(shared_value):assert shared_value == 7- return-previous = os.environ.get("PYTEST_CURRENT_TEST", "")os.environ.pop("PYTEST_CURRENT_TEST", None)try:@@ -690,8 +682,6 @@ def test_parent_conftest_applies_from_sibling_working_dir(def test_shared(shared_value):assert shared_value == 7- return-previous = os.environ.get("PYTEST_CURRENT_TEST", "")os.environ.pop("PYTEST_CURRENT_TEST", None)try:@@ -748,8 +738,6 @@ def test_project_config_applies_to_notebook_outside_working_dir(assert (shared_value, project_helper.VALUE) == (7, 42)- return-previous = os.environ.get("PYTEST_CURRENT_TEST", "")os.environ.pop("PYTEST_CURRENT_TEST", None)try:diff --git a/tests/_save/test_cache.py b/tests/_save/test_cache.pyindex ca254a6021..7405caeb3f 100644--- a/tests/_save/test_cache.py+++ b/tests/_save/test_cache.py@@ -2201,7 +2201,6 @@ class TestCacheDecorator:f()assert f.hits == 0assert f.base_block.execution_refs == {"ns"}- return@staticmethoddef test_execution_hash_same_block(app) -> None:@@ -2243,7 +2242,6 @@ class TestCacheDecorator:assert f.base_block.context_refs == {"ns"}, (f.base_block.context_refs)- return@staticmethoddef test_execution_hash_diff_block(app) -> None:@@ -2277,7 +2275,6 @@ class TestCacheDecorator:def __(f):f()assert f.base_block.execution_refs == {"ns", "z"}- return@staticmethoddef test_content_hash_define_after(app) -> None:@@ -2315,7 +2312,6 @@ class TestCacheDecorator:f.base_block.execution_refs)assert f.base_block.missing == {"ns"}, f.base_block.missing- return@staticmethoddef test_execution_hash_same_block_fails() -> None:@@ -2354,7 +2350,6 @@ class TestCacheDecorator:@app.celldef _(f):f()- return# Cannot hash the cell of the unhashable content, so it should failwith pytest.raises(TypeError):@@ -2386,7 +2381,6 @@ class TestCacheDecorator:random.seed(1)assert a == g("hello")assert a != g("world")- return@staticmethoddef test_shadowed_kwargs(app) -> None:@@ -2416,7 +2410,6 @@ class TestCacheDecorator:assert g.hits == 1assert g() == "hello"assert g.hits == 2- return@staticmethoddef test_shadowed_state(app) -> None:@@ -2441,7 +2434,6 @@ class TestCacheDecorator:@app.celldef __(v):assert v == 3- return@staticmethoddef test_shadowed_state_redefined(app) -> None:@@ -2467,7 +2459,6 @@ class TestCacheDecorator:@app.celldef __(v):assert v == 3- return@staticmethoddef test_internal_shadowed(app) -> None:@@ -2576,7 +2567,6 @@ class TestCacheDecorator:assert state1() == a == Aassert state2() == b == Bassert state() == 3- return@staticmethoddef test_shadowed_ui(app) -> None:@@ -2600,7 +2590,6 @@ class TestCacheDecorator:@app.celldef __(v):assert v == 3- return@staticmethoddef test_cache_with_mutation_after_def(app) -> None:@@ -2673,7 +2662,6 @@ class TestCacheDecorator:with ThreadPoolExecutor(max_workers=2) as executor:future = executor.submit(inner, extension)assert future.result() == 5- return@pytest.mark.skipif(not DependencyManager.pandas.has(),diff --git a/tests/_save/test_external_decorators.py b/tests/_save/test_external_decorators.pyindex 82eaee1043..199f95b86d 100644--- a/tests/_save/test_external_decorators.py+++ b/tests/_save/test_external_decorators.py@@ -300,7 +300,6 @@ class TestAsExternalApp:defs["x"].append(1)_, defs = ex_app.run()assert len(defs["x"]) == 1- return@staticmethodasync def test_as_external_app_in_kernel(@@ -343,7 +342,6 @@ class TestAsExternalApp:r1 = await ex_app.embed()assert r1.defs["bar"] == 2assert r1.defs["cache"](1) == 2- return@staticmethodasync def test_as_external_app_embedded_cloned(app) -> None:@@ -357,7 +355,6 @@ class TestAsExternalApp:r2 = await ex_app.clone().embed()assert r2.defs["bar"] == 2assert r2.defs["cache"](1) == 2- return@staticmethodasync def test_as_external_app_embedded_in_kernel(diff --git a/tests/_save/test_hash.py b/tests/_save/test_hash.pyindex 69e62035a0..98b6a5a804 100644--- a/tests/_save/test_hash.py+++ b/tests/_save/test_hash.py@@ -534,8 +534,6 @@ class TestHash:_ = sleepreturn 42- return-@app.celldef _(mo, time):@mo.cache@@ -543,8 +541,6 @@ class TestHash:_ = time.sleepreturn 42- return-@app.celldef _(direct, module):assert direct() == module(), "direct() != module()"diff --git a/tests/_server/test_file_manager.py b/tests/_server/test_file_manager.pyindex 6b674513dd..e36133da00 100644--- a/tests/_server/test_file_manager.py+++ b/tests/_server/test_file_manager.py@@ -559,8 +559,6 @@ def test_to_code(app_file_manager: AppFileManager) -> None:"def _():"," import marimo as mo","",- " return",- "","",'if __name__ == "__main__":'," app.run()",diff --git a/tests/_snippets/data/multi_markdown.py b/tests/_snippets/data/multi_markdown.pyindex 2b57f35b8e..595c39529e 100644--- a/tests/_snippets/data/multi_markdown.py+++ b/tests/_snippets/data/multi_markdown.py@@ -14,7 +14,6 @@ def __(mo):This is the title cell with a description.""")- return@app.cell@@ -24,7 +23,6 @@ def __(mo):This is a second markdown cell that should also be rendered.""")- return@app.celldiff --git a/tests/test_loggers.py b/tests/test_loggers.pyindex 31f4928f14..1429542263 100644--- a/tests/test_loggers.py+++ b/tests/test_loggers.py@@ -177,4 +177,3 @@ def test_file_handler_uses_windows_safe_on_windows(tmp_path: Path):def clear_loggers():# Clear the logger cache before each test_LOGGERS.clear()- return