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: follow ruff rules for formatting trailing space after imports/ functions (#8086)
Dylan Madisettia8b38ccf512c
diff --git a/examples/ai/chat/anthropic_example.py b/examples/ai/chat/anthropic_example.pyindex 1287d8a626..6a850c9a46 100644--- a/examples/ai/chat/anthropic_example.py+++ b/examples/ai/chat/anthropic_example.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.18.0"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/bedrock_example.py b/examples/ai/chat/bedrock_example.pyindex acc1a54870..299d8e6cf6 100644--- a/examples/ai/chat/bedrock_example.py+++ b/examples/ai/chat/bedrock_example.py@@ -9,13 +9,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.cell(hide_code=True)def _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/custom.py b/examples/ai/chat/custom.pyindex 60e459636d..c031b8c9a3 100644--- a/examples/ai/chat/custom.py+++ b/examples/ai/chat/custom.py@@ -7,13 +7,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/dagger_code_interpreter.py b/examples/ai/chat/dagger_code_interpreter.pyindex 0965166a88..8c76ac298f 100644--- a/examples/ai/chat/dagger_code_interpreter.py+++ b/examples/ai/chat/dagger_code_interpreter.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -20,6 +20,7 @@ def _():import marimo as moimport ellimport textwrap+return ell, mo@@ -95,6 +96,7 @@ def _(backend, input_key, mo):@app.celldef _():import dagger+return (dagger,)@@ -151,6 +153,7 @@ def _(dagger, ell, files, mo, packages):mo.md(result),])+return (execute_code,)@@ -209,6 +212,7 @@ def _(client, ell, execute_code, files, mo, model, packages):if response.tool_calls:return response.tool_calls[0]()return mo.md(response.text)+return (my_model,)diff --git a/examples/ai/chat/deepseek_example.py b/examples/ai/chat/deepseek_example.pyindex 97c44e1045..c721fdc23f 100644--- a/examples/ai/chat/deepseek_example.py+++ b/examples/ai/chat/deepseek_example.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/gemini.py b/examples/ai/chat/gemini.pyindex f23df4ef72..cae8bd417d 100644--- a/examples/ai/chat/gemini.py+++ b/examples/ai/chat/gemini.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.17.8"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/generative_ui.py b/examples/ai/chat/generative_ui.pyindex d56deb254c..ec66e6e810 100644--- a/examples/ai/chat/generative_ui.py+++ b/examples/ai/chat/generative_ui.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.6"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -63,6 +63,7 @@ def _(df, mo):selection=None,show_column_summaries=False,)+return chart_data, ell, filter_datasetdiff --git a/examples/ai/chat/groq_example.py b/examples/ai/chat/groq_example.pyindex b030f4fcc3..e9956d3efa 100644--- a/examples/ai/chat/groq_example.py+++ b/examples/ai/chat/groq_example.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/llm_datasette.py b/examples/ai/chat/llm_datasette.pyindex 40e2b78eff..0b454aa1bc 100644--- a/examples/ai/chat/llm_datasette.py+++ b/examples/ai/chat/llm_datasette.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -32,6 +32,7 @@ def _(mo):def _():import marimo as moimport llm+return llm, modiff --git a/examples/ai/chat/mlx_chat.py b/examples/ai/chat/mlx_chat.pyindex d4eda62a64..5d6aff4c87 100644--- a/examples/ai/chat/mlx_chat.py+++ b/examples/ai/chat/mlx_chat.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -19,6 +19,7 @@ def _():from pathlib import Pathimport marimo as mofrom huggingface_hub import snapshot_download+return Path, generate, load, mo, snapshot_download@@ -78,6 +79,7 @@ def _(Path, snapshot_download):raise ValueError(f"Error downloading model from Hugging Face: {str(e)}")+return (get_model_path,)diff --git a/examples/ai/chat/openai_example.py b/examples/ai/chat/openai_example.pyindex 8556a126b0..2c2f879090 100644--- a/examples/ai/chat/openai_example.py+++ b/examples/ai/chat/openai_example.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/chat/simplemind_example.py b/examples/ai/chat/simplemind_example.pyindex 2ce3e1eb7c..0731a0c86d 100644--- a/examples/ai/chat/simplemind_example.py+++ b/examples/ai/chat/simplemind_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -25,6 +25,7 @@ def _():import marimo as moimport osimport simplemind as sm+return mo, os, sm@@ -73,6 +74,7 @@ def _(set_logs, sm):def post_send_hook(self, conversation, response):add_log(f"Received response: {response.text}")+return (LoggingPlugin,)diff --git a/examples/ai/chat/streaming_custom.py b/examples/ai/chat/streaming_custom.pyindex ae69faca03..6caad08110 100644--- a/examples/ai/chat/streaming_custom.py+++ b/examples/ai/chat/streaming_custom.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.8"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -15,6 +15,7 @@ app = marimo.App(width="medium")def _():import marimo as moimport asyncio+return asyncio, mo@@ -34,7 +35,7 @@ def _(mo):def _(asyncio, mo):async def streaming_echo_model(messages, config):"""This chatbot echoes what the user says, word by word.-+Yields individual delta chunks that are accumulated by marimo.This follows the standard streaming pattern used by OpenAI, Anthropic,and other AI providers.@@ -81,7 +82,7 @@ def _(mo):Each `yield` sends a new chunk to marimo, which accumulates and displays them.This follows the standard streaming pattern used by OpenAI, Anthropic, and other AI providers.-+**Important**: Yield delta chunks (new content only), not accumulated text.""")returndiff --git a/examples/ai/data/data_labeler.py b/examples/ai/data/data_labeler.pyindex 595e4dc7af..23869914d0 100644--- a/examples/ai/data/data_labeler.py+++ b/examples/ai/data/data_labeler.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -23,6 +23,7 @@ def _(NUMBER_OF_EXAMPLES, mo):def decrement_index() -> int:set_index(lambda v: max(0, v - 1))+return decrement_index, get_index, increment_index, set_index@@ -87,6 +88,7 @@ def _(LABELS_PATH, labels, write_labels):def update_label(value, index):labels[index]["label"] = valuewrite_labels(labels, LABELS_PATH)+return (update_label,)@@ -95,6 +97,7 @@ def _(LABELS_PATH, labels, write_labels):def update_notes(value, index):labels[index]["notes"] = valuewrite_labels(labels, LABELS_PATH)+return (update_notes,)@@ -156,6 +159,7 @@ def _(json, os):]with open(path, "w", encoding="utf-8") as f:f.write(json.dumps(labels))+return load_labels, write_labels@@ -174,6 +178,7 @@ def _():@app.celldef _():import marimo as mo+return (mo,)@@ -181,6 +186,7 @@ def _():def _():import jsonimport os+return json, osdiff --git a/examples/ai/data/model_comparison.py b/examples/ai/data/model_comparison.pyindex fd8fba15c6..302f090cd4 100644--- a/examples/ai/data/model_comparison.py+++ b/examples/ai/data/model_comparison.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -195,6 +195,7 @@ def _(json, os):# Trunacate noteswith open(path, "w", encoding="utf-8") as f:f.write(json.dumps(choices))+return load_choices, write_choices@@ -255,6 +256,7 @@ def _(urllib):@app.celldef _():import marimo as mo+return (mo,)@@ -265,6 +267,7 @@ def _():import randomimport textwrapimport urllib+return json, os, random, textwrap, urllibdiff --git a/examples/ai/misc/build_a_superhero.py b/examples/ai/misc/build_a_superhero.pyindex 86c0784449..1c21819ab2 100644--- a/examples/ai/misc/build_a_superhero.py+++ b/examples/ai/misc/build_a_superhero.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -144,6 +144,7 @@ def _(generate_image_button, mo, openai, superhero):def _():import marimo as moimport openai+return mo, openaidiff --git a/examples/ai/misc/micrograd_mlp.py b/examples/ai/misc/micrograd_mlp.pyindex cfaf37dd17..f9fe505213 100644--- a/examples/ai/misc/micrograd_mlp.py+++ b/examples/ai/misc/micrograd_mlp.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -53,6 +53,7 @@ def _():def _():from micrograd.engine import Valuefrom micrograd.nn import Neuron, Layer, MLP+return MLP, Value@@ -200,6 +201,7 @@ def _(Value, X, np, y):(yi > 0) == (scorei.data > 0) for yi, scorei in zip(yb, scores)]return total_loss, sum(accuracy) / len(accuracy)+return (loss,)@@ -224,6 +226,7 @@ def _(loss, mo):print(f"step {k} loss {total_loss.data}, accuracy {acc*100}%")return model+return (train,)@@ -248,12 +251,14 @@ def _(Value, X, np, plt, y):plt.xlim(xx.min(), xx.max())plt.ylim(yy.min(), yy.max())return plt.gca()+return (plot_decision_boundary,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ai/misc/pdf_question_answer.py b/examples/ai/misc/pdf_question_answer.pyindex 6210b6b8b1..8cabeb5bbe 100644--- a/examples/ai/misc/pdf_question_answer.py+++ b/examples/ai/misc/pdf_question_answer.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -160,6 +160,7 @@ def _():from langchain.callbacks import get_openai_callbackimport os+return (CharacterTextSplitter,FAISS,diff --git a/examples/ai/tools/chat_with_tools.py b/examples/ai/tools/chat_with_tools.pyindex 14d3337bc5..668d12bce1 100644--- a/examples/ai/tools/chat_with_tools.py+++ b/examples/ai/tools/chat_with_tools.py@@ -16,7 +16,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -30,6 +30,7 @@ def _():import polars as plfrom bs4 import BeautifulSoupfrom vega_datasets import data+return BeautifulSoup, alt, data, ell, mo, pl, requests@@ -270,6 +271,7 @@ def _(TOOLS, client, df, ell, get_dataset, mo):[mo.md(f"Tool used: **{str(tool.tool.__name__)}**"), tool_response])return mo.md(response.text)+return (model,)diff --git a/examples/ai/tools/code_interpreter.py b/examples/ai/tools/code_interpreter.pyindex d7bdc11839..e742b5ee5a 100644--- a/examples/ai/tools/code_interpreter.py+++ b/examples/ai/tools/code_interpreter.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -18,6 +18,7 @@ def _():import marimo as moimport ellimport textwrap+return ell, mo@@ -155,6 +156,7 @@ def _(ell, mo):code_fence(result if result is not None else output),]return mo.md("\n\n".join(results))+return (execute_code,)@@ -176,6 +178,7 @@ def _(client, ell, execute_code, mo, model):if response.tool_calls:return response.tool_calls[0]()return mo.md(response.text)+return (my_model,)diff --git a/examples/ai/tools/dataset_analysis.py b/examples/ai/tools/dataset_analysis.pyindex 52ad29da35..c3ec502c45 100644--- a/examples/ai/tools/dataset_analysis.py+++ b/examples/ai/tools/dataset_analysis.py@@ -16,7 +16,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -30,6 +30,7 @@ def _():import pyarrowimport polars as plfrom vega_datasets import data+return alt, data, ell, mo, pl@@ -112,6 +113,7 @@ def _(alt, cars, client, ell, schema):def analyze_dataset(prompt: str) -> str:"""You are an agent that can analayze the a dataset"""return f"I have a dataset with schema: {schema}. \n{prompt}"+return (analyze_dataset,)diff --git a/examples/cloud/gcp/google_cloud_bigquery.py b/examples/cloud/gcp/google_cloud_bigquery.pyindex 058175cd09..11d21ee8b7 100644--- a/examples/cloud/gcp/google_cloud_bigquery.py+++ b/examples/cloud/gcp/google_cloud_bigquery.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -19,6 +19,7 @@ def _():import marimo as moimport osfrom google.cloud import bigquery+return bigquery, mo, osdiff --git a/examples/cloud/gcp/google_cloud_storage.py b/examples/cloud/gcp/google_cloud_storage.pyindex 365ac1dfb5..d5311c5a43 100644--- a/examples/cloud/gcp/google_cloud_storage.py+++ b/examples/cloud/gcp/google_cloud_storage.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -19,6 +19,7 @@ def _():import marimo as moimport osfrom google.cloud import storage+return mo, os, storagediff --git a/examples/cloud/gcp/google_sheets.py b/examples/cloud/gcp/google_sheets.pyindex 1e6846917d..8ae4e46ae0 100644--- a/examples/cloud/gcp/google_sheets.py+++ b/examples/cloud/gcp/google_sheets.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -22,6 +22,7 @@ def _():import gspreadfrom oauth2client.service_account import ServiceAccountCredentialsfrom oauth2client.client import GoogleCredentials+return GoogleCredentials, ServiceAccountCredentials, gspread, mo, os, pddiff --git a/examples/cloud/modal/nbs/notebook.py b/examples/cloud/modal/nbs/notebook.pyindex 0afe70cd44..02673c3c2c 100644--- a/examples/cloud/modal/nbs/notebook.py+++ b/examples/cloud/modal/nbs/notebook.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -10,6 +10,7 @@ def _():import sysimport platformimport os+return mo, os, platform, sysdiff --git a/examples/control_flow/stop_execution.py b/examples/control_flow/stop_execution.pyindex 0eaff0a6b7..672b4485fd 100644--- a/examples/control_flow/stop_execution.py+++ b/examples/control_flow/stop_execution.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/layouts/columns.py b/examples/layouts/columns.pyindex 699ee3bd31..49cc94f1cf 100644--- a/examples/layouts/columns.py+++ b/examples/layouts/columns.py@@ -12,13 +12,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="columns")@app.cell(column=0)def _():import marimo as mo+return (mo,)@@ -32,6 +33,7 @@ async def _():await micropip.install("altair")import altair as alt+return (alt,)@@ -40,12 +42,14 @@ def _():import sklearnimport sklearn.datasetsimport sklearn.manifold+return (sklearn,)@app.celldef _():import polars as pl+return (pl,)@@ -62,6 +66,7 @@ def _(alt):).properties(width=500, height=500))+return (scatter,)@@ -85,6 +90,7 @@ def _(raw_digits):axes.set_xticks([])plt.tight_layout()return fig+return (show_images,)diff --git a/examples/layouts/grid-dashboard.py b/examples/layouts/grid-dashboard.pyindex 9467b3c3d0..d11e2fe8ec 100644--- a/examples/layouts/grid-dashboard.py+++ b/examples/layouts/grid-dashboard.py@@ -15,7 +15,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium",layout_file="layouts/grid-dashboard.grid.json",@@ -143,6 +143,7 @@ def _(dataset, np):dataset["gdpPercap"].min() - 100,dataset[dataset["gdpPercap"] < 10000].max()["gdpPercap"] + 1000,)+return get_data, get_title, get_xlim@@ -280,6 +281,7 @@ def _(XLABEL, YLABEL, YLIM, alt, get_data, get_title, get_xlim, go, pio, plt):xlabel=XLABEL,height=400,)+return altair_view, hvplot_view, mpl_view, plotly_viewdiff --git a/examples/layouts/sidebar.py b/examples/layouts/sidebar.pyindex a2aaa676ad..9a319d6500 100644--- a/examples/layouts/sidebar.py+++ b/examples/layouts/sidebar.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -27,6 +27,7 @@ def _():import marimo as moimport altair as altfrom vega_datasets import data+return alt, data, modiff --git a/examples/layouts/slides.py b/examples/layouts/slides.pyindex b5e51a6fd7..466f919d9d 100644--- a/examples/layouts/slides.py+++ b/examples/layouts/slides.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.19.6"+__generated_with = "0.19.7"app = marimo.App(width="medium", layout_file="layouts/slides.slides.json")@@ -227,6 +227,7 @@ def _(duckdb, mo):```{mo.ui.table(result.df(), selection=None, pagination=None, show_column_summaries=False)}"""+return (print_and_run,)@@ -234,6 +235,7 @@ def _(duckdb, mo):def _():import marimo as moimport duckdb+return duckdb, modiff --git a/examples/markdown/admonitions.py b/examples/markdown/admonitions.pyindex 6b2188d29b..8f69c02080 100644--- a/examples/markdown/admonitions.py+++ b/examples/markdown/admonitions.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -37,6 +37,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/markdown/details.py b/examples/markdown/details.pyindex 4927a75ec3..56de594493 100644--- a/examples/markdown/details.py+++ b/examples/markdown/details.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -83,6 +83,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/markdown/dynamic_markdown.py b/examples/markdown/dynamic_markdown.pyindex 044979a88c..f3b72e2f7b 100644--- a/examples/markdown/dynamic_markdown.py+++ b/examples/markdown/dynamic_markdown.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -77,6 +77,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/markdown/emoji.py b/examples/markdown/emoji.pyindex 5a2ea3463f..b5d321ca71 100644--- a/examples/markdown/emoji.py+++ b/examples/markdown/emoji.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -23,6 +23,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/markdown/mermaid.py b/examples/markdown/mermaid.pyindex f41ef773e3..84fde79378 100644--- a/examples/markdown/mermaid.py+++ b/examples/markdown/mermaid.py@@ -7,13 +7,14 @@import marimo-__generated_with = "0.17.8"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/bayes_theorem.py b/examples/misc/bayes_theorem.pyindex b60c5f2d09..deeb5c9311 100644--- a/examples/misc/bayes_theorem.py+++ b/examples/misc/bayes_theorem.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.8"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -152,12 +152,14 @@ def _(p_e_given_h, p_e_given_not_h, p_h):plt.gca().add_patch(e_given_h)plt.legend()return plt.gca()+return (construct_probability_plot,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/colliding_blocks_and_pi.py b/examples/misc/colliding_blocks_and_pi.pyindex b9ab4a56be..aedef6dff9 100644--- a/examples/misc/colliding_blocks_and_pi.py+++ b/examples/misc/colliding_blocks_and_pi.py@@ -9,13 +9,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@@ -112,6 +113,7 @@ def _():import matplotlib.pyplot as pltimport matplotlib.animation as animationfrom matplotlib.patches import Rectangle+return Rectangle, animation, plt@@ -203,6 +205,7 @@ def _(create_animation):axis, ani = Nonereturn axis, ani, collision_count+return (simulate_collisions,)diff --git a/examples/misc/compound_interest.py b/examples/misc/compound_interest.pyindex 3989ec148d..7d732e230e 100644--- a/examples/misc/compound_interest.py+++ b/examples/misc/compound_interest.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -156,6 +156,7 @@ def _(ax):def _():import marimo as moimport matplotlib.pyplot as plt+return mo, pltdiff --git a/examples/misc/create_your_own_shape.py b/examples/misc/create_your_own_shape.pyindex 48ab300791..050eefd2ae 100644--- a/examples/misc/create_your_own_shape.py+++ b/examples/misc/create_your_own_shape.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -222,6 +222,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/custom_configuration.py b/examples/misc/custom_configuration.pyindex cf66ae4216..7025ae9d97 100644--- a/examples/misc/custom_configuration.py+++ b/examples/misc/custom_configuration.py@@ -13,13 +13,14 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/explore_your_own_data.py b/examples/misc/explore_your_own_data.pyindex fd57d52dd9..8447120d46 100644--- a/examples/misc/explore_your_own_data.py+++ b/examples/misc/explore_your_own_data.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -118,6 +118,7 @@ def _():import ioimport matplotlib.pyplot as pltimport pandas as pd+return alt, io, mo, pddiff --git a/examples/misc/filterable_table.py b/examples/misc/filterable_table.pyindex 8dd420a3de..1f9abc2b08 100644--- a/examples/misc/filterable_table.py+++ b/examples/misc/filterable_table.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -75,6 +75,7 @@ def _(cylinders, horse_power, manufacturer):& (filtered_df["Horsepower"] <= right)]return filtered_df+return (filter_df,)@@ -87,6 +88,7 @@ def data_url(file):def _():import marimo as moimport pandas as pd+return mo, pddiff --git a/examples/misc/iss.py b/examples/misc/iss.pyindex cb8baddeca..103b4b9cf6 100644--- a/examples/misc/iss.py+++ b/examples/misc/iss.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -122,6 +122,7 @@ def _(n_points_slider, pd, refresh_interval_slider, refresher, requests, time):df = pd.DataFrame(response.json())df['timestamp'] = pd.to_datetime(df.timestamp, unit='s')return df[['timestamp','latitude','longitude','altitude','velocity','visibility']]+return (get_iss_positions,)diff --git a/examples/misc/monotonic_splines.py b/examples/misc/monotonic_splines.pyindex bd2c602837..d49fbb879f 100644--- a/examples/misc/monotonic_splines.py+++ b/examples/misc/monotonic_splines.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -211,6 +211,7 @@ def _(mo):@app.celldef _():import pandas as pd+return (pd,)diff --git a/examples/misc/mortgage_calculator.py b/examples/misc/mortgage_calculator.pyindex ed76c4d655..94317eff4c 100644--- a/examples/misc/mortgage_calculator.py+++ b/examples/misc/mortgage_calculator.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -394,6 +394,7 @@ def _():import marimo as moimport mortgageimport numpy as np+return mo, mortgage, npdiff --git a/examples/misc/movies_by_the_decade.py b/examples/misc/movies_by_the_decade.pyindex 448f853f2b..ac194b3110 100644--- a/examples/misc/movies_by_the_decade.py+++ b/examples/misc/movies_by_the_decade.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -329,6 +329,7 @@ def _(datetime):def format_date(date):return date.strftime("%Y-%m-%d")+return (get_average_budget,get_average_gross,@@ -346,6 +347,7 @@ def _():import pandas as pdimport datetimeimport altair as alt+return alt, data, datetime, mo, pddiff --git a/examples/misc/notebook_dir.py b/examples/misc/notebook_dir.pyindex 90016c5a50..056e6a8d19 100644--- a/examples/misc/notebook_dir.py+++ b/examples/misc/notebook_dir.py@@ -4,15 +4,17 @@# "marimo",# ]# ///+import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/pokemon_stats.py b/examples/misc/pokemon_stats.pyindex dc796e549b..890ce58001 100644--- a/examples/misc/pokemon_stats.py+++ b/examples/misc/pokemon_stats.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -197,6 +197,7 @@ def _(pokemon):]ax.fill(angles, stats, alpha=0.2, label=name)return ax+return (plot_single_pokemon,)@@ -217,6 +218,7 @@ def _(np, plot_single_pokemon, plt):if names:plt.legend(loc="upper left")return ax+return (plot_pokemon,)@@ -267,6 +269,7 @@ def _():@app.celldef _():import plotly.express as px+returndiff --git a/examples/misc/public_folder.py b/examples/misc/public_folder.pyindex 0270a176d4..cd6d35cb8f 100644--- a/examples/misc/public_folder.py+++ b/examples/misc/public_folder.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -19,6 +19,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/reactive_plots.py b/examples/misc/reactive_plots.pyindex db6370f8b5..393fe6f269 100644--- a/examples/misc/reactive_plots.py+++ b/examples/misc/reactive_plots.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -78,12 +78,14 @@ def _(alt, data):def _():import altair as altfrom vega_datasets import data+return alt, data@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/misc/seam_carving.py b/examples/misc/seam_carving.pyindex 09e0dc76af..3bbb4e80fc 100644--- a/examples/misc/seam_carving.py+++ b/examples/misc/seam_carving.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -170,6 +170,7 @@ def _():print(f"Seam carving completed in {end_time - start_time:.2f} seconds")return carved_img+return (efficient_seam_carve,)diff --git a/examples/misc/task_list.py b/examples/misc/task_list.pyindex ce7f8b77d4..a1f0b2fcb8 100644--- a/examples/misc/task_list.py+++ b/examples/misc/task_list.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@@ -23,6 +23,7 @@ def _(dataclass):class Task:name: strdone: bool = False+return (Task,)@@ -92,12 +93,14 @@ def _(mo, task_list):@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():from dataclasses import dataclass+return (dataclass,)diff --git a/examples/outputs/accordion.py b/examples/outputs/accordion.pyindex fc2e2d3d15..fd54aeb486 100644--- a/examples/outputs/accordion.py+++ b/examples/outputs/accordion.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/basic_markdown.py b/examples/outputs/basic_markdown.pyindex 445c341cad..7218c3f062 100644--- a/examples/outputs/basic_markdown.py+++ b/examples/outputs/basic_markdown.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/capture_console_outputs.py b/examples/outputs/capture_console_outputs.pyindex c2e1bc1186..c36a30f67f 100644--- a/examples/outputs/capture_console_outputs.py+++ b/examples/outputs/capture_console_outputs.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/cell_output.py b/examples/outputs/cell_output.pyindex 5dab20234a..32feb91888 100644--- a/examples/outputs/cell_output.py+++ b/examples/outputs/cell_output.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -28,6 +28,7 @@ def _():@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/conditional_output.py b/examples/outputs/conditional_output.pyindex 118343cefc..717b91485a 100644--- a/examples/outputs/conditional_output.py+++ b/examples/outputs/conditional_output.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/console_outputs.py b/examples/outputs/console_outputs.pyindex 6ff8aaa834..a669fc2cbb 100644--- a/examples/outputs/console_outputs.py+++ b/examples/outputs/console_outputs.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/dataframes.py b/examples/outputs/dataframes.pyindex 077d0f5732..739bdcafbf 100644--- a/examples/outputs/dataframes.py+++ b/examples/outputs/dataframes.py@@ -8,19 +8,21 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():from vega_datasets import data+return (data,)diff --git a/examples/outputs/plots.py b/examples/outputs/plots.pyindex 3761fd108b..52d25f1868 100644--- a/examples/outputs/plots.py+++ b/examples/outputs/plots.py@@ -9,19 +9,21 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():import matplotlib.pyplot as plt+return (plt,)diff --git a/examples/outputs/progress_bar.py b/examples/outputs/progress_bar.pyindex 364254e016..21c1d007eb 100644--- a/examples/outputs/progress_bar.py+++ b/examples/outputs/progress_bar.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@@ -9,7 +9,7 @@ def _():import marimo as moimport asyncio- return (mo, asyncio)+ return asyncio, mo@app.cell@@ -20,7 +20,7 @@ def _(mo):@app.cell-async def _(mo, asyncio, rerun):+async def _(asyncio, mo, rerun):rerunfor _ in mo.status.progress_bar(range(10),@@ -41,7 +41,7 @@ def _(mo):@app.cell-async def _(mo, asyncio, rerun_slow):+async def _(asyncio, mo, rerun_slow):rerun_slowfor _ in mo.status.progress_bar(range(2), title="Loading", subtitle="Please wait", show_eta=True, show_rate=Truediff --git a/examples/outputs/showing_multiple_outputs.py b/examples/outputs/showing_multiple_outputs.pyindex fe25bb8263..ec3f73eb45 100644--- a/examples/outputs/showing_multiple_outputs.py+++ b/examples/outputs/showing_multiple_outputs.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/spinner.py b/examples/outputs/spinner.pyindex fa3fe84e50..1308bec6b8 100644--- a/examples/outputs/spinner.py+++ b/examples/outputs/spinner.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/outputs/stacks.py b/examples/outputs/stacks.pyindex 45db19d0a9..09eda1ce7c 100644--- a/examples/outputs/stacks.py+++ b/examples/outputs/stacks.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/running_as_a_script/sharing_arguments.py b/examples/running_as_a_script/sharing_arguments.pyindex 0bc1ae9e20..7ba35798f7 100644--- a/examples/running_as_a_script/sharing_arguments.py+++ b/examples/running_as_a_script/sharing_arguments.py@@ -1,18 +1,20 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():import argparse+return (argparse,)diff --git a/examples/running_as_a_script/with_argparse.py b/examples/running_as_a_script/with_argparse.pyindex 67e8ee5d5f..a2f62af8b2 100644--- a/examples/running_as_a_script/with_argparse.py+++ b/examples/running_as_a_script/with_argparse.py@@ -1,18 +1,20 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():import argparse+return (argparse,)@@ -42,6 +44,7 @@ def _(mo, parser):count = args.countverbose = args.verbosereturn filename, count, verbose+return (parse_args,)diff --git a/examples/running_as_a_script/with_simple_parsing.py b/examples/running_as_a_script/with_simple_parsing.pyindex 2f27c11176..821eedc5a0 100644--- a/examples/running_as_a_script/with_simple_parsing.py+++ b/examples/running_as_a_script/with_simple_parsing.py@@ -8,19 +8,21 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():import simple_parsing+return@@ -55,6 +57,7 @@ def _(Options, mo, parser):else:args = parser.parse_args()return args.foo, args.options+return (parse_args,)diff --git a/examples/running_cells/async_await.py b/examples/running_cells/async_await.pyindex f80532fea5..0434e96224 100644--- a/examples/running_cells/async_await.py+++ b/examples/running_cells/async_await.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+returndiff --git a/examples/running_cells/basics.py b/examples/running_cells/basics.pyindex b2d85036a5..ea0ce5be6f 100644--- a/examples/running_cells/basics.py+++ b/examples/running_cells/basics.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/running_cells/in_memory_cache.py b/examples/running_cells/in_memory_cache.pyindex 7e9d3680c0..e398551cd5 100644--- a/examples/running_cells/in_memory_cache.py+++ b/examples/running_cells/in_memory_cache.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(app_title="In Memory Cache")@app.celldef _():import marimo as mo+return (mo,)@@ -19,6 +20,7 @@ def _(mo):print("Sleeping")time.sleep(t)return t+return (sleep_for,)diff --git a/examples/running_cells/multiple_definitions.py b/examples/running_cells/multiple_definitions.pyindex 1375bdd330..b39bc770b9 100644--- a/examples/running_cells/multiple_definitions.py+++ b/examples/running_cells/multiple_definitions.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@@ -62,6 +63,7 @@ def _(mo):@app.celldef _():import matplotlib.pyplot as plt+return (plt,)diff --git a/examples/running_cells/persistent_cache.py b/examples/running_cells/persistent_cache.pyindex 53a519fc43..60005e5f7e 100644--- a/examples/running_cells/persistent_cache.py+++ b/examples/running_cells/persistent_cache.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(app_title="In Memory Cache")@app.celldef _():import marimo as mo+return (mo,)@@ -19,6 +20,7 @@ def _(mo):print("Sleeping")time.sleep(t)return t+return (sleep_for,)diff --git a/examples/sql/connect_to_persistent_db.py b/examples/sql/connect_to_persistent_db.pyindex 16a99c25cd..ac4f6cef9b 100644--- a/examples/sql/connect_to_persistent_db.py+++ b/examples/sql/connect_to_persistent_db.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/sql/duckdb_example.py b/examples/sql/duckdb_example.pyindex e0c0d3458e..46792f7380 100644--- a/examples/sql/duckdb_example.py+++ b/examples/sql/duckdb_example.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium", sql_output="polars")@@ -19,6 +19,7 @@ app = marimo.App(width="medium", sql_output="polars")def _():import marimo as moimport altair as alt+return alt, modiff --git a/examples/sql/histograms.py b/examples/sql/histograms.pyindex 20b31c1069..3e9ea73166 100644--- a/examples/sql/histograms.py+++ b/examples/sql/histograms.py@@ -12,7 +12,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -33,6 +33,7 @@ def _():import polarsimport pyarrowimport altair as alt+return alt, mo@@ -58,7 +59,7 @@ def _(URL, mo):FROM dataset""")- return (dataset,)+ return@app.celldiff --git a/examples/sql/misc/database_explorer.py b/examples/sql/misc/database_explorer.pyindex 5f6294382c..8d45b837f9 100644--- a/examples/sql/misc/database_explorer.py+++ b/examples/sql/misc/database_explorer.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -23,6 +23,7 @@ def _():import duckdbimport marimo as mo+return duckdb, mo, osdiff --git a/examples/sql/misc/electric_vehicles.py b/examples/sql/misc/electric_vehicles.pyindex e4ccc40849..ea716441a1 100644--- a/examples/sql/misc/electric_vehicles.py+++ b/examples/sql/misc/electric_vehicles.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -111,7 +111,7 @@ def _(mo):@app.cell-def _(mo):+def _(evs, mo):years = mo.sql(f"""SELECT DISTINCT CAST(evs."Model Year" AS VARCHAR) AS "Model Year" FROM evs;@@ -121,7 +121,7 @@ def _(mo):@app.cell-def _(mo):+def _(evs, mo):cities = mo.sql(f"""SELECT DISTINCT CAST(evs."City" AS VARCHAR) AS "City" FROM evs WHERE "City" != 'null';@@ -131,7 +131,7 @@ def _(mo):@app.cell-def _(mo):+def _(evs, mo):makes = mo.sql(f"""SELECT DISTINCT CAST(evs."Make" AS VARCHAR) AS "Make" FROM evs;@@ -141,7 +141,7 @@ def _(mo):@app.cell-def _(cast_to_ints, city_select, make_select, mo, sql_list, year_select):+def _(cast_to_ints, city_select, evs, make_select, mo, sql_list, year_select):grouped_by_city = mo.sql(f"""SELECT COUNT(*) AS "count", "City", "Model Year"@@ -161,7 +161,7 @@ def _(cast_to_ints, city_select, make_select, mo, sql_list, year_select):@app.cell-def _(cast_to_ints, city_select, make_select, mo, sql_list, year_select):+def _(cast_to_ints, city_select, evs, make_select, mo, sql_list, year_select):grouped_by_make = mo.sql(f"""SELECT COUNT(*) AS "count", "Make", "Model Year"@@ -195,6 +195,7 @@ def _():def cast_to_ints(items):return [int(i) for i in items]+return cast_to_ints, sql_list@@ -203,6 +204,7 @@ def _():# Importsimport marimo as moimport altair as alt+return alt, modiff --git a/examples/sql/misc/sql_cars.py b/examples/sql/misc/sql_cars.pyindex 86c6f47b0c..ddaa54de69 100644--- a/examples/sql/misc/sql_cars.py+++ b/examples/sql/misc/sql_cars.py@@ -12,7 +12,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -25,7 +25,7 @@ def _(data):@app.cell-def _(mo):+def _(cars_df, mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE cars AS SELECT * FROM cars_df;@@ -84,7 +84,7 @@ def _(mo):@app.cell-def _(mo, year_range):+def _(cars, mo, year_range):_df = mo.sql(f"""WITH ranked_cars AS (@@ -175,7 +175,7 @@ def _(alt, duckdb, mo, year_range):def _(chart, mo):mo.stop(chart.value.empty, mo.callout("Select cars from the chart above."))selected_cars = chart.value- return+ return (selected_cars,)@app.cell(hide_code=True)@@ -207,7 +207,7 @@ def _(aggs, aggs_selected, mo):@app.cell(hide_code=True)-def _(mo):+def _(cars, mo, selected_cars):aggs_selected = mo.sql("""SELECTCOUNT(*) as count,@@ -240,6 +240,7 @@ def _():import duckdbimport altair as altfrom vega_datasets import data+return alt, data, duckdb, modiff --git a/examples/sql/parametrizing_sql_queries.py b/examples/sql/parametrizing_sql_queries.pyindex 77c6d3a5ea..7d64ffcd26 100644--- a/examples/sql/parametrizing_sql_queries.py+++ b/examples/sql/parametrizing_sql_queries.py@@ -11,13 +11,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -39,7 +40,7 @@ def _():df = data.iris()df- return+ return (df,)@app.cell(hide_code=True)@@ -90,7 +91,7 @@ def _(mo):@app.cell-def _(mo, species_dropdown):+def _(df, mo, species_dropdown):result = mo.sql(f"""SELECT * FROM df where species == '{species_dropdown.value}'diff --git a/examples/sql/querying_dataframes.py b/examples/sql/querying_dataframes.pyindex d8c118f99b..2134b133a1 100644--- a/examples/sql/querying_dataframes.py+++ b/examples/sql/querying_dataframes.py@@ -11,13 +11,14 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -39,7 +40,7 @@ def _():df = data.iris()df.head()- return+ return (df,)@app.cell(hide_code=True)@@ -60,7 +61,7 @@ def _(mo):@app.cell-def _(mo):+def _(df, mo):result = mo.sql(f"""SELECT species, mean(petalLength) as meanPetalLength FROM df GROUP BY species ORDER BY meanPetalLengthdiff --git a/examples/sql/read_csv.py b/examples/sql/read_csv.pyindex 122b45e33e..cce3d71d00 100644--- a/examples/sql/read_csv.py+++ b/examples/sql/read_csv.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -120,7 +120,7 @@ def _(mo):@app.cell-def _(mo):+def _(mo, mytable):_df = mo.sql(f"""SELECT * FROM myTablediff --git a/examples/sql/read_json.py b/examples/sql/read_json.pyindex d9ce30470e..68a986cce8 100644--- a/examples/sql/read_json.py+++ b/examples/sql/read_json.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -126,7 +126,7 @@ def _(mo):@app.cell-def _(mo):+def _(mo, mytable):_df = mo.sql(f"""SELECT * FROM myTablediff --git a/examples/sql/read_parquet.py b/examples/sql/read_parquet.pyindex 9783cca9f1..c45662f34b 100644--- a/examples/sql/read_parquet.py+++ b/examples/sql/read_parquet.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -119,7 +119,7 @@ def _(mo):@app.cell-def _(mo):+def _(mo, mytable):_df = mo.sql(f"""SELECT * FROM myTablediff --git a/examples/testing/running_doctests.py b/examples/testing/running_doctests.pyindex d92fa19d6f..5db918964d 100644--- a/examples/testing/running_doctests.py+++ b/examples/testing/running_doctests.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/aframe/aframe_example.py b/examples/third_party/aframe/aframe_example.pyindex 043710f837..fe46f2ef56 100644--- a/examples/third_party/aframe/aframe_example.py+++ b/examples/third_party/aframe/aframe_example.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@@ -57,6 +57,7 @@ def _(a, mo):def _():import marimo as mofrom aframe import Aframe, xyz+return Aframe, mo, xyzdiff --git a/examples/third_party/anywidget/reactive_quak.py b/examples/third_party/anywidget/reactive_quak.pyindex 543e74a988..5929e98491 100644--- a/examples/third_party/anywidget/reactive_quak.py+++ b/examples/third_party/anywidget/reactive_quak.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -20,6 +20,7 @@ def _():import marimo as moimport polars as plimport quak+return mo, pl, quakdiff --git a/examples/third_party/chroma/multimodal_retrieval.py b/examples/third_party/chroma/multimodal_retrieval.pyindex 265e55176e..73381b58ce 100644--- a/examples/third_party/chroma/multimodal_retrieval.py+++ b/examples/third_party/chroma/multimodal_retrieval.py@@ -13,13 +13,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -53,6 +54,7 @@ def _():from datasets import load_datasetfrom matplotlib import pyplot as plt+return load_dataset, osdiff --git a/examples/third_party/cvxpy/regularization_and_sparsity.py b/examples/third_party/cvxpy/regularization_and_sparsity.pyindex d561ebabaa..d3b0a65f27 100644--- a/examples/third_party/cvxpy/regularization_and_sparsity.py+++ b/examples/third_party/cvxpy/regularization_and_sparsity.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -169,6 +169,7 @@ def _(mo):def _(np):def number_of_zeros(x):return np.isclose(x, 0).sum()+return (number_of_zeros,)@@ -186,6 +187,7 @@ def _(np, x_min_max):ax.set_xlabel('$x_i$')ax.set_ylabel('fraction of components')return ax+return (cdf,)@@ -204,6 +206,7 @@ def _(cp):problem.solve()return x.valuereturn solve+return (sparse_solver,)@@ -212,18 +215,21 @@ def _():import cvxpy as cpimport matplotlib.pyplot as pltimport numpy as np+return cp, np, plt@app.celldef _():import functools+return (functools,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/cvxpy/signals/app.py b/examples/third_party/cvxpy/signals/app.pyindex c7779c7aa6..1209907f82 100644--- a/examples/third_party/cvxpy/signals/app.py+++ b/examples/third_party/cvxpy/signals/app.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -66,6 +66,7 @@ def _(complib, mo):def _(component_options, get_component_radio_tracker):def user_tried_all_components():return len(get_component_radio_tracker()) == len(component_options)+return (user_tried_all_components,)@@ -428,6 +429,7 @@ def _(csv_has_header, data_uploader, mo):"""else:return ""+return column_name, read_uploaded_csv, show_csv_parameters@@ -753,6 +755,7 @@ def _(complib, problem, problems):],))+return (construct_components,)@@ -763,6 +766,7 @@ def _(construct_components):f = problem.decompose(c)f.set_figwidth(6.4)return f+return (decompose,)@@ -849,6 +853,7 @@ def _():import numpy as npimport marimo as moimport matplotlib.pyplot as plt+return mo, pltdiff --git a/examples/third_party/cvxpy/signals/examples.py b/examples/third_party/cvxpy/signals/examples.pyindex 4cd12939ce..5feb0954fc 100644--- a/examples/third_party/cvxpy/signals/examples.py+++ b/examples/third_party/cvxpy/signals/examples.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -243,12 +243,14 @@ def _():import modules.dataloaders as dataloadersimport modules.solutions as solutions+return dataloaders, np, plt, solutions@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/cvxpy/smallest_enclosing_circle.py b/examples/third_party/cvxpy/smallest_enclosing_circle.pyindex d63e8d965b..df60757d0f 100644--- a/examples/third_party/cvxpy/smallest_enclosing_circle.py+++ b/examples/third_party/cvxpy/smallest_enclosing_circle.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -60,6 +60,7 @@ def _(np):r_i = np.abs(np.random.randn())circles.append((c_i, r_i))return circles+return (generate_circles,)@@ -96,6 +97,7 @@ def _(plt):ax = plt.gca() if ax is None else axax.add_patch(plt.Circle(center, radius, fill=False, **kwargs))return ax+return (plot_circle,)@@ -161,6 +163,7 @@ def _(cp):objective = cp.Minimize(radius)cp.Problem(objective, constraints).solve()return (center.value, radius.value)+return (smallest_enclosing_circle,)@@ -169,12 +172,14 @@ def _():import matplotlib.pyplot as pltimport numpy as npimport cvxpy as cp+return cp, np, plt@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/databricks/databricks_connect.py b/examples/third_party/databricks/databricks_connect.pyindex e7e87784d4..9b66e0e0bb 100644--- a/examples/third_party/databricks/databricks_connect.py+++ b/examples/third_party/databricks/databricks_connect.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -24,6 +24,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/duckdb/duckdb_example.py b/examples/third_party/duckdb/duckdb_example.pyindex f19f08cc4b..b25fe78422 100644--- a/examples/third_party/duckdb/duckdb_example.py+++ b/examples/third_party/duckdb/duckdb_example.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -311,6 +311,7 @@ def _(con, mo, url):data = con.sql(f"SELECT * FROM '{url}' LIMIT {limit}").df()df_editor = mo.ui.dataframe(data)return df_editor+return render_dataframe_editor, render_sql_editor, render_sql_results@@ -343,6 +344,7 @@ def _(functools, json, pd, requests):j = r.json()urls = [f["url"] for f in j["parquet_files"]]return urls+return fetch_hugging_face_datasets, load_hugging_face_dataset@@ -354,6 +356,7 @@ def _():import marimo as moimport duckdbimport pandas as pd+return duckdb, functools, json, mo, pd, requestsdiff --git a/examples/third_party/huggingface/chatbot.py b/examples/third_party/huggingface/chatbot.pyindex 1536b834a9..2e77b9c56a 100644--- a/examples/third_party/huggingface/chatbot.py+++ b/examples/third_party/huggingface/chatbot.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.16.0"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -17,6 +17,7 @@ def _():import marimo as moimport osfrom huggingface_hub import InferenceClient+return InferenceClient, mo, os@@ -145,6 +146,7 @@ def _(client, mo):# You can return strings, markdown, charts, tables, dataframes, and more.return response.choices[0].message.content+return max_tokens, respond, system_message, temperature, top_pdiff --git a/examples/third_party/ibis/ibis_example.py b/examples/third_party/ibis/ibis_example.pyindex 1f2ee0d14a..86b607b756 100644--- a/examples/third_party/ibis/ibis_example.py+++ b/examples/third_party/ibis/ibis_example.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -28,6 +28,7 @@ def _():import marimo as moimport ibisimport altair as alt+return alt, ibis, modiff --git a/examples/third_party/leafmap/leafmap_example.py b/examples/third_party/leafmap/leafmap_example.pyindex dd0bb4735d..76cdc57cb8 100644--- a/examples/third_party/leafmap/leafmap_example.py+++ b/examples/third_party/leafmap/leafmap_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -25,6 +25,7 @@ def _(mo):@app.celldef _():import leafmap+return (leafmap,)@@ -45,6 +46,7 @@ def _(leafmap):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/matplotlib/mandelbrot.py b/examples/third_party/matplotlib/mandelbrot.pyindex 6c44904195..467ba0dbc7 100644--- a/examples/third_party/matplotlib/mandelbrot.py+++ b/examples/third_party/matplotlib/mandelbrot.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -135,6 +135,7 @@ def _(np, plt):)plt.colorbar()return plt.gca()+return (compute_mandelbrot,)@@ -142,12 +143,14 @@ def _(np, plt):def _():import numpy as npimport matplotlib.pyplot as plt+return np, plt@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/matplotlib/surfaces.py b/examples/third_party/matplotlib/surfaces.pyindex f5a19dd029..af2f333742 100644--- a/examples/third_party/matplotlib/surfaces.py+++ b/examples/third_party/matplotlib/surfaces.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -150,6 +150,7 @@ def _(plt):fig.set_size_inches(7, 7)return ax+return (plot_3d_surface,)@@ -246,6 +247,7 @@ def _(grid, saddle_param_a, saddle_param_b):def saddle():x, y = grid(xlim=(-1, 1), ylim=(-1, 1))return x, y, saddle_param_a.value*x**2 - saddle_param_b.value*y**4+return (saddle,)@@ -254,6 +256,7 @@ def _(a, b, grid):def paraboloid():x, y = grid(xlim=(-1, 1), ylim=(-1, 1))return x, y, a.value*x**2 / 2 + b.value*y**2/ 2+return (paraboloid,)@@ -265,6 +268,7 @@ def _(grid, np, sphere_param_r):y = np.sin(theta)*np.sin(phi)z = np.cos(phi)return sphere_param_r.value*x, sphere_param_r.value*y, sphere_param_r.value*z+return (sphere,)@@ -279,6 +283,7 @@ def _(grid, np, torus_param_a, torus_param_c):y = (center_radius + tube_radius*np.cos(theta)) * np.sin(phi)z = tube_radius*np.sin(theta)return x, y, z+return (torus,)@@ -290,6 +295,7 @@ def _(np):x = np.linspace(xmin, xmax, 100)y = np.linspace(ymin, ymax, 100)return np.meshgrid(x, y)+return (grid,)@@ -298,12 +304,14 @@ def _():import matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport numpy as np+return np, plt@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py b/examples/third_party/motherduck/embeddings/embeddings_explorer_final.pyindex 857f3173a9..a57527476c 100644--- a/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py+++ b/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py@@ -16,7 +16,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -37,6 +37,7 @@ def _():import hdbscan # For clustering similar embeddingsimport numpy as npfrom sklearn.decomposition import PCA+return PCA, alt, hdbscan, mo, np, pl, umap@@ -111,6 +112,7 @@ def _(PCA, hdbscan, np, umap):return np.where(hdb.labels_ == -1, "outlier", "cluster_" + hdb.labels_.astype(str))+return cluster_points, umap_reducediff --git a/examples/third_party/nvidia/nims.py b/examples/third_party/nvidia/nims.pyindex 761a0027d2..35e27448cf 100644--- a/examples/third_party/nvidia/nims.py+++ b/examples/third_party/nvidia/nims.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/plotly/area_chart.py b/examples/third_party/plotly/area_chart.pyindex 3b667471ae..8ef321a327 100644--- a/examples/third_party/plotly/area_chart.py+++ b/examples/third_party/plotly/area_chart.py@@ -9,13 +9,14 @@import marimo-__generated_with = "0.19.0"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -36,6 +37,7 @@ def _(mo):def _():import plotly.graph_objects as goimport pandas as pd+return go, pddiff --git a/examples/third_party/plotly/bar_chart.py b/examples/third_party/plotly/bar_chart.pyindex b0d120c759..b236a89378 100644--- a/examples/third_party/plotly/bar_chart.py+++ b/examples/third_party/plotly/bar_chart.py@@ -5,9 +5,10 @@# "plotly==6.5.1",# ]# ///+import marimo-__generated_with = "0.18.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -15,11 +16,12 @@ app = marimo.App(width="medium")def _():import marimo as moimport plotly.graph_objects as go+return go, mo@app.cell-def _(go, mo):+def _(mo):mo.md("""# Plotly Bar Chart Selection@@ -50,8 +52,7 @@ def _(go, mo):# Wrap with mo.ui.plotly to make it reactivebar_chart = mo.ui.plotly(fig_simple)-- return bar_chart, fig_simple+ return (bar_chart,)@app.cell@@ -103,12 +104,11 @@ def _(go, mo):)stacked_chart = mo.ui.plotly(fig_stacked)-- return fig_stacked, stacked_chart+ return (stacked_chart,)@app.cell-def _(stacked_chart, mo):+def _(mo, stacked_chart):mo.md(f"""### Stacked Bar Chart@@ -156,8 +156,7 @@ def _(go, mo):)grouped_chart = mo.ui.plotly(fig_grouped)-- return fig_grouped, grouped_chart+ return (grouped_chart,)@app.cell@@ -199,8 +198,7 @@ def _(go, mo):)horizontal_chart = mo.ui.plotly(fig_horizontal)-- return fig_horizontal, horizontal_chart+ return (horizontal_chart,)@app.celldiff --git a/examples/third_party/plotly/image_selection.py b/examples/third_party/plotly/image_selection.pyindex 2b1105a308..4dbc831545 100644--- a/examples/third_party/plotly/image_selection.py+++ b/examples/third_party/plotly/image_selection.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -20,6 +20,7 @@ def _():import plotly.graph_objects as goimport plotly.express as pxfrom skimage import io+return go, io, mo, pxdiff --git a/examples/third_party/plotly/line_chart.py b/examples/third_party/plotly/line_chart.pyindex d677a872fa..542e3cefa4 100644--- a/examples/third_party/plotly/line_chart.py+++ b/examples/third_party/plotly/line_chart.py@@ -9,13 +9,14 @@import marimo-__generated_with = "0.18.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -34,6 +35,7 @@ def _(mo):def _():import plotly.graph_objects as goimport pandas as pd+return go, pddiff --git a/examples/third_party/plotly/mapbox.py b/examples/third_party/plotly/mapbox.pyindex e6e20056e2..86a4ac0a63 100644--- a/examples/third_party/plotly/mapbox.py+++ b/examples/third_party/plotly/mapbox.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -75,6 +75,7 @@ def _(px, us_cities):map.update_layout(mapbox_style="open-street-map")map.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})return map+return (get_map,)@@ -95,6 +96,7 @@ def _():import plotly.express as pximport marimo as mo+return mo, pd, pxdiff --git a/examples/third_party/plotly/scatter_map.py b/examples/third_party/plotly/scatter_map.pyindex 76ce720c63..73bdfe94d1 100644--- a/examples/third_party/plotly/scatter_map.py+++ b/examples/third_party/plotly/scatter_map.py@@ -9,13 +9,14 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(width="full")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/polars/polars_example.py b/examples/third_party/polars/polars_example.pyindex d4082f088b..52df18be91 100644--- a/examples/third_party/polars/polars_example.py+++ b/examples/third_party/polars/polars_example.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -30,6 +30,7 @@ def _():import polars as plimport numpy as npimport altair as alt+return alt, mo, pldiff --git a/examples/third_party/pygwalker/example.py b/examples/third_party/pygwalker/example.pyindex 3e7f0159fa..7310176661 100644--- a/examples/third_party/pygwalker/example.py+++ b/examples/third_party/pygwalker/example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -17,6 +17,7 @@ def _():import pygwalker as pygfrom vega_datasets import data+return data, pygdiff --git a/examples/third_party/pyiceberg/data_catalog.py b/examples/third_party/pyiceberg/data_catalog.pyindex 837e516f10..1982c14baf 100644--- a/examples/third_party/pyiceberg/data_catalog.py+++ b/examples/third_party/pyiceberg/data_catalog.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -17,6 +17,7 @@ app = marimo.App(width="medium")def _():import marimo as moimport os+return mo, osdiff --git a/examples/third_party/pymde/complete_graph.py b/examples/third_party/pymde/complete_graph.pyindex 6c8b855ff6..fa09d464e5 100644--- a/examples/third_party/pymde/complete_graph.py+++ b/examples/third_party/pymde/complete_graph.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -87,18 +87,21 @@ def _(pymde):)mde.embed(verbose=True)return mde.plot(edges=edges)+return (complete_graph,)@app.celldef _():import pymde+return (pymde,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/pymde/debugging_embeddings.py b/examples/third_party/pymde/debugging_embeddings.pyindex cfa1651eb1..0abaf26dd2 100644--- a/examples/third_party/pymde/debugging_embeddings.py+++ b/examples/third_party/pymde/debugging_embeddings.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -99,6 +99,7 @@ def _(functools, mnist, pymde):return pymde.preprocess.k_nearest_neighbors(mnist.data, k=n_neighbors, verbose=True)+return (knn,)@@ -203,6 +204,7 @@ def _(mnist, plt):axs[1][pair_index].set_yticks([])plt.tight_layout()return plt.gca()+return (plot_pairs,)@@ -221,6 +223,7 @@ def _():import torchimport marimo as mo+return functools, mo, plt, pymde, torchdiff --git a/examples/third_party/pymde/drawing_graphs.py b/examples/third_party/pymde/drawing_graphs.pyindex 6a26763271..4bc2401ee3 100644--- a/examples/third_party/pymde/drawing_graphs.py+++ b/examples/third_party/pymde/drawing_graphs.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -71,6 +71,7 @@ def _(complete_graph, mo, tree):"Binary tree": tree_tab,})+return (draw_graphs,)@@ -94,6 +95,7 @@ def _(functools, penalties, pymde):)mde.embed(verbose=False)return format_axis(mde.plot(edges=edges))+return (complete_graph,)@@ -124,6 +126,7 @@ def _(embedding_dim, functools, losses, pymde, torch):)mde.embed(snapshot_every=1, max_iter=20, verbose=False)return format_axis(mde.plot(edges=tree.edges))+return (tree,)@@ -146,6 +149,7 @@ def _():import numpy as npimport scipy.sparse as spimport torch+return functools, mo, pymde, torchdiff --git a/examples/third_party/pymde/embedding_numbers.py b/examples/third_party/pymde/embedding_numbers.pyindex 2f90f38389..bade49dc96 100644--- a/examples/third_party/pymde/embedding_numbers.py+++ b/examples/third_party/pymde/embedding_numbers.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -129,6 +129,7 @@ def _(mnist, mo, pymde, torch):value = (mde, X)embedding_cache[key] = valuereturn value+return (compute_embedding,)@@ -151,6 +152,7 @@ def _(mnist, plt, torch):ax.set_xticks([])plt.tight_layout()return fig+return (show_random_images,)@@ -161,6 +163,7 @@ def _():import torchimport marimo as mo+return mo, plt, pymde, torchdiff --git a/examples/third_party/pymde/google_scholar.py b/examples/third_party/pymde/google_scholar.pyindex 3a1c636544..5e915c3802 100644--- a/examples/third_party/pymde/google_scholar.py+++ b/examples/third_party/pymde/google_scholar.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -33,6 +33,7 @@ def _():import matplotlib.pyplot as pltimport numpy as npimport torch+return np, plt, pymde, torch@@ -157,6 +158,7 @@ def _(torch):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/pymde/interactive_cluster_analysis.py b/examples/third_party/pymde/interactive_cluster_analysis.pyindex 152a5246a7..37a2e14aeb 100644--- a/examples/third_party/pymde/interactive_cluster_analysis.py+++ b/examples/third_party/pymde/interactive_cluster_analysis.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -127,6 +127,7 @@ def _(functools, mnist, mo, pymde, torch):X = mde.embed(verbose=True)mo.output.clear()return X+return (compute_embedding,)@@ -154,6 +155,7 @@ def _(mnist, plt):axes.set_xticks([])plt.tight_layout()return fig+return (show_images,)@@ -166,18 +168,21 @@ def _():import torchimport marimo as mo+return functools, mo, plt, pymde, torch@app.celldef _():import altair as alt+return (alt,)@app.celldef _():import pandas as pd+return (pd,)diff --git a/examples/third_party/pymde/rotational_invariance.py b/examples/third_party/pymde/rotational_invariance.pyindex 48aea1471f..84af364635 100644--- a/examples/third_party/pymde/rotational_invariance.py+++ b/examples/third_party/pymde/rotational_invariance.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@@ -22,18 +22,21 @@ def _(mo):@app.celldef _():import pymde+return (pymde,)@app.celldef _():import matplotlib.pyplot as plt+return (plt,)@app.celldef _():import marimo as mo+return (mo,)@@ -105,6 +108,7 @@ def _(embedding, mnist, plt, pymde):)plt.tight_layout()return rotated_embedding, ax+return (rotate_embedding,)diff --git a/examples/third_party/pymde/tree.py b/examples/third_party/pymde/tree.pyindex 4aafb92ebe..d0ee2b0d2a 100644--- a/examples/third_party/pymde/tree.py+++ b/examples/third_party/pymde/tree.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@@ -69,6 +69,7 @@ def _(functools, pymde, torch):stack.append(c2)tree = pymde.Graph.from_edges(torch.tensor(edges))return tree, pymde.preprocess.graph.shortest_paths(tree)+return (make_graph,)@@ -85,6 +86,7 @@ def _(functools, pymde):),)return mde.embed(verbose=True)+return (embed,)@@ -96,6 +98,7 @@ def _():import torchimport marimo as mo+return functools, mo, pymde, torchdiff --git a/examples/third_party/pymde/us_counties.py b/examples/third_party/pymde/us_counties.pyindex 86944db24a..690b9dfbc5 100644--- a/examples/third_party/pymde/us_counties.py+++ b/examples/third_party/pymde/us_counties.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -40,6 +40,7 @@ def _(mo):@app.celldef _():import pymde+return (pymde,)@@ -164,24 +165,28 @@ def _(mo, plot):@app.celldef _():import matplotlib.pyplot as plt+return@app.celldef _():import pandas as pd+return (pd,)@app.celldef _():import altair as alt+return (alt,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/sage/chat_with_github_repo.py b/examples/third_party/sage/chat_with_github_repo.pyindex efc381aacc..f1753cfab5 100644--- a/examples/third_party/sage/chat_with_github_repo.py+++ b/examples/third_party/sage/chat_with_github_repo.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@@ -123,6 +124,7 @@ def _(history_aware_retriever, question_answer_chain)return rag_chain+return (build_rag_chain,)@@ -218,6 +220,7 @@ def _(AIMessage, HumanMessage, args, build_rag_chain, logging, mo):logging.info(f"Query rewrite: {query_rewrite}")response += chunkyield mo.md(response)+return (predict,)diff --git a/examples/third_party/substrate/video_generation.py b/examples/third_party/substrate/video_generation.pyindex 4c22339fcd..d0225552ce 100644--- a/examples/third_party/substrate/video_generation.py+++ b/examples/third_party/substrate/video_generation.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/third_party/unsloth/llama_3_1_8b_2x_faster_finetuning.py b/examples/third_party/unsloth/llama_3_1_8b_2x_faster_finetuning.pyindex 8dda3bd2a9..45e8a548b6 100644--- a/examples/third_party/unsloth/llama_3_1_8b_2x_faster_finetuning.py+++ b/examples/third_party/unsloth/llama_3_1_8b_2x_faster_finetuning.py@@ -14,13 +14,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="full")@app.celldef _():import marimo as mo+return (mo,)@@ -30,6 +31,7 @@ def _():from transformers import TextStreamerimport torch+return FastLanguageModel, torchdiff --git a/examples/ui/array_element.py b/examples/ui/array_element.pyindex b9079fe281..474a0d5731 100644--- a/examples/ui/array_element.py+++ b/examples/ui/array_element.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/arrays_and_dicts.py b/examples/ui/arrays_and_dicts.pyindex e9fbac95af..efd6f0a889 100644--- a/examples/ui/arrays_and_dicts.py+++ b/examples/ui/arrays_and_dicts.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -15,6 +15,7 @@ app = marimo.App()def _():import marimo as moimport random+return mo, randomdiff --git a/examples/ui/batch.py b/examples/ui/batch.pyindex eea93de73b..69229e1dbe 100644--- a/examples/ui/batch.py+++ b/examples/ui/batch.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/batch_and_form.py b/examples/ui/batch_and_form.pyindex 33454291d2..e4a8428125 100644--- a/examples/ui/batch_and_form.py+++ b/examples/ui/batch_and_form.py@@ -7,13 +7,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/button.py b/examples/ui/button.pyindex ded421debb..95b20e2d03 100644--- a/examples/ui/button.py+++ b/examples/ui/button.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/chat.py b/examples/ui/chat.pyindex b45c813db2..19a99d9581 100644--- a/examples/ui/chat.py+++ b/examples/ui/chat.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/checkbox.py b/examples/ui/checkbox.pyindex 7bfbfe090c..9075a6b119 100644--- a/examples/ui/checkbox.py+++ b/examples/ui/checkbox.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/code_editor.py b/examples/ui/code_editor.pyindex fbdf7c2187..111949e2f9 100644--- a/examples/ui/code_editor.py+++ b/examples/ui/code_editor.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/data_editor.py b/examples/ui/data_editor.pyindex a459cfc9c8..2d61c4e366 100644--- a/examples/ui/data_editor.py+++ b/examples/ui/data_editor.py@@ -1,18 +1,20 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():import os+return (os,)diff --git a/examples/ui/data_explorer.py b/examples/ui/data_explorer.pyindex 35a2265949..79bdf3776d 100644--- a/examples/ui/data_explorer.py+++ b/examples/ui/data_explorer.py@@ -8,19 +8,21 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():from vega_datasets import data+return (data,)diff --git a/examples/ui/dataframe.py b/examples/ui/dataframe.pyindex de4f1462b6..c8c978f157 100644--- a/examples/ui/dataframe.py+++ b/examples/ui/dataframe.py@@ -8,19 +8,21 @@import marimo-__generated_with = "0.18.3"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)@app.celldef _():from vega_datasets import data+return (data,)diff --git a/examples/ui/date.py b/examples/ui/date.pyindex b5e53c11ba..857ed738e2 100644--- a/examples/ui/date.py+++ b/examples/ui/date.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/date_range.py b/examples/ui/date_range.pyindex eafe4c5f20..789ec0ad91 100644--- a/examples/ui/date_range.py+++ b/examples/ui/date_range.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/datetime_input.py b/examples/ui/datetime_input.pyindex a8d8c4ef18..8c011b9faa 100644--- a/examples/ui/datetime_input.py+++ b/examples/ui/datetime_input.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/dictionary.py b/examples/ui/dictionary.pyindex 00b355c313..68e3305ac4 100644--- a/examples/ui/dictionary.py+++ b/examples/ui/dictionary.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/download.py b/examples/ui/download.pyindex 93c1d25e3f..9f98d166b2 100644--- a/examples/ui/download.py+++ b/examples/ui/download.py@@ -8,13 +8,14 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@@ -110,6 +111,7 @@ def _(json, mo, pd):def _():import pandas as pdimport json+return json, pddiff --git a/examples/ui/dropdown.py b/examples/ui/dropdown.pyindex 0de2598de8..f22739b207 100644--- a/examples/ui/dropdown.py+++ b/examples/ui/dropdown.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/file.py b/examples/ui/file.pyindex 9c0484ef5c..51c9113825 100644--- a/examples/ui/file.py+++ b/examples/ui/file.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/file_browser.py b/examples/ui/file_browser.pyindex a7db341aa4..23961aec91 100644--- a/examples/ui/file_browser.py+++ b/examples/ui/file_browser.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/form.py b/examples/ui/form.pyindex 2098af1ef8..208f275b98 100644--- a/examples/ui/form.py+++ b/examples/ui/form.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/image_comparison_demo.py b/examples/ui/image_comparison_demo.pyindex 88daa56a96..2b2a8178bd 100644--- a/examples/ui/image_comparison_demo.py+++ b/examples/ui/image_comparison_demo.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -87,6 +87,7 @@ def _(after_image_path, before_image_path, mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/layout.py b/examples/ui/layout.pyindex bc7b15084c..fedc4e1c0b 100644--- a/examples/ui/layout.py+++ b/examples/ui/layout.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -106,6 +106,7 @@ def _(mo, size):@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/microphone.py b/examples/ui/microphone.pyindex 9ed2a0d104..ae80da5feb 100644--- a/examples/ui/microphone.py+++ b/examples/ui/microphone.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/multiselect.py b/examples/ui/multiselect.pyindex 02cea7b174..c46fb75179 100644--- a/examples/ui/multiselect.py+++ b/examples/ui/multiselect.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/number.py b/examples/ui/number.pyindex f4ef8df9fe..95d62ede69 100644--- a/examples/ui/number.py+++ b/examples/ui/number.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/radio.py b/examples/ui/radio.pyindex e881915e7d..530cdd640c 100644--- a/examples/ui/radio.py+++ b/examples/ui/radio.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/range_slider.py b/examples/ui/range_slider.pyindex 90bfaf1b6e..090df27fdf 100644--- a/examples/ui/range_slider.py+++ b/examples/ui/range_slider.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/refresh.py b/examples/ui/refresh.pyindex 6339fe035f..eb8b08848a 100644--- a/examples/ui/refresh.py+++ b/examples/ui/refresh.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/run_button.py b/examples/ui/run_button.pyindex fdb98cfb0c..8851802b18 100644--- a/examples/ui/run_button.py+++ b/examples/ui/run_button.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/slider.py b/examples/ui/slider.pyindex 9950553056..38c7338a13 100644--- a/examples/ui/slider.py+++ b/examples/ui/slider.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App(width="medium")@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/switch.py b/examples/ui/switch.pyindex 66bc31b42c..25eb9594f9 100644--- a/examples/ui/switch.py+++ b/examples/ui/switch.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/table.py b/examples/ui/table.pyindex a1eedecf37..5553310c7c 100644--- a/examples/ui/table.py+++ b/examples/ui/table.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.17.0"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/table_advanced.py b/examples/ui/table_advanced.pyindex 0733b5d0e5..0d8e76f5dd 100644--- a/examples/ui/table_advanced.py+++ b/examples/ui/table_advanced.py@@ -7,13 +7,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/tabs.py b/examples/ui/tabs.pyindex 79f88b1c4b..9b4cd5ddfd 100644--- a/examples/ui/tabs.py+++ b/examples/ui/tabs.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/tabs_advanced.py b/examples/ui/tabs_advanced.pyindex 82ff6b362e..846c702bcd 100644--- a/examples/ui/tabs_advanced.py+++ b/examples/ui/tabs_advanced.py@@ -7,13 +7,14 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/text.py b/examples/ui/text.pyindex 5bf193c186..1818602623 100644--- a/examples/ui/text.py+++ b/examples/ui/text.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/examples/ui/text_area.py b/examples/ui/text_area.pyindex 8ffd9beca8..71f7312dd2 100644--- a/examples/ui/text_area.py+++ b/examples/ui/text_area.py@@ -1,12 +1,13 @@import marimo-__generated_with = "0.15.5"+__generated_with = "0.19.7"app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/marimo/_ast/codegen.py b/marimo/_ast/codegen.pyindex 0f44ce7c96..b5065ea7e4 100644--- a/marimo/_ast/codegen.py+++ b/marimo/_ast/codegen.py@@ -122,6 +122,33 @@ def format_tuple_elements(return maybe_indent(code.replace("(...)", multiline_tuple))+def _needs_trailing_blank_line(mod: ast.Module, code: str) -> bool:+ """Check if AST ends with a statement requiring a blank line after.++ Ruff formatter adds a blank line after imports, function defs, and class defs.+ Only adds blank line if the statement is truly the last content (no trailing+ comments).+ """+ if not mod.body:+ return False+ last_stmt = mod.body[-1]+ if not isinstance(+ last_stmt,+ (+ ast.Import,+ ast.ImportFrom,+ ast.FunctionDef,+ ast.AsyncFunctionDef,+ ast.ClassDef,+ ),+ ):+ return False+ # Check if there's trailing content (like comments) after the last statement+ # If so, don't add a blank line - the existing formatting should be preserved+ code_lines = code.rstrip().count("\n") + 1+ return last_stmt.end_lineno == code_lines++def to_decorator(config: Optional[CellConfig],fn: Decorators = "cell",@@ -335,6 +362,10 @@ def to_functiondef(# 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/_tutorials/dataflow.py b/marimo/_tutorials/dataflow.pyindex d094da9800..3e54ec9cf9 100644--- a/marimo/_tutorials/dataflow.py+++ b/marimo/_tutorials/dataflow.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -494,6 +494,7 @@ def _(mo):def _():import matplotlib.pyplot as pltimport numpy as np+return np, plt@@ -602,6 +603,7 @@ def _():@app.celldef _():import marimo as mo+return (mo,)diff --git a/marimo/_tutorials/fileformat.py b/marimo/_tutorials/fileformat.pyindex 7bf8fffbd8..ad8c416edd 100644--- a/marimo/_tutorials/fileformat.py+++ b/marimo/_tutorials/fileformat.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()with app.setup:@@ -13,6 +13,7 @@ with app.setup:@app.celldef _():import marimo as mo+return (mo,)@@ -393,6 +394,7 @@ def wrapped_function_example(variable):bottom-right corner indicates this."""return variable+returndiff --git a/marimo/_tutorials/for_jupyter_users.py b/marimo/_tutorials/for_jupyter_users.pyindex 17eb06c565..381e6510f9 100644--- a/marimo/_tutorials/for_jupyter_users.py+++ b/marimo/_tutorials/for_jupyter_users.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App(app_title="marimo for Jupyter users")@@ -88,6 +88,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/marimo/_tutorials/layout.py b/marimo/_tutorials/layout.pyindex 706f2499d2..c815d06706 100644--- a/marimo/_tutorials/layout.py+++ b/marimo/_tutorials/layout.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -337,6 +337,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/marimo/_tutorials/markdown.py b/marimo/_tutorials/markdown.pyindex 451fbc80c7..2074a5c3a0 100644--- a/marimo/_tutorials/markdown.py+++ b/marimo/_tutorials/markdown.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.17.2"+__generated_with = "0.19.7"app = marimo.App()@@ -284,6 +284,7 @@ def _(mo, np, plt):plt.plot(x, amplitude * np.sin(2 * np.pi / period * x))plt.ylim(-2.2, 2.2)return plt.gca()+return (plotsin,)@@ -321,6 +322,7 @@ def _(amplitude, mo, period, plotsin):def _():import matplotlib.pyplot as pltimport numpy as np+return np, plt@@ -329,6 +331,7 @@ def _():import mathimport marimo as mo+return math, modiff --git a/marimo/_tutorials/plots.py b/marimo/_tutorials/plots.pyindex ba6d05ba43..69e88f7600 100644--- a/marimo/_tutorials/plots.py+++ b/marimo/_tutorials/plots.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -182,6 +182,7 @@ def _(mo, plt, x):def plot_power(exponent):plt.plot(x, x**exponent)return plt.gca()+return (plot_power,)@@ -253,6 +254,7 @@ def _(missing_packages, mo):def check_dependencies():if missing_packages:return module_not_found_explainer+return (check_dependencies,)@@ -286,6 +288,7 @@ def _():@app.celldef _():import marimo as mo+return (mo,)diff --git a/marimo/_tutorials/sql.py b/marimo/_tutorials/sql.pyindex 7fe4c5cf56..1d79b39c23 100644--- a/marimo/_tutorials/sql.py+++ b/marimo/_tutorials/sql.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.18.4"+__generated_with = "0.19.7"app = marimo.App(width="medium")@@ -343,6 +343,7 @@ def _(mo, result, token_prefix):import plotly.graph_objects as goreturn go.Figure(data=[go.Histogram(x=result["count"])])+return (render_chart,)@@ -438,12 +439,14 @@ def _(filtered_cars, mo):def _():import marimo as moimport random+return (mo,)@app.cell(hide_code=True)def _():import string+return (string,)diff --git a/marimo/_tutorials/ui.py b/marimo/_tutorials/ui.pyindex 1658dd2864..bd30cbb09f 100644--- a/marimo/_tutorials/ui.py+++ b/marimo/_tutorials/ui.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.19.7"app = marimo.App()@@ -479,6 +479,7 @@ def _(mo):elif value == mo.ui.text_area:return mo.ui.text_area()return None+return (construct_element,)@@ -487,6 +488,7 @@ def _(mo):def show_element(element):if element is not None:return mo.hstack([element], justify="center")+return (show_element,)@@ -504,6 +506,7 @@ def _(mo):The element's current value is {mo.as_html(element.value)}""")+return (value,)@@ -518,12 +521,14 @@ def _(mo):)})+return (documentation,)@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_ast/codegen_data/_test_parse_error_in_notebook.py b/tests/_ast/codegen_data/_test_parse_error_in_notebook.pyindex 2a857d072d..7b71d21fc2 100644--- a/tests/_ast/codegen_data/_test_parse_error_in_notebook.py+++ b/tests/_ast/codegen_data/_test_parse_error_in_notebook.py@@ -15,6 +15,7 @@ def _(mo):@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_ast/codegen_data/test_generate_filecontents.py b/tests/_ast/codegen_data/test_generate_filecontents.pyindex 5c22f50250..2b1f6d7fd4 100644--- a/tests/_ast/codegen_data/test_generate_filecontents.py+++ b/tests/_ast/codegen_data/test_generate_filecontents.py@@ -7,6 +7,7 @@ app = marimo.App()@app.celldef one():import numpy as np+return (np,)diff --git a/tests/_ast/codegen_data/test_generate_filecontents_async.py b/tests/_ast/codegen_data/test_generate_filecontents_async.pyindex 9b325a3bc0..314da0ceb8 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_async.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_async.py@@ -8,6 +8,7 @@ app = marimo.App()def one():import numpy as npimport asyncio+return (asyncio,)@@ -23,6 +24,7 @@ async def two(asyncio):def three(asyncio, x):async def _():await asyncio.sleep(x)+returndiff --git a/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py b/tests/_ast/codegen_data/test_generate_filecontents_single_cell.pyindex c31ea72399..fbc0ccb959 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_single_cell.py@@ -7,6 +7,7 @@ app = marimo.App()@app.celldef one():import numpy as np+returndiff --git a/tests/_ast/codegen_data/test_generate_filecontents_toplevel.py b/tests/_ast/codegen_data/test_generate_filecontents_toplevel.pyindex 48a6c9f037..c614f1f4fe 100644--- a/tests/_ast/codegen_data/test_generate_filecontents_toplevel.py+++ b/tests/_ast/codegen_data/test_generate_filecontents_toplevel.py@@ -46,6 +46,7 @@ def shadow_case(shadow):def _(shadow):def reference_case():return shadow+return@@ -54,6 +55,7 @@ def _(globe):def global_case():global globereturn globe+returndiff --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 c8150626a8..575e5d4340 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@@ -7,6 +7,7 @@ app = marimo.App()@app.celldef one():import numpy as np+returndiff --git a/tests/_ast/test_codegen.py b/tests/_ast/test_codegen.pyindex 2d1e3cfb06..5a25ce1a16 100644--- a/tests/_ast/test_codegen.py+++ b/tests/_ast/test_codegen.py@@ -1568,6 +1568,120 @@ def test_format_tuple_elements() -> None:)+ ("code", "expected"),+ [+ # Imports - need blank line+ ("import os", True),+ ("from os import path", True),+ ("from module import (\n a,\n b,\n)", True),+ ("from module import (\n a,\n b,\n) # inline comment", True),+ # Multiline import with trailing comment on new line - NO blank line+ ("from module import (\n a,\n b,\n)\n# trailing comment", False),+ # Function/class defs - need blank line+ ("def foo():\n pass", True),+ ("async def foo():\n pass", True),+ ("class Foo:\n pass", True),+ # Trailing whitespace still needs blank line+ ("import os\n ", True),+ # Trailing comment on next line - NO blank line+ ("def foo():\n pass\n# comment", False),+ ("import os\n# comment", False),+ # Regular statements - NO blank line+ ("x = 1", False),+ ("if True:\n pass", False),+ # Import followed by other statement - NO blank line+ ("import os\nx = 1", False),+ # Empty code - NO blank line+ ("", False),+ ],+ ids=[+ "import",+ "from_import",+ "multiline_import",+ "multiline_import_inline_comment",+ "multiline_import_trailing_comment",+ "function_def",+ "async_function_def",+ "class_def",+ "trailing_whitespace",+ "function_trailing_comment",+ "import_trailing_comment",+ "assignment",+ "if_statement",+ "import_then_assignment",+ "empty",+ ],+)+def test_needs_trailing_blank_line(code: str, expected: bool) -> None:+ """Test _needs_trailing_blank_line for ruff compatibility.++ Ruff adds a blank line after imports, function defs, and class defs,+ but NOT when there's trailing content like comments on a new line.+ Inline comments (same line) are ignored by ruff.+ """+ from marimo._ast.codegen import _needs_trailing_blank_line+ from marimo._ast.parse import ast_parse++ assert _needs_trailing_blank_line(ast_parse(code), code) is expected+++ ("code", "expected_pattern", "unexpected_pattern"),+ [+ # Import only - blank line before return+ (+ "import datetime",+ " import datetime\n\n return",+ None,+ ),+ # Import then assignment - no blank line+ (+ "import datetime\nx = 1",+ " import datetime\n x = 1\n return",+ None,+ ),+ # Function def - blank line before return+ (+ "def foo():\n return x",+ " return x\n\n return",+ None,+ ),+ # Function def with trailing comment - no extra blank line+ (+ "def foo():\n pass\n# comment",+ " # comment\n return",+ " # comment\n\n return",+ ),+ # Multiline import - blank line before return+ (+ "from module import (\n a,\n b,\n)",+ " )\n\n return",+ None,+ ),+ ],+ ids=[+ "import_only",+ "import_then_assignment",+ "function_def",+ "function_trailing_comment",+ "multiline_import",+ ],+)+def test_ruff_blank_line_in_generated_code(+ code: str, expected_pattern: str, unexpected_pattern: Optional[str]+) -> None:+ """Test that generated code has blank lines where ruff expects them."""+ result = codegen.generate_filecontents(+ codes=[code],+ names=["_"],+ cell_configs=[CellConfig()],+ )+ assert expected_pattern in result+ if unexpected_pattern:+ assert unexpected_pattern not in result++CODE_CLASS = """class MyClass:def method_one(self):@@ -1790,6 +1904,7 @@ def _():@some_decorator(param=True)def my_decorated_function():return "decorated"+return@@ -1818,6 +1933,7 @@ def some_decorator(param):def _():class Config:setting = Dependency()+return@@ -1843,6 +1959,7 @@ def _():class Processor:def process(self, data: Data) -> Result:return Result()+return@@ -1893,6 +2010,7 @@ def _():class Child(Parent):def child_method(self):pass+return@@ -1997,6 +2115,7 @@ def process(formatter=default_formatter()):def _():def process(formatter=default_formatter()):return formatter+returndiff --git a/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt b/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txtindex 1e144702f6..4b27cf5467 100644--- a/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_comments_preservation.py.txt@@ -6,6 +6,7 @@ app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt b/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txtindex 1fb40fa708..277646b09f 100644--- a/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_hides_markdown_cells.py.txt@@ -6,6 +6,7 @@ app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt b/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txtindex 0d787a2b8b..9fc2e05d5f 100644--- a/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt+++ b/tests/_convert/ipynb/snapshots/converted_pip_commands.py.txt@@ -10,6 +10,7 @@ app = marimo.App()@app.celldef _():import subprocess+return (subprocess,)diff --git a/tests/_convert/markdown/snapshots/unsafe-app.py.txt b/tests/_convert/markdown/snapshots/unsafe-app.py.txtindex f7d802f6f5..d0e42e9d12 100644--- a/tests/_convert/markdown/snapshots/unsafe-app.py.txt+++ b/tests/_convert/markdown/snapshots/unsafe-app.py.txt@@ -7,6 +7,7 @@ app = marimo.App(app_title="Test Notebook")@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt b/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txtindex 67965ec315..18a76645eb 100644--- a/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt+++ b/tests/_convert/snapshots/basic_marimo_example_roundtrip.py.txt@@ -28,6 +28,7 @@ def _(x):@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_convert/snapshots/pypercent_format.py.txt b/tests/_convert/snapshots/pypercent_format.py.txtindex 85f6d7e41d..09ba7831b1 100644--- a/tests/_convert/snapshots/pypercent_format.py.txt+++ b/tests/_convert/snapshots/pypercent_format.py.txt@@ -7,6 +7,7 @@ app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)@@ -15,6 +16,7 @@ def _():"""Pypercent format notebook."""import numpy as np+return (np,)diff --git a/tests/_convert/snapshots/pypercent_markdown_only.py.txt b/tests/_convert/snapshots/pypercent_markdown_only.py.txtindex b22ba22e4a..ebe97f5c3a 100644--- a/tests/_convert/snapshots/pypercent_markdown_only.py.txt+++ b/tests/_convert/snapshots/pypercent_markdown_only.py.txt@@ -7,6 +7,7 @@ app = marimo.App()@app.celldef _():import marimo as mo+return (mo,)diff --git a/tests/_convert/snapshots/pypercent_with_main.py.txt b/tests/_convert/snapshots/pypercent_with_main.py.txtindex 3cb60e3dff..9ab1eb95ab 100644--- a/tests/_convert/snapshots/pypercent_with_main.py.txt+++ b/tests/_convert/snapshots/pypercent_with_main.py.txt@@ -13,6 +13,7 @@ def _():@app.celldef _():import sys+return (sys,)diff --git a/tests/_server/test_file_manager.py b/tests/_server/test_file_manager.pyindex 4034ee96fc..b859089a34 100644--- a/tests/_server/test_file_manager.py+++ b/tests/_server/test_file_manager.py@@ -297,6 +297,7 @@ def test_to_code(app_file_manager: AppFileManager) -> None:"@app.cell","def _():"," import marimo as mo",+ ""," return","","",