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
tidy: refresh example notebooks (#6378)
Dylan Madisetti14f8906b3a85
diff --git a/examples/ai/chat/anthropic_example.py b/examples/ai/chat/anthropic_example.pyindex 794f76824e..a354883adc 100644--- a/examples/ai/chat/anthropic_example.py+++ b/examples/ai/chat/anthropic_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ai/chat/bedrock_example.py b/examples/ai/chat/bedrock_example.pyindex 3fe235da3a..e18f33e936 100644--- a/examples/ai/chat/bedrock_example.py+++ b/examples/ai/chat/bedrock_example.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ai/chat/custom.py b/examples/ai/chat/custom.pyindex e9516a3659..c87ba5ed46 100644--- a/examples/ai/chat/custom.py+++ b/examples/ai/chat/custom.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.22"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Custom chatbot@@ -32,7 +32,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):def simple_echo_model(messages, config):"""This chatbot echoes what the user says."""# messages is a list of chatbot messages@@ -48,17 +48,17 @@ def __(mo):show_configuration_controls=False)chatbot- return chatbot, simple_echo_model+ return (chatbot,)@app.cell-def __(mo):+def _(mo):mo.md("""Access the chatbot's historical messages with `chatbot.value`.""")return@app.cell-def __(chatbot):+def _(chatbot):# chatbot.value is the list of chat messageschatbot.valuereturndiff --git a/examples/ai/chat/dagger_code_interpreter.py b/examples/ai/chat/dagger_code_interpreter.pyindex 20dc97f961..2b86ce9d75 100644--- a/examples/ai/chat/dagger_code_interpreter.py+++ b/examples/ai/chat/dagger_code_interpreter.py@@ -11,20 +11,20 @@import marimo-__generated_with = "0.9.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __():+def _():import marimo as moimport ellimport textwrap- return ell, mo, textwrap+ return ell, mo@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Chatbot code-interpreter with [Dagger](https://dagger.io/)@@ -38,14 +38,14 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):backend = mo.ui.dropdown(["ollama", "openai"], label="Backend", value="openai")backendreturn (backend,)@app.cell(hide_code=True)-def __(mo):+def _(mo):# OpenAI configimport osimport openai@@ -56,11 +56,11 @@ def __(mo):value=os.environ.get("OPENAI_API_KEY", ""),)input_key- return input_key, openai, os+ return (input_key,)@app.cell(hide_code=True)-def __(backend, input_key, mo):+def _(backend, input_key, mo):def _get_open_ai_client():openai_key = input_key.value@@ -95,33 +95,33 @@ def __(backend, input_key, mo):@app.cell-def __():+def _():import daggerreturn (dagger,)@app.cell-def __(mo):+def _(mo):files = mo.ui.file(kind="area")filesreturn (files,)@app.cell-def __(mo):+def _(mo):packages = mo.ui.text_area(label="Packages", value="pandas")packagesreturn (packages,)@app.cell-def __(files):+def _(files):[file.name for file in files.value]return@app.cell-def __(dagger, ell, files, mo, packages):+def _(dagger, ell, files, mo, packages):@ell.tool()async def execute_code(code: str):"""@@ -156,30 +156,19 @@ def __(dagger, ell, files, mo, packages):return (execute_code,)[email protected](hide_code=True)-def __():- def describe_file(file):- if file.name.endswith(".py"):- return f"Python file: {file.name}"- if file.name.endswith(".txt"):- return f"Text file: {file.name}"- if file.name.endswith(".csv"):- return f"CSV file: {file.name}. Headers: {file.contents.decode('utf-8').splitlines()[0]}"- return f"File: {file.name}"- return (describe_file,)[email protected](hide_code=True)+def describe_file(file):+ if file.name.endswith(".py"):+ return f"Python file: {file.name}"+ if file.name.endswith(".txt"):+ return f"Text file: {file.name}"+ if file.name.endswith(".csv"):+ return f"CSV file: {file.name}. Headers: {file.contents.decode('utf-8').splitlines()[0]}"+ return f"File: {file.name}"@app.cell-def __(- client,- describe_file,- ell,- execute_code,- files,- mo,- model,- packages,-):+def _(client, ell, execute_code, files, mo, model, packages):files_instructions = ""packages_instructions = ""if files.value:@@ -222,11 +211,11 @@ def __(if response.tool_calls:return response.tool_calls[0]()return mo.md(response.text)- return custom_chatbot, files_instructions, my_model, packages_instructions+ return (my_model,)@app.cell-def __(mo, my_model):+def _(mo, my_model):mo.ui.chat(my_model,prompts=[diff --git a/examples/ai/chat/deepseek_example.py b/examples/ai/chat/deepseek_example.pyindex 022b0cfebb..955e18462e 100644--- a/examples/ai/chat/deepseek_example.py+++ b/examples/ai/chat/deepseek_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.10.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -53,7 +53,7 @@ def _(mo):os_key = os.environ.get("DEEPSEEK_API_KEY")input_key = mo.ui.text(label="Deepseek API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.celldiff --git a/examples/ai/chat/gemini.py b/examples/ai/chat/gemini.pyindex e5618afdfd..9cce85561c 100644--- a/examples/ai/chat/gemini.py+++ b/examples/ai/chat/gemini.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.22"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""# Using Gemini@@ -30,29 +30,28 @@ def __(mo):@app.cell-def __(mo):+def _(mo):import osos_key = os.environ.get("GOOGLE_AI_API_KEY")input_key = mo.ui.text(label="Google AI API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.cell-def __(input_key, mo, os_key):+def _(input_key, mo, os_key):key = os_key or input_key.valuemo.stop(not key,mo.md("Please provide your Google AI API key in the input field."),)-return (key,)@app.cell-def __(key, mo):+def _(key, mo):chatbot = mo.ui.chat(mo.ai.llm.google("gemini-1.5-pro-latest",@@ -70,13 +69,13 @@ def __(key, mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")return@app.cell-def __(chatbot):+def _(chatbot):# chatbot.value is the list of chat messageschatbot.valuereturndiff --git a/examples/ai/chat/generative_ui.py b/examples/ai/chat/generative_ui.pyindex 48c500c392..97fd9bc05a 100644--- a/examples/ai/chat/generative_ui.py+++ b/examples/ai/chat/generative_ui.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import polars as plimport marimo as moimport os@@ -28,11 +28,11 @@ def __():# Grab a datasetdf = pl.read_csv("hf://datasets/scikit-learn/Fish/Fish.csv")- return df, has_api_key, mo, os, pl+ return df, mo@app.cell-def __(df, mo):+def _(df, mo):import ell@@ -66,7 +66,7 @@ def __(df, mo):@app.cell-def __(chart_data, df, ell, filter_dataset, mo):+def _(chart_data, df, ell, filter_dataset, mo):@ell.complex(model="gpt-4o", tools=[chart_data, filter_dataset])def analyze_dataset(prompt: str) -> str:"""You are a data scientist that can analyze a dataset"""@@ -88,7 +88,7 @@ def __(chart_data, df, ell, filter_dataset, mo):"What is the sum of {{column}}?",],)- return analyze_dataset, my_model+ returnif __name__ == "__main__":diff --git a/examples/ai/chat/groq_example.py b/examples/ai/chat/groq_example.pyindex 6b527a5527..a111d943a0 100644--- a/examples/ai/chat/groq_example.py+++ b/examples/ai/chat/groq_example.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Using Groq@@ -31,7 +31,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):# Hyperlinking the groq as it is mentioned here - https://console.groq.com/docs/badgemo.md(r"""@@ -48,17 +48,17 @@ def __(mo):@app.cell-def __(mo):+def _(mo):import osos_key = os.environ.get("GROQ_AI_API_KEY")input_key = mo.ui.text(label="Groq AI API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.cell-def __(input_key, mo, os_key):+def _(input_key, mo, os_key):key = os_key or input_key.valuemo.stop(@@ -69,7 +69,7 @@ def __(input_key, mo, os_key):@app.cell-def __(key, mo):+def _(key, mo):chatbot = mo.ui.chat(mo.ai.llm.groq(model="llama-3.1-70b-versatile",@@ -87,13 +87,13 @@ def __(key, mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")return@app.cell-def __(chatbot):+def _(chatbot):# chatbot.value is the list of chat messageschatbot.valuereturndiff --git a/examples/ai/chat/llm_datasette.py b/examples/ai/chat/llm_datasette.pyindex 3f81639308..8cb2c85c3e 100644--- a/examples/ai/chat/llm_datasette.py+++ b/examples/ai/chat/llm_datasette.py@@ -8,41 +8,41 @@import marimo-__generated_with = "0.9.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Using <https://llm.datasette.io> with `mo.ui.chat()`""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""To set a key, run: `llm keys set openai` in your terminal""")return@app.cell-def __():+def _():import marimo as moimport llmreturn llm, mo@app.cell-def __(llm, mo):+def _(llm, mo):model = llm.get_model("gpt-4o-mini")conversation = model.conversation()chat = mo.ui.chat(lambda messages: conversation.prompt(messages[-1].content))chat- return chat, conversation, model+ return (chat,)@app.cell-def __(chat):+def _(chat):chat.valuereturndiff --git a/examples/ai/chat/mlx_chat.py b/examples/ai/chat/mlx_chat.pyindex 6d970a0712..a89b212b95 100644--- a/examples/ai/chat/mlx_chat.py+++ b/examples/ai/chat/mlx_chat.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from mlx_lm import load, generatefrom pathlib import Pathimport marimo as mo@@ -23,7 +23,7 @@ def __():@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Using MLX with Marimo@@ -45,7 +45,7 @@ def __(mo):@app.cell-def __(Path, snapshot_download):+def _(Path, snapshot_download):def get_model_path(path_or_hf_repo: str) -> Path:"""Ensures the model is available locally. If the path does not exist locally,@@ -84,7 +84,7 @@ def __(Path, snapshot_download):@app.cell-def __(mo):+def _(mo):MODEL_ID = mo.ui.text(label="Hugging Face Model Repo or Local Path",value="mlx-community/Llama-3.2-3B-Instruct-bf16",@@ -99,7 +99,7 @@ def __(mo):@app.cell-def __(MODEL_ID, get_model_path, load, load_model_button, mo):+def _(MODEL_ID, get_model_path, load, load_model_button, mo):mo.stop(not load_model_button.value, "Click 'Load Model' to proceed")try:@@ -114,11 +114,11 @@ def __(MODEL_ID, get_model_path, load, load_model_button, mo):except Exception as e:mo.output.append(f"❌ Error loading model: {str(e)}")raise- return model, model_path, tokenizer+ return model, tokenizer@app.cell(hide_code=True)-def __(mo):+def _(mo):# Create a text area for the system messagesystem_message = mo.ui.text_area(value="You are a helpful AI assistant.",@@ -132,7 +132,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):temp_slider = mo.ui.slider(start=0.0, stop=2.0, step=0.1, value=0.7, label="Temperature Slider")@@ -143,15 +143,7 @@ def __(mo):@app.cell-def __(- generate,- max_tokens,- mo,- model,- system_message,- temp_slider,- tokenizer,-):+def _(generate, max_tokens, mo, model, system_message, temp_slider, tokenizer):def mlx_chat_model(messages, config):# Include the system message as the first messagechat_messages = [{"role": "system", "content": system_message.value}]@@ -197,17 +189,17 @@ def __(# Display the chatbotchatbot- return chatbot, mlx_chat_model+ return (chatbot,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Access the chatbot's historical messages with `chatbot.value`.""")return@app.cell-def __(chatbot):+def _(chatbot):# Display the chat historychatbot.valuereturndiff --git a/examples/ai/chat/openai_example.py b/examples/ai/chat/openai_example.pyindex 670d432460..90cd5540d9 100644--- a/examples/ai/chat/openai_example.py+++ b/examples/ai/chat/openai_example.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Using OpenAI@@ -31,17 +31,17 @@ def __(mo):@app.cell-def __(mo):+def _(mo):import osos_key = os.environ.get("OPENAI_API_KEY")input_key = mo.ui.text(label="OpenAI API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.cell-def __(input_key, mo, os_key):+def _(input_key, mo, os_key):openai_key = os_key or input_key.valuemo.stop(@@ -52,7 +52,7 @@ def __(input_key, mo, os_key):@app.cell-def __(mo, openai_key):+def _(mo, openai_key):chatbot = mo.ui.chat(mo.ai.llm.openai("gpt-4o",@@ -74,13 +74,13 @@ def __(mo, openai_key):@app.cell-def __(mo):+def _(mo):mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")return@app.cell-def __(chatbot):+def _(chatbot):# chatbot.value is the list of chat messageschatbot.valuereturndiff --git a/examples/ai/chat/recipe_bot.py b/examples/ai/chat/recipe_bot.pyindex 43c229e913..f36823c392 100644--- a/examples/ai/chat/recipe_bot.py+++ b/examples/ai/chat/recipe_bot.py@@ -5,14 +5,15 @@# "openai==1.53.0",# ]# ///+import marimo-__generated_with = "0.9.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mochat = mo.ui.chat(@@ -30,7 +31,7 @@ def __():@app.cell-def __(chat, mo):+def _(chat, mo):mo.stop(not chat.value)last_message: str = chat.value[-1].content@@ -39,7 +40,7 @@ def __(chat, mo):with open(f"{title}.md", "w") as f:f.write(summary)mo.status.toast("Receipt summary saved!", description=title)- return f, last_message, summary, title+ returnif __name__ == "__main__":diff --git a/examples/ai/chat/simplemind_example.py b/examples/ai/chat/simplemind_example.pyindex 42a529fa60..0333246b5a 100644--- a/examples/ai/chat/simplemind_example.py+++ b/examples/ai/chat/simplemind_example.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Using [simplemind](https://github.com/kennethreitz/simplemind) with `mo.ui.chat()`""")return@app.cell(hide_code=True)-def __():+def _():import marimo as moimport osimport simplemind as sm@@ -27,7 +27,7 @@ def __():@app.cell(hide_code=True)-def __(__file__, mo, os):+def _(mo, os):has_set_env = os.environ.get("OPENAI_API_KEY") is not Nonemo.md(f"""Missing OpenAI API key. Re-run this notebook with the following command:@@ -37,17 +37,17 @@ def __(__file__, mo, os):marimo edit {__file__}```""").callout("warn") if not has_set_env else ""- return (has_set_env,)+ return@app.cell-def __(mo):+def _(mo):get_logs, set_logs = mo.state([], allow_self_loops=True)return get_logs, set_logs@app.cell-def __(set_logs, sm):+def _(set_logs, sm):def add_log(value):return set_logs(lambda logs: logs + [value])@@ -71,11 +71,11 @@ def __(set_logs, sm):def post_send_hook(self, conversation, response):add_log(f"Received response: {response.text}")- return LoggingPlugin, add_log+ return (LoggingPlugin,)@app.cell-def __(LoggingPlugin, mo, sm):+def _(LoggingPlugin, mo, sm):conversation = sm.create_conversation(llm_model="gpt-4o", llm_provider="openai")@@ -88,22 +88,22 @@ def __(LoggingPlugin, mo, sm):chat = mo.ui.chat(on_message)- return chat, conversation, on_message+ return (chat,)@app.cell-def __(chat, get_logs, mo):+def _(chat, get_logs, mo):logs = list(reversed(get_logs()))mo.hstack([chat, mo.ui.table(logs, selection=None)],widths="equal",)- return (logs,)+ return@app.cell-def __(chat):+def _(chat):chat.valuereturndiff --git a/examples/ai/data/data_labeler.py b/examples/ai/data/data_labeler.pyindex 1abab7e77a..7b4a124e20 100644--- a/examples/ai/data/data_labeler.py+++ b/examples/ai/data/data_labeler.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.1.4"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("# Data Labeler")return@app.cell-def __(NUMBER_OF_EXAMPLES, mo):+def _(NUMBER_OF_EXAMPLES, mo):get_index, set_index = mo.state(0)@@ -25,7 +25,7 @@ def __(NUMBER_OF_EXAMPLES, mo):@app.cell-def __(decrement_index, increment_index, mo):+def _(decrement_index, increment_index, mo):next_button = mo.ui.button(label="next", on_change=lambda _: increment_index())previous_button = mo.ui.button(@@ -35,13 +35,13 @@ def __(decrement_index, increment_index, mo):@app.cell-def __(mo):+def _(mo):mo.md(f"**Choose an example to label.**")return@app.cell-def __(NUMBER_OF_EXAMPLES, get_index, mo, set_index):+def _(NUMBER_OF_EXAMPLES, get_index, mo, set_index):index = mo.ui.number(0,NUMBER_OF_EXAMPLES - 1,@@ -51,51 +51,51 @@ def __(NUMBER_OF_EXAMPLES, get_index, mo, set_index):label="example number",on_change=set_index,)- return index,+ return (index,)@app.cell-def __(index, mo, next_button, previous_button):+def _(index, mo, next_button, previous_button):mo.hstack([index, previous_button, next_button], justify="start")return@app.cell-def __(index, mo):+def _(index, mo):mo.md(f"").center()return@app.cell-def __(mo):+def _(mo):mo.md("### Real or AI generated?").center()return@app.cell-def __(LABELS_PATH, NUMBER_OF_EXAMPLES, load_labels):+def _(LABELS_PATH, NUMBER_OF_EXAMPLES, load_labels):labels = load_labels(LABELS_PATH, NUMBER_OF_EXAMPLES)- return labels,+ return (labels,)@app.cell-def __(LABELS_PATH, labels, write_labels):+def _(LABELS_PATH, labels, write_labels):def update_label(value, index):labels[index]["label"] = valuewrite_labels(labels, LABELS_PATH)- return update_label,+ return (update_label,)@app.cell-def __(LABELS_PATH, labels, write_labels):+def _(LABELS_PATH, labels, write_labels):def update_notes(value, index):labels[index]["notes"] = valuewrite_labels(labels, LABELS_PATH)- return update_notes,+ return (update_notes,)@app.cell-def __(mo, notes):+def _(mo, notes):mo.stop(len(notes.value) <= 100)_character_count = mo.md(f"`{len(notes.value)}/100` characters used").right()@@ -109,7 +109,7 @@ def __(mo, notes):@app.cell-def __(index, labels, mo, update_label, update_notes):+def _(index, labels, mo, update_label, update_notes):data = labels[index.value]label_picker = mo.ui.radio(@@ -126,11 +126,11 @@ def __(index, labels, mo, update_label, update_notes):)mo.hstack([label_picker, notes], justify="space-around")- return data, label_picker, notes+ return (notes,)@app.cell-def __(json, os):+def _(json, os):def load_labels(path, number_of_examples):if not os.path.exists(path):return [@@ -156,25 +156,25 @@ def __(json, os):@app.cell-def __():+def _():NUMBER_OF_EXAMPLES = 100- return NUMBER_OF_EXAMPLES,+ return (NUMBER_OF_EXAMPLES,)@app.cell-def __():+def _():LABELS_PATH = "labels.json"- return LABELS_PATH,+ return (LABELS_PATH,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import jsonimport osreturn json, osdiff --git a/examples/ai/data/model_comparison.py b/examples/ai/data/model_comparison.pyindex adb3abf92c..5d6cd8ecf0 100644--- a/examples/ai/data/model_comparison.py+++ b/examples/ai/data/model_comparison.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Model Comparison""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""!!! tip "This notebook is best viewed as an app."@@ -29,7 +29,7 @@ def __(mo):@app.cell(hide_code=True)-def __(NUMBER_OF_EXAMPLES, mo):+def _(NUMBER_OF_EXAMPLES, mo):get_index, set_index = mo.state(0)@@ -44,18 +44,11 @@ def __(NUMBER_OF_EXAMPLES, mo):previous_button = mo.ui.button(label="previous", on_change=lambda _: decrement_index())- return (- decrement_index,- get_index,- increment_index,- next_button,- previous_button,- set_index,- )+ return get_index, next_button, previous_button, set_index@app.cell(hide_code=True)-def __(NUMBER_OF_EXAMPLES, get_index, mo, set_index):+def _(NUMBER_OF_EXAMPLES, get_index, mo, set_index):index = mo.ui.number(0,NUMBER_OF_EXAMPLES - 1,@@ -69,13 +62,13 @@ def __(NUMBER_OF_EXAMPLES, get_index, mo, set_index):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(f"_Models A and B both predict spans. Which do you prefer?_")return@app.cell(hide_code=True)-def __(NUMBER_OF_EXAMPLES, mo, num_a_preferred, num_b_preferred):+def _(NUMBER_OF_EXAMPLES, mo, num_a_preferred, num_b_preferred):mo.ui.table([{"Model": "A", "Score": f"{num_a_preferred}/{NUMBER_OF_EXAMPLES}"},@@ -87,22 +80,22 @@ def __(NUMBER_OF_EXAMPLES, mo, num_a_preferred, num_b_preferred):@app.cell-def __(index, mo, next_button, previous_button):+def _(index, mo, next_button, previous_button):mo.hstack([index, previous_button, next_button], justify="center")return@app.cell(hide_code=True)-def __(CHOICES_PATH, get_choices, index, mo, write_choices):+def _(CHOICES_PATH, get_choices, index, mo, write_choices):preference = get_choices()[index.value]mo.stop(preference is None, mo.md("**Choose the better model**.").center())write_choices(get_choices(), CHOICES_PATH)mo.md(f"You prefer **model {preference}**.").center()- return (preference,)+ return@app.cell(hide_code=True)-def __(annotate, mo):+def _(mo):mo.hstack([mo.md(annotate("Model A", [0, len("Model A")], "yellow")),@@ -114,7 +107,7 @@ def __(annotate, mo):@app.cell(hide_code=True)-def __(CHOICES_PATH, PARAGRAPHS, load_choices, mo):+def _(CHOICES_PATH, PARAGRAPHS, load_choices, mo):get_choices, set_choices = mo.state(load_choices(CHOICES_PATH, len(PARAGRAPHS)))@@ -122,7 +115,7 @@ def __(CHOICES_PATH, PARAGRAPHS, load_choices, mo):@app.cell(hide_code=True)-def __(index, mo, set_choices):+def _(index, mo, set_choices):model_A = mo.ui.button(label="Model A",on_change=lambda _: set_choices(@@ -137,11 +130,11 @@ def __(index, mo, set_choices):),)mo.hstack([model_A, model_B], justify="space-around")- return model_A, model_B+ return@app.cell(hide_code=True)-def __(PARAGRAPHS, SPANS, annotate, index, mo):+def _(PARAGRAPHS, SPANS, index, mo):model_A_prediction = mo.md(annotate(PARAGRAPHS[index.value],@@ -161,7 +154,7 @@ def __(PARAGRAPHS, SPANS, annotate, index, mo):@app.cell-def __(mo, model_A_prediction, model_B_prediction):+def _(mo, model_A_prediction, model_B_prediction):mo.hstack([model_A_prediction, model_B_prediction], gap=2, justify="space-around")@@ -169,20 +162,20 @@ def __(mo, model_A_prediction, model_B_prediction):@app.cell-def __(get_choices):+def _(get_choices):num_a_preferred = sum(1 for c in get_choices() if c == "A")num_b_preferred = sum(1 for c in get_choices() if c == "B")return num_a_preferred, num_b_preferred@app.cell-def __():+def _():CHOICES_PATH = "choices.json"return (CHOICES_PATH,)@app.cell-def __(json, os):+def _(json, os):def load_choices(path, number_of_examples):if not os.path.exists(path):return [@@ -204,7 +197,7 @@ def __(json, os):@app.cell-def __(PARAGRAPHS, random):+def _(PARAGRAPHS, random):random.seed(0)@@ -217,11 +210,11 @@ def __(PARAGRAPHS, random):return first, secondSPANS = [predict_spans(p) for p in PARAGRAPHS]- return SPANS, predict_spans+ return (SPANS,)@app.cell-def __(HAMLET, textwrap):+def _(HAMLET, textwrap):PARAGRAPHS = [textwrap.dedent(block).strip()[:1000]for block in HAMLET.split("\n\n")@@ -230,43 +223,41 @@ def __(HAMLET, textwrap):return (PARAGRAPHS,)-def __():- def annotate(text, span, color):- mark_start = f"<mark style='background-color:{color}'>"- return (- text[: span[0]]- + mark_start- + text[span[0] : span[1]]- + "</mark>"- + text[span[1] :]- )- return (annotate,)+def annotate(text, span, color):+ mark_start = f"<mark style='background-color:{color}'>"+ return (+ text[: span[0]]+ + mark_start+ + text[span[0] : span[1]]+ + "</mark>"+ + text[span[1] :]+ )@app.cell-def __(PARAGRAPHS):+def _(PARAGRAPHS):NUMBER_OF_EXAMPLES = len(PARAGRAPHS)return (NUMBER_OF_EXAMPLES,)@app.cell-def __(urllib):+def _(urllib):_hamlet_url = "https://gist.githubusercontent.com/provpup/2fc41686eab7400b796b/raw/b575bd01a58494dfddc1d6429ef0167e709abf9b/hamlet.txt"with urllib.request.urlopen(_hamlet_url) as f:HAMLET = f.read().decode('utf-8')- return HAMLET, f+ return (HAMLET,)@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __():+def _():import jsonimport osimport randomdiff --git a/examples/ai/misc/build_a_superhero.py b/examples/ai/misc/build_a_superhero.pyindex 7558231df1..0ef92f8462 100644--- a/examples/ai/misc/build_a_superhero.py+++ b/examples/ai/misc/build_a_superhero.py@@ -8,34 +8,34 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Build a Superhero with Generative AI""")return@app.cell-def __(mo):+def _(mo):openaikey = mo.ui.text(label="🤖 OpenAI Key", kind="password")config = mo.hstack([openaikey])mo.accordion({"⚙️ Enter your OpenAI key": config})- return config, openaikey+ return (openaikey,)@app.cell-def __(mo):+def _(mo):item = mo.ui.text(label="Enter the name of an animal: ").form()itemreturn (item,)@app.cell-def __(item, mo):+def _(item, mo):content = f"💬 Suggest three superhero names, given the following animal: {item.value}"mo.md(content) if item.value else None@@ -43,7 +43,7 @@ def __(item, mo):@app.cell-def __(content, item, mo, openai, openaikey):+def _(content, item, mo, openai, openaikey):openai.api_key = openaikey.valueresult = None@@ -64,15 +64,15 @@ def __(content, item, mo, openai, openaikey):mo.md(f"""🤖 Response:-+{result}""") if item.value else None- return response, result+ return (result,)@app.cell-def __(mo, result):+def _(mo, result):choices = result.split("\n") if result else []superhero = mo.ui.dropdown(choices)@@ -81,11 +81,11 @@ def __(mo, result):Choose a superhero: {superhero}""") if result else None- return choices, superhero+ return (superhero,)@app.cell-def __(mo, openai, superhero):+def _(mo, openai, superhero):catchphrase = Noneif superhero.value:@@ -111,18 +111,18 @@ def __(mo, openai, superhero):{catchphrase}""") if superhero.value else None- return catchphrase, catchphraseResponse+ return (catchphrase,)@app.cell-def __(catchphrase, mo):+def _(catchphrase, mo):generate_image_button = mo.ui.button(label="📷 Generate Image")generate_image_button if catchphrase else Nonereturn (generate_image_button,)@app.cell-def __(generate_image_button, mo, openai, superhero):+def _(generate_image_button, mo, openai, superhero):generate_image_buttonurl = None@@ -135,11 +135,11 @@ def __(generate_image_button, mo, openai, superhero):url = res["data"][0]["url"]mo.image(src=url) if url else None- return res, url+ return@app.cell-def __():+def _():import marimo as moimport openaireturn mo, openaidiff --git a/examples/ai/misc/micrograd_mlp.py b/examples/ai/misc/micrograd_mlp.pyindex dac1a892b4..99683998e9 100644--- a/examples/ai/misc/micrograd_mlp.py+++ b/examples/ai/misc/micrograd_mlp.py@@ -11,18 +11,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Neural Networks with Micrograd""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""This marimo notebook trains a tiny **neural network** using@@ -39,25 +39,25 @@ def __(mo):@app.cell-def __():+def _():import randomimport numpy as npimport matplotlib.pyplot as pltnp.random.seed(1337)random.seed(1337)- return np, plt, random+ return np, plt@app.cell-def __():+def _():from micrograd.engine import Valuefrom micrograd.nn import Neuron, Layer, MLP- return Layer, MLP, Neuron, Value+ return MLP, Value@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""We start by generating a synthetic dataset of points labeled +1 or -1.@@ -69,23 +69,23 @@ def __(mo):@app.cell-def __():+def _():from sklearn.datasets import make_moons, make_blobsX, y = make_moons(n_samples=100, noise=0.1)y = y * 2 - 1 # make y be -1 or 1- return X, make_blobs, make_moons, y+ return X, y@app.cell-def __(X, mo, plt, y):+def _(X, mo, plt, y):plt.figure(figsize=(5, 5))mo.center(plt.scatter(X[:, 0], X[:, 1], c=y, s=20, cmap="jet"))return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Note that the decision boundary must be **nonlinear**, which can be readily@@ -98,7 +98,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""**Try it!** Train a neural network by hitting the "Train" button. The@@ -112,7 +112,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):n_layers = mo.ui.slider(start=1, stop=2, step=1, value=2, show_value=True,label="number of layers"@@ -122,7 +122,7 @@ def __(mo):@app.cell-def __(mo, n_layers):+def _(mo, n_layers):layer_sizes = mo.ui.array([mo.ui.slider(4, 16, step=1, value=12, show_value=True)for i in range(n_layers.value)@@ -151,11 +151,11 @@ def __(mo, n_layers):)training_parameters- return iterations, layer_sizes, training_parameters+ return (training_parameters,)@app.cell-def __(MLP, mo, n_layers, train, training_parameters):+def _(MLP, mo, n_layers, train, training_parameters):mo.stop(training_parameters.value is None,mo.md("Click the `Train` button to continue").callout(kind="warn")@@ -169,17 +169,17 @@ def __(MLP, mo, n_layers, train, training_parameters):model,iters=training_parameters.value["iterations"])- return model, trained_model+ return (trained_model,)@app.cell-def __(plot_decision_boundary, trained_model):+def _(plot_decision_boundary, trained_model):plot_decision_boundary(trained_model)return@app.cell-def __(Value, X, np, y):+def _(Value, X, np, y):def loss(model, batch_size=None):# inline DataLoader :)@@ -210,7 +210,7 @@ def __(Value, X, np, y):@app.cell-def __(loss, mo):+def _(loss, mo):def train(model, iters=20):for k in mo.status.progress_bar(range(iters)):@@ -234,7 +234,7 @@ def __(loss, mo):@app.cell-def __(Value, X, np, plt, y):+def _(Value, X, np, plt, y):def plot_decision_boundary(model):h = 0.25x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1@@ -258,7 +258,7 @@ def __(Value, X, np, plt, y):@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/ai/misc/pdf_question_answer.py b/examples/ai/misc/pdf_question_answer.pyindex 63801204e6..aea684b8dc 100644--- a/examples/ai/misc/pdf_question_answer.py+++ b/examples/ai/misc/pdf_question_answer.py@@ -9,24 +9,24 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# PDF Q&A""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""This app lets you upload a PDF and ask questions about it.""")return@app.cell-def __(mo):+def _(mo):mo.accordion({"How is this app implemented?": """- Your PDF is tokenized into chunks, which are embedded using@@ -42,15 +42,15 @@ def __(mo):@app.cell-def __(mo):+def _(mo):openaikey = mo.ui.text(label="🤖 OpenAI Key", kind="password")config = mo.hstack([openaikey])mo.accordion({"⚙️ Config": config})- return config, openaikey+ return (openaikey,)@app.cell-def __(mo, openaikey):+def _(mo, openaikey):pdf = mo.ui.file(label="Upload PDF", filetypes=[".pdf"], multiple=False, kind="area")@@ -59,7 +59,7 @@ def __(mo, openaikey):@app.cell-def __(+def _(CharacterTextSplitter,FAISS,OpenAIEmbeddings,@@ -99,11 +99,11 @@ def __(knowledge_base = parse_pdf()- return knowledge_base, parse_pdf+ return (knowledge_base,)@app.cell-def __(mo):+def _(mo):user_question = mo.ui.text_area(placeholder="💬 What are the 3 key points of the document?").form()@@ -112,7 +112,7 @@ def __(mo):@app.cell-def __(+def _(OpenAI,get_openai_callback,knowledge_base,@@ -138,11 +138,11 @@ def __(res = query_pdf()mo.md(res)- return query_pdf, res+ return@app.cell-def __():+def _():import marimo as moimport openai@@ -167,7 +167,6 @@ def __():load_qa_chain,mo,openai,- os,)diff --git a/examples/ai/tools/chat_with_tools.py b/examples/ai/tools/chat_with_tools.pyindex b1d64bd98c..d729b95f9c 100644--- a/examples/ai/tools/chat_with_tools.py+++ b/examples/ai/tools/chat_with_tools.py@@ -16,12 +16,12 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport ellimport requests@@ -30,11 +30,11 @@ def __():import polars as plfrom bs4 import BeautifulSoupfrom vega_datasets import data- return BeautifulSoup, alt, data, ell, mo, pl, pyarrow, requests+ return BeautifulSoup, alt, data, ell, mo, pl, requests@app.cell-def __(mo):+def _(mo):mo.md("""# Creating rich tools with ell@@ -46,13 +46,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Setup""")return@app.cell-def __(mo):+def _(mo):import osos_key = os.environ.get("OPENAI_API_KEY")@@ -62,11 +62,11 @@ def __(mo):value=os.environ.get("OPENAI_API_KEY", ""),)input_key- return input_key, os, os_key+ return input_key, os_key@app.cell-def __(input_key, mo, os_key):+def _(input_key, mo, os_key):openai_key = os_key or input_key.valueimport openai@@ -79,92 +79,80 @@ def __(input_key, mo, os_key):"Please set the `OPENAI_API_KEY` environment variable or provide it in the input field"),)- return client, openai, openai_key+ return (client,)@app.cell-def __(mo):+def _(mo):get_dataset, set_dataset = mo.state("cars")return get_dataset, set_dataset@app.cell-def __():+def _():# data.list_datasets()return@app.cell-def __(get_dataset, mo, set_dataset):+def _(get_dataset, mo, set_dataset):options = ["cars", "barley", "countries", "disasters"]dataset_dropdown = mo.ui.dropdown(options, label="Datasets", value=get_dataset(), on_change=set_dataset)- return dataset_dropdown, options+ return (dataset_dropdown,)@app.cell-def __(data, dataset_dropdown, pl):+def _(data, dataset_dropdown, pl):selected_dataset = dataset_dropdown.valuedf = pl.DataFrame(data.__call__(selected_dataset))- return df, selected_dataset+ return (df,)@app.cell-def __(mo):+def _(mo):mo.md(r"""## Defining tools""")return-def __():- # https://stackoverflow.com/questions/33908794/get-value-of-last-expression-in-exec-call- def custom_exec(script, globals=None, locals=None):- """Execute a script and return the value of the last expression"""- import ast-- stmts = list(ast.iter_child_nodes(ast.parse(script)))- if not stmts:- return None- if isinstance(stmts[-1], ast.Expr):- # the last one is an expression and we will try to return the results- # so we first execute the previous statements- if len(stmts) > 1:- exec(- compile(- ast.Module(body=stmts[:-1]), filename="<ast>", mode="exec"- ),- globals,- locals,- )- # then we eval the last one- return eval(+# https://stackoverflow.com/questions/33908794/get-value-of-last-expression-in-exec-call+def custom_exec(script, globals=None, locals=None):+ """Execute a script and return the value of the last expression"""+ import ast++ stmts = list(ast.iter_child_nodes(ast.parse(script)))+ if not stmts:+ return None+ if isinstance(stmts[-1], ast.Expr):+ # the last one is an expression and we will try to return the results+ # so we first execute the previous statements+ if len(stmts) > 1:+ exec(compile(- ast.Expression(body=stmts[-1].value),- filename="<ast>",- mode="eval",+ ast.Module(body=stmts[:-1]), filename="<ast>", mode="exec"),globals,locals,)- else:- # otherwise we just execute the entire code- return exec(script, globals, locals)- return (custom_exec,)+ # then we eval the last one+ return eval(+ compile(+ ast.Expression(body=stmts[-1].value),+ filename="<ast>",+ mode="eval",+ ),+ globals,+ locals,+ )+ else:+ # otherwise we just execute the entire code+ return exec(script, globals, locals)@app.cell-def __(- BeautifulSoup,- alt,- client,- custom_exec,- dataset_dropdown,- df,- ell,- mo,- requests,-):+def _(BeautifulSoup, alt, client, dataset_dropdown, df, ell, mo, requests):@ell.tool()def show_dataset_selector():"""Ask the user to select a dataset"""@@ -249,21 +237,11 @@ def __(tool_docs[tool.__name__] = tool.__doc__mo.accordion(tool_docs)- return (- TOOLS,- chart_data,- execute_code,- filter_dataset_with_sql,- rag,- search_the_web,- show_dataset_selector,- tool,- tool_docs,- )+ return (TOOLS,)@app.cell-def __(TOOLS, client, df, ell, get_dataset, mo):+def _(TOOLS, client, df, ell, get_dataset, mo):@ell.complex(model="gpt-4-turbo",tools=TOOLS,@@ -296,11 +274,11 @@ 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 custom_chatbot, model+ return (model,)@app.cell-def __(mo, model):+def _(mo, model):mo.ui.chat(model,prompts=[diff --git a/examples/ai/tools/code_interpreter.py b/examples/ai/tools/code_interpreter.pyindex 9f5bfa6d81..30e94c07e7 100644--- a/examples/ai/tools/code_interpreter.py+++ b/examples/ai/tools/code_interpreter.py@@ -9,20 +9,20 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __():+def _():import marimo as moimport ellimport textwrap- return ell, mo, textwrap+ return ell, mo@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Creating a code interpreter@@ -34,14 +34,14 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):backend = mo.ui.dropdown(["ollama", "openai"], label="Backend", value="ollama")backendreturn (backend,)@app.cell(hide_code=True)-def __(backend, mo):+def _(backend, mo):# OpenAI configimport osimport openai@@ -53,11 +53,11 @@ def __(backend, mo):value=os.environ.get("OPENAI_API_KEY", ""),)input_key if backend.value == "openai" else None- return input_key, openai, os, os_key+ return input_key, openai, os_key@app.cell-def __(openai):+def _(openai):client = openai.Client(api_key="ollama",base_url="http://localhost:11434/v1",@@ -66,7 +66,7 @@ def __(openai):@app.cell(hide_code=True)-def __(backend, input_key, mo, os_key):+def _(backend, input_key, mo, os_key):def _get_open_ai_client():openai_key = os_key or input_key.value@@ -100,45 +100,43 @@ def __(backend, input_key, mo, os_key):return (model,)[email protected](hide_code=True)-def __():- # https://stackoverflow.com/questions/33908794/get-value-of-last-expression-in-exec-call- def exec_with_result(script, globals=None, locals=None):- """Execute a script and return the value of the last expression"""- import ast-- stmts = list(ast.iter_child_nodes(ast.parse(script)))- if not stmts:- return None- if isinstance(stmts[-1], ast.Expr):- # the last one is an expression and we will try to return the results- # so we first execute the previous statements- if len(stmts) > 1:- exec(- compile(- ast.Module(body=stmts[:-1]), filename="<ast>", mode="exec"- ),- globals,- locals,- )- # then we eval the last one- return eval([email protected](hide_code=True)+# https://stackoverflow.com/questions/33908794/get-value-of-last-expression-in-exec-call+def exec_with_result(script, globals=None, locals=None):+ """Execute a script and return the value of the last expression"""+ import ast++ stmts = list(ast.iter_child_nodes(ast.parse(script)))+ if not stmts:+ return None+ if isinstance(stmts[-1], ast.Expr):+ # the last one is an expression and we will try to return the results+ # so we first execute the previous statements+ if len(stmts) > 1:+ exec(compile(- ast.Expression(body=stmts[-1].value),- filename="<ast>",- mode="eval",+ ast.Module(body=stmts[:-1]), filename="<ast>", mode="exec"),globals,locals,)- else:- # otherwise we just execute the entire code- return exec(script, globals, locals)- return (exec_with_result,)+ # then we eval the last one+ return eval(+ compile(+ ast.Expression(body=stmts[-1].value),+ filename="<ast>",+ mode="eval",+ ),+ globals,+ locals,+ )+ else:+ # otherwise we just execute the entire code+ return exec(script, globals, locals)@app.cell-def __(ell, exec_with_result, mo):+def _(ell, mo):def code_fence(code):return f"```python\n\n{code}\n\n```"@@ -159,11 +157,11 @@ def __(ell, exec_with_result, mo):code_fence(result if result is not None else output),]return mo.md("\n\n".join(results))- return code_fence, execute_code+ return (execute_code,)@app.cell-def __(client, ell, execute_code, mo, model):+def _(client, ell, execute_code, mo, model):@ell.complex(model=model, tools=[execute_code], client=client)def custom_chatbot(messages, config) -> str:"""You are data scientist with access to writing python code."""@@ -180,11 +178,11 @@ def __(client, ell, execute_code, mo, model):if response.tool_calls:return response.tool_calls[0]()return mo.md(response.text)- return custom_chatbot, my_model+ return (my_model,)@app.cell-def __(mo, my_model):+def _(mo, my_model):numbers = [x for x in range(1, 10)]mo.ui.chat(@@ -194,7 +192,7 @@ def __(mo, my_model):f"Can you sum this list using python: {numbers}",],)- return (numbers,)+ returnif __name__ == "__main__":diff --git a/examples/ai/tools/dataset_analysis.py b/examples/ai/tools/dataset_analysis.pyindex 87edec07f6..de6b546e61 100644--- a/examples/ai/tools/dataset_analysis.py+++ b/examples/ai/tools/dataset_analysis.py@@ -16,12 +16,12 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport ellfrom pydantic import Field@@ -30,11 +30,11 @@ def __():import pyarrowimport polars as plfrom vega_datasets import data- return Field, alt, data, ell, mo, pl, pyarrow, requests+ return alt, data, ell, mo, pl@app.cell-def __(mo):+def _(mo):mo.md("""# Using tools with ell@@ -46,17 +46,17 @@ def __(mo):@app.cell-def __(mo):+def _(mo):import osos_key = os.environ.get("OPENAI_API_KEY")input_key = mo.ui.text(label="OpenAI API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.cell-def __(input_key, mo, os_key):+def _(input_key, mo, os_key):openai_key = os_key or input_key.valueimport openai@@ -69,18 +69,18 @@ def __(input_key, mo, os_key):"Please set the `OPENAI_API_KEY` environment variable or provide it in the input field"),)- return client, openai, openai_key+ return (client,)@app.cell-def __(data, pl):+def _(data, pl):cars = pl.DataFrame(data.cars())schema = cars.schemareturn cars, schema@app.cell-def __(alt, cars, client, ell, schema):+def _(alt, cars, client, ell, schema):@ell.tool()def get_chart(x_encoding: str,@@ -114,11 +114,11 @@ 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, get_chart, get_filtered_table+ return (analyze_dataset,)@app.cell-def __(input_key, mo, schema):+def _(input_key, mo, schema):text = mo.ui.text(full_width=True,disabled=not input_key.value,@@ -141,7 +141,7 @@ def __(input_key, mo, schema):@app.cell-def __(analyze_dataset, mo, text):+def _(analyze_dataset, mo, text):mo.stop(not text.value)with mo.status.spinner(title=f"Thinking...", subtitle=text.value):@@ -153,7 +153,7 @@ def __(analyze_dataset, mo, text):mo.output.replace(summary)except Exception as e:mo.output.replace(mo.callout(str(e)))- return response, summary+ returnif __name__ == "__main__":diff --git a/examples/cloud/gcp/google_cloud_bigquery.py b/examples/cloud/gcp/google_cloud_bigquery.pyindex 9b9c02ab82..5902f2a8ec 100644--- a/examples/cloud/gcp/google_cloud_bigquery.py+++ b/examples/cloud/gcp/google_cloud_bigquery.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport osfrom google.cloud import bigquery@@ -23,13 +23,13 @@ def __():@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Google Cloud BigQuery""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):# Configurationcredentials = mo.ui.text(placeholder="path/to/creds.json")mo.md(@@ -46,14 +46,14 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):project = mo.ui.text(label="gcloud project")projectreturn (project,)@app.cell(hide_code=True)-def __(bigquery, credentials, mo, os, project):+def _(bigquery, credentials, mo, os, project):# Set up clientif credentials.value:os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credentials.value@@ -72,7 +72,7 @@ def __(bigquery, credentials, mo, os, project):@app.cell-def __(datasets, mo):+def _(datasets, mo):# Dataset selectionselected_dataset = mo.ui.dropdown(label="Select dataset", options=[d.dataset_id for d in datasets]@@ -82,7 +82,7 @@ def __(datasets, mo):@app.cell-def __(client, mo, selected_dataset):+def _(client, mo, selected_dataset):mo.stop(not selected_dataset.value)dataset = client.dataset(selected_dataset.value)@@ -90,21 +90,21 @@ def __(client, mo, selected_dataset):@app.cell-def __(client, dataset, mo):+def _(client, dataset, mo):# Table selectiontables = list(client.list_tables(dataset))selected_table = mo.ui.dropdown(label="Select table", options=[t.table_id for t in tables])selected_table- return selected_table, tables+ return (selected_table,)@app.cell-def __(client, dataset, mo, selected_table):+def _(client, dataset, mo, selected_table):results = client.list_rows(dataset.table(selected_table.value), max_results=10)mo.ui.table(results.to_dataframe(), selection=None)- return (results,)+ returnif __name__ == "__main__":diff --git a/examples/cloud/gcp/google_cloud_storage.py b/examples/cloud/gcp/google_cloud_storage.pyindex 70f0ecbba2..365ac1dfb5 100644--- a/examples/cloud/gcp/google_cloud_storage.py+++ b/examples/cloud/gcp/google_cloud_storage.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():# Importsimport marimo as moimport os@@ -23,7 +23,7 @@ def __():@app.cell(hide_code=True)-def __(mo):+def _(mo):# Configurationcredentials = mo.ui.text(placeholder="path/to/creds.json")mo.md(@@ -40,14 +40,14 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):project = mo.ui.text(label="gcloud project")projectreturn (project,)@app.cell-def __(credentials, mo, os, project, storage):+def _(credentials, mo, os, project, storage):# Set up clientif credentials.value:os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credentials.value@@ -67,7 +67,7 @@ def __(credentials, mo, os, project, storage):@app.cell-def __(buckets, mo):+def _(buckets, mo):# Bucket selectionselected_bucket = mo.ui.dropdown(label="Select bucket", options=[bucket.name for bucket in buckets]@@ -77,13 +77,13 @@ def __(buckets, mo):@app.cell-def __(mo):+def _(mo):get_prefix, set_prefix = mo.state("")return get_prefix, set_prefix@app.cell-def __(client, mo, selected_bucket):+def _(client, mo, selected_bucket):mo.stop(not selected_bucket.value)bucket = client.get_bucket(selected_bucket.value)@@ -91,14 +91,14 @@ def __(client, mo, selected_bucket):@app.cell-def __(bucket, get_prefix):+def _(bucket, get_prefix):_prefix = get_prefix() or Noneblobs = list(bucket.list_blobs(max_results=30, prefix=_prefix))return (blobs,)@app.cell-def __(get_prefix, mo, set_prefix):+def _(get_prefix, mo, set_prefix):output = None_prefix = get_prefix()if _prefix:@@ -109,11 +109,11 @@ def __(get_prefix, mo, set_prefix):])output- return (output,)+ return@app.cell-def __(blobs, bucket, mo, set_prefix):+def _(blobs, bucket, mo, set_prefix):# Display files in a table_files = [{@@ -139,7 +139,7 @@ def __(blobs, bucket, mo, set_prefix):@app.cell-def __(bucket, file_table, mo):+def _(bucket, file_table, mo):# Load selected fileif len(file_table.value) >= 1:_selected_file = file_table.value[0]diff --git a/examples/cloud/gcp/google_sheets.py b/examples/cloud/gcp/google_sheets.pyindex fdde00c14a..1e6846917d 100644--- a/examples/cloud/gcp/google_sheets.py+++ b/examples/cloud/gcp/google_sheets.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moimport pandas as pdimport os@@ -26,7 +26,7 @@ def __():@app.cell-def __(mo):+def _(mo):# Configurationcredentials = mo.ui.text(placeholder="path/to/creds.json")mo.md(@@ -43,13 +43,7 @@ def __(mo):@app.cell-def __(- GoogleCredentials,- ServiceAccountCredentials,- credentials,- gspread,- os,-):+def _(GoogleCredentials, ServiceAccountCredentials, credentials, gspread, os):# Set up client_scopes = ["https://spreadsheets.google.com/feeds",@@ -66,24 +60,24 @@ def __(creds = GoogleCredentials.get_application_default().create_scoped(_scopes)gc = gspread.authorize(creds)- return creds, gc+ return (gc,)@app.cell-def __(mo):+def _(mo):spreadsheet_url = mo.ui.text(label="Spreadsheet URL", full_width=True)spreadsheet_urlreturn (spreadsheet_url,)@app.cell-def __(gc, mo, pd, spreadsheet_url):+def _(gc, mo, pd, spreadsheet_url):mo.stop(not spreadsheet_url.value)# Get sheet recordswks = gc.open_by_url(spreadsheet_url.value).sheet1mo.ui.table(pd.DataFrame(wks.get_all_records()), selection=None)- return (wks,)+ returnif __name__ == "__main__":diff --git a/examples/cloud/modal/nbs/notebook.py b/examples/cloud/modal/nbs/notebook.pyindex 151723de14..fc2ee06d27 100644--- a/examples/cloud/modal/nbs/notebook.py+++ b/examples/cloud/modal/nbs/notebook.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App()@@ -10,7 +10,6 @@ def _():import sysimport platformimport os-return mo, os, platform, sys@@ -43,7 +42,7 @@ def _(mo):output = mo.md("## ✅️ We are running on CPU")output- return output, result, subprocess+ return@app.cell(hide_code=True)@@ -66,7 +65,7 @@ def _(mo, os, platform, sys):"ls": os.listdir(os.getcwd()),}mo.ui.table(runtime_info, selection=None, page_size=len(runtime_info))- return (runtime_info,)+ returnif __name__ == "__main__":diff --git a/examples/control_flow/stop_execution.py b/examples/control_flow/stop_execution.pyindex 8bf66aafe4..0eaff0a6b7 100644--- a/examples/control_flow/stop_execution.py+++ b/examples/control_flow/stop_execution.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/frameworks/fastapi-endpoint/notebook.py b/examples/frameworks/fastapi-endpoint/notebook.pyindex f5513707b7..f786feccde 100644--- a/examples/frameworks/fastapi-endpoint/notebook.py+++ b/examples/frameworks/fastapi-endpoint/notebook.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()with app.setup:diff --git a/examples/layouts/columns.py b/examples/layouts/columns.pyindex 96572dc3f5..6fe7e3ae87 100644--- a/examples/layouts/columns.py+++ b/examples/layouts/columns.py@@ -12,7 +12,7 @@import marimo-__generated_with = "0.10.15"+__generated_with = "0.15.5"app = marimo.App(width="columns")@@ -32,7 +32,7 @@ async def _():await micropip.install("altair")import altair as alt- return alt, micropip, sys+ return (alt,)@app.cell@@ -129,7 +129,7 @@ def _(pl, raw_digits, raw_labels, sklearn):"index": list(range(X_embedded.shape[0])),})- return X_embedded, embedding+ return (embedding,)@app.cell@@ -168,7 +168,7 @@ def _(chart, mo, show_images, table):{table}""")- return (selected_images,)+ returnif __name__ == "__main__":diff --git a/examples/layouts/grid-dashboard.py b/examples/layouts/grid-dashboard.pyindex c5daf341cd..972ad082f6 100644--- a/examples/layouts/grid-dashboard.py+++ b/examples/layouts/grid-dashboard.py@@ -15,7 +15,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium",layout_file="layouts/grid-dashboard.grid.json",diff --git a/examples/layouts/sidebar.py b/examples/layouts/sidebar.pyindex ffad9edb72..c21aa31619 100644--- a/examples/layouts/sidebar.py+++ b/examples/layouts/sidebar.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.8.20"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""!!! tip "This notebook is best viewed as an app."@@ -25,7 +25,7 @@ def __(mo):@app.cell-def __():+def _():import marimo as moimport altair as altfrom vega_datasets import data@@ -33,13 +33,13 @@ def __():@app.cell-def __(data):+def _(data):gapminder = data.gapminder()return (gapminder,)@app.cell-def __(gapminder, mo):+def _(gapminder, mo):# Filtersyear = mo.ui.slider.from_series(gapminder["year"], full_width=True, label="Year", step=5@@ -51,7 +51,7 @@ def __(gapminder, mo):@app.cell-def __(gapminder, population, year):+def _(gapminder, population, year):# Filter the datasetfiltered_data = gapminder[(gapminder["year"] == year.value)@@ -62,7 +62,7 @@ def __(gapminder, population, year):@app.cell-def __(alt, filtered_data, mo):+def _(alt, filtered_data, mo):chart = mo.ui.altair_chart(alt.Chart(filtered_data).mark_circle(opacity=0.7)@@ -86,14 +86,14 @@ def __(alt, filtered_data, mo):@app.cell-def __(chart):+def _(chart):# Show the chart selectionchart.value if not chart.value.empty else Nonereturn@app.cell-def __(mo, population, year):+def _(mo, population, year):mo.sidebar([mo.md("# Gap Minder"),diff --git a/examples/layouts/slides.py b/examples/layouts/slides.pyindex b50af4fb15..e282d15021 100644--- a/examples/layouts/slides.py+++ b/examples/layouts/slides.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.20"+__generated_with = "0.15.5"app = marimo.App(width="medium", layout_file="layouts/slides.slides.json")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""!!! tip "This notebook is best viewed as an app."@@ -26,7 +26,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# DuckDB Tricks 🦆@@ -41,7 +41,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Installation@@ -55,13 +55,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""# Creating the example data set""")return@app.cell-def __(duckdb, mo, print_and_run):+def _(duckdb, mo, print_and_run):_SQL = """CREATE OR REPLACE TABLE example (s STRING, x DOUBLE);INSERT INTO example VALUES ('foo', 10/9), ('bar', 50/7), ('qux', 9/4);@@ -94,13 +94,13 @@ def __(duckdb, mo, print_and_run):@app.cell-def __(mo):+def _(mo):mo.md(r"""# Pretty-printing floating-point numbers""")return@app.cell-def __(mo, print_and_run):+def _(mo, print_and_run):mo.md(f"""When printing a floating-point number to the output, the fractional parts can be difficult to read and compare. For example, the following query returns three numbers between 1 and 8 but their printed widths are very different due to their fractional parts.@@ -128,13 +128,13 @@ def __(mo, print_and_run):@app.cell-def __(mo):+def _(mo):mo.md(r"""# Copying the schema of a table""")return@app.cell-def __(mo, print_and_run):+def _(mo, print_and_run):mo.md(f"""To copy the schema from a table without copying its data, we can use LIMIT 0.@@ -164,19 +164,19 @@ def __(mo, print_and_run):@app.cell-def __(mo):+def _(mo):mo.md(r"""# Shuffling data""")return@app.cell-def __(mo):+def _(mo):rerun = mo.ui.button(label="Run again")return (rerun,)@app.cell-def __(mo, print_and_run, rerun):+def _(mo, print_and_run, rerun):mo.md(f"""Sometimes, we need to introduce some entropy into the ordering of the data by shuffling it. To shuffle non-deterministically, we can simply sort on a random value provided the random() function:@@ -203,7 +203,7 @@ def __(mo, print_and_run, rerun):@app.cell-def __(mo):+def _(mo):mo.md("""# Closing thoughts@@ -215,7 +215,7 @@ def __(mo):@app.cell-def __(duckdb, mo):+def _(duckdb, mo):# Utilsdef print_and_run(sql: str):@@ -237,7 +237,7 @@ def __(duckdb, mo):@app.cell-def __():+def _():import marimo as moimport duckdbreturn duckdb, modiff --git a/examples/markdown/admonitions.py b/examples/markdown/admonitions.pyindex cd3bc78257..604156c6eb 100644--- a/examples/markdown/admonitions.py+++ b/examples/markdown/admonitions.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.19"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/markdown/details.py b/examples/markdown/details.pyindex 3c6d0971e2..060b941c98 100644--- a/examples/markdown/details.py+++ b/examples/markdown/details.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.19"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/markdown/dynamic_markdown.py b/examples/markdown/dynamic_markdown.pyindex b20ff7d3dc..69ffdbcbd4 100644--- a/examples/markdown/dynamic_markdown.py+++ b/examples/markdown/dynamic_markdown.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.19"+__generated_with = "0.15.5"app = marimo.App()@@ -61,7 +61,7 @@ def _(mo):mo.md(f"""Here's a list of numbers:-+{mo.as_html([1, 2, 3])}""")diff --git a/examples/markdown/emoji.py b/examples/markdown/emoji.pyindex 5416c6fccd..57a59c9c9b 100644--- a/examples/markdown/emoji.py+++ b/examples/markdown/emoji.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.19"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/markdown/mermaid.py b/examples/markdown/mermaid.pyindex a9cddc5788..15caec92e9 100644--- a/examples/markdown/mermaid.py+++ b/examples/markdown/mermaid.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):mo.mermaid("""graph TD@@ -35,7 +35,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):graph = mo.ui.code_editor(value="""sequenceDiagramAlice->>John: Hello John, how are you?@@ -49,7 +49,7 @@ def __(mo):@app.cell-def __(graph, mo):+def _(graph, mo):mo.md(f"""You can render mermaid directly inside `mo.md`. Usingdiff --git a/examples/misc/bayes_theorem.py b/examples/misc/bayes_theorem.pyindex 420689da32..8c2dc0c5e5 100644--- a/examples/misc/bayes_theorem.py+++ b/examples/misc/bayes_theorem.py@@ -8,12 +8,12 @@import marimo-__generated_with = "0.9.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Bayes' Theorem@@ -54,7 +54,7 @@ def __(mo):@app.cell(hide_code=True)-def __(+def _(bayes_result,construct_probability_plot,mo,@@ -104,7 +104,7 @@ def __(@app.cell(hide_code=True)-def __(mo):+def _(mo):p_h = mo.ui.slider(0.0, 1, label="$P(H)$", value=0.1, step=0.1)p_e_given_h = mo.ui.slider(0.0, 1, label="$P(E \mid H)$", value=0.3, step=0.1)p_e_given_not_h = mo.ui.slider(@@ -114,14 +114,14 @@ def __(mo):@app.cell(hide_code=True)-def __(p_e_given_h, p_e_given_not_h, p_h):+def _(p_e_given_h, p_e_given_not_h, p_h):p_e = p_h.value*p_e_given_h.value + (1 - p_h.value)*p_e_given_not_h.valuebayes_result = p_h.value * p_e_given_h.value / p_ereturn bayes_result, p_e@app.cell-def __(p_e_given_h, p_e_given_not_h, p_h):+def _(p_e_given_h, p_e_given_not_h, p_h):def construct_probability_plot():import matplotlib.pyplot as plt@@ -153,7 +153,7 @@ def __(p_e_given_h, p_e_given_not_h, p_h):@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/misc/colliding_blocks_and_pi.py b/examples/misc/colliding_blocks_and_pi.pyindex a1bd2a2a9a..71d225cd7b 100644--- a/examples/misc/colliding_blocks_and_pi.py+++ b/examples/misc/colliding_blocks_and_pi.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.11.20"+__generated_with = "0.15.5"app = marimo.App()@@ -71,7 +71,7 @@ def _(run_button, simulate_collisions, slider):_, ani, collisions = simulate_collisions(mass_ratio, total_time=15, dt=0.001)- return ani, collisions, mass_ratio+ return (ani,)@app.cell@@ -81,7 +81,7 @@ def _(ani, mo, run_button):with mo.status.spinner(title="Rendering collision video ..."):video = mo.Html(ani.to_html5_video())video- return (video,)+ return@app.cell(hide_code=True)@@ -114,58 +114,54 @@ def _():import matplotlib.pyplot as pltimport matplotlib.animation as animationfrom matplotlib.patches import Rectangle- return Rectangle, animation, np, plt+ return Rectangle, animation, plt-def _():- class Block:- def __init__(self, mass, velocity, position, size=1.0):- self.mass = mass- self.velocity = velocity- self.position = position- self.size = size[email protected]_definition+class Block:+ def __init__(self, mass, velocity, position, size=1.0):+ self.mass = mass+ self.velocity = velocity+ self.position = position+ self.size = size- def update(self, dt):- self.position += self.velocity * dt+ def update(self, dt):+ self.position += self.velocity * dt- def collide(self, other):- # Calculate velocities after elastic collision- m1, m2 = self.mass, other.mass- v1, v2 = self.velocity, other.velocity+ def collide(self, other):+ # Calculate velocities after elastic collision+ m1, m2 = self.mass, other.mass+ v1, v2 = self.velocity, other.velocity- new_v1 = (m1 - m2) / (m1 + m2) * v1 + (2 * m2) / (m1 + m2) * v2- new_v2 = (2 * m1) / (m1 + m2) * v1 + (m2 - m1) / (m1 + m2) * v2+ new_v1 = (m1 - m2) / (m1 + m2) * v1 + (2 * m2) / (m1 + m2) * v2+ new_v2 = (2 * m1) / (m1 + m2) * v1 + (m2 - m1) / (m1 + m2) * v2- self.velocity = new_v1- other.velocity = new_v2+ self.velocity = new_v1+ other.velocity = new_v2- return 1 # Return 1 collision- return (Block,)+ return 1 # Return 1 collision-def check_collisions():- def check_collisions(small_block, big_block, wall_pos=0):- collisions = 0+def check_collisions(small_block, big_block, wall_pos=0):+ collisions = 0- # Check for collision between blocks- if small_block.position + small_block.size > big_block.position:- small_block.position = big_block.position - small_block.size- collisions += small_block.collide(big_block)+ # Check for collision between blocks+ if small_block.position + small_block.size > big_block.position:+ small_block.position = big_block.position - small_block.size+ collisions += small_block.collide(big_block)- # Check for collision with the wall- if small_block.position < wall_pos:- small_block.position = wall_pos- small_block.velocity *= -1- collisions += 1+ # Check for collision with the wall+ if small_block.position < wall_pos:+ small_block.position = wall_pos+ small_block.velocity *= -1+ collisions += 1- return collisions- return (check_collisions,)+ return collisions@app.cell-def _(Block, check_collisions, create_animation):+def _(create_animation):def simulate_collisions(mass_ratio, total_time=15, dt=0.001, animate=True):# Initialize blockssmall_block = Block(mass=1, velocity=0, position=2)diff --git a/examples/misc/compound_interest.py b/examples/misc/compound_interest.pyindex d5d7776e22..6f9aa24660 100644--- a/examples/misc/compound_interest.py+++ b/examples/misc/compound_interest.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Compound Interest""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""This notebook illustrates exponential growth, using compound interest@@ -30,7 +30,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):initial_investment = mo.ui.slider(0, 1000000, step=1e4, value=10000)monthly_investment = mo.ui.slider(0, 50000, value=1000, step=1e3)annual_return = mo.ui.slider(0, 0.15, value=0.07, step=0.01)@@ -73,7 +73,6 @@ def __(mo):capital_gains_tax_rate,initial_investment,monthly_investment,- table,years,)@@ -142,24 +141,17 @@ def simulate(ax = plt.gca()mo.md(_prose)- return (- Portfolio,- ax,- investment_principals,- portfolio,- values,- values_less_taxes,- )+ return (ax,)@app.cell-def __(ax):+def _(ax):axreturn@app.cell-def __():+def _():import marimo as moimport matplotlib.pyplot as pltreturn mo, pltdiff --git a/examples/misc/create_your_own_shape.py b/examples/misc/create_your_own_shape.pyindex dd04f074c7..f93b358231 100644--- a/examples/misc/create_your_own_shape.py+++ b/examples/misc/create_your_own_shape.py@@ -7,12 +7,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Inputs@@ -24,13 +24,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Text boxes""")return@app.cell-def __(mo):+def _(mo):mo.hstack([username := mo.ui.text(label="Username"),@@ -38,11 +38,11 @@ def __(mo):mo.ui.text(label="Password", kind="password"),])- return email, username+ return (username,)@app.cell-def __(mo, username):+def _(mo, username):mo.stop(not username.value, mo.md("What is your name?"))mo.md(f"👋 Hello {username.value}, nice to meet you!")@@ -50,7 +50,7 @@ def __(mo, username):@app.cell-def __(mo):+def _(mo):mo.ui.text_area(label="A space for your thoughts", full_width=True, max_length=1000)@@ -58,19 +58,19 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.ui.number(label="What is your favorite number?", start=0, stop=10)return@app.cell-def __(mo):+def _(mo):mo.md(r"""## Sliders""")return@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(0, 100, value=50, label="Basic slider", show_value=True)range_slider = mo.ui.range_slider(0, 100, value=(30, 70), label="Range slider", show_value=True@@ -82,17 +82,17 @@ def __(mo):0, 100, value=50, label="Vertical slider", orientation="vertical")mo.vstack([slider, range_slider, custom_steps, vertical]).center()- return custom_steps, range_slider, slider, vertical+ return@app.cell-def __(mo):+def _(mo):mo.md(r"""## Checkboxes and Radios""")return@app.cell-def __(mo):+def _(mo):COLORS = ["red", "green", "blue"]colors = mo.ui.array([mo.ui.checkbox(label=color) for color in COLORS],@@ -116,7 +116,7 @@ def __(mo):@app.cell(hide_code=True)-def __(COLORS, colors, mo, shape):+def _(COLORS, colors, mo, shape):selected_colors = [color for i, color in enumerate(COLORS) if colors.value[i]]@@ -153,17 +153,17 @@ def __(COLORS, colors, mo, shape):A {"/".join(selected_colors)} {shape.value}:{draw_shape(shape.value, selected_colors)}""").center()- return draw_shape, selected_colors+ return@app.cell-def __(mo):+def _(mo):mo.md("""## Dates""")return@app.cell-def __(mo):+def _(mo):import datetimestart_date = mo.ui.date(@@ -176,11 +176,11 @@ def __(mo):start=datetime.date(2020, 1, 1),stop=datetime.date(2020, 12, 31),)- return datetime, end_date, start_date+ return end_date, start_date@app.cell-def __(end_date, mo, start_date):+def _(end_date, mo, start_date):mo.hstack([mo.hstack([start_date, "➡️", end_date]).left(),@@ -191,13 +191,13 @@ def __(end_date, mo, start_date):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Dropdowns""")return@app.cell-def __(mo):+def _(mo):single = mo.ui.dropdown(["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"],label="Single select",@@ -208,11 +208,11 @@ def __(mo):value=["Option 1", "Option 2"],)mo.hstack([single, multi])- return multi, single+ return@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/misc/custom_configuration.py b/examples/misc/custom_configuration.pyindex 72318f2b18..dc95ba206f 100644--- a/examples/misc/custom_configuration.py+++ b/examples/misc/custom_configuration.py@@ -10,16 +10,16 @@# theme = "dark"# cell_output = "below"# ///+import marimo-__generated_with = "0.11.4"+__generated_with = "0.15.5"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 92e44817de..be844e9f24 100644--- a/examples/misc/explore_your_own_data.py+++ b/examples/misc/explore_your_own_data.py@@ -10,18 +10,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Data Explorer""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):sample = "https://github.com/vega/vega/blob/main/docs/data/stocks.csv"mo.md(@@ -31,11 +31,11 @@ def __(mo):You can download a <a href="{sample}" target="_blank">sample CSV</a> if you'd like.""")- return (sample,)+ return@app.cell(hide_code=True)-def __(mo, uploaded_file):+def _(mo, uploaded_file):mo.md(f"""{mo.hstack([mo.md("**Upload a CSV.**")], justify="center")}@@ -47,20 +47,20 @@ def __(mo, uploaded_file):@app.cell-def __(io, mo, pd, uploaded_file):+def _(io, mo, pd, uploaded_file):mo.stop(not uploaded_file.name())df = pd.read_csv(io.StringIO(uploaded_file.contents().decode()))return (df,)@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df, page_size=5, selection=None)return@app.cell-def __(df, mo):+def _(df, mo):plot_type = mo.ui.dropdown(["line", "hist"], value="line", label="Choose a plot type: ")@@ -72,7 +72,7 @@ def __(df, mo):@app.cell-def __(color_column, mo, plot_type, x_column, y_column):+def _(color_column, mo, plot_type, x_column, y_column):mo.hstack([x_column, y_column, color_column, plot_type], justify="space-around").callout(kind="warn" if not x_column.value else "neutral")@@ -80,7 +80,7 @@ def __(color_column, mo, plot_type, x_column, y_column):@app.cell-def __(alt, color_column, df, mo, plot_type, x_column, y_column):+def _(alt, color_column, df, mo, plot_type, x_column, y_column):mo.stop(not x_column.value)@@ -98,17 +98,17 @@ def __(alt, color_column, df, mo, plot_type, x_column, y_column):plot(x_column.value, y_column.value, color_column.value)- return (plot,)+ return@app.cell-def __(mo):+def _(mo):uploaded_file = mo.ui.file(filetypes=[".csv"], kind="area")return (uploaded_file,)@app.cell-def __():+def _():import marimo as moimport altair as alt@@ -116,7 +116,7 @@ def __():import ioimport matplotlib.pyplot as pltimport pandas as pd- return alt, io, mo, pd, plt+ return alt, io, mo, pdif __name__ == "__main__":diff --git a/examples/misc/filterable_table.py b/examples/misc/filterable_table.pyindex e735a7e360..88c8486fb8 100644--- a/examples/misc/filterable_table.py+++ b/examples/misc/filterable_table.py@@ -8,25 +8,25 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Filterable DataFrame""")return@app.cell-def __(data_url, pd):+def _(pd):# Read the csvdf = pd.read_json(data_url("cars.json"))return (df,)@app.cell-def __(df):+def _(df):# Create options for select widgetsmanufacturer_options = df["Name"].str.split().str[0].unique()manufacturer_options.sort()@@ -36,7 +36,7 @@ def __(df):@app.cell-def __(cylinder_options, df, manufacturer_options, mo):+def _(cylinder_options, df, manufacturer_options, mo):# Create the filtersmanufacturer = mo.ui.dropdown(manufacturer_options, label="Manufacturer")cylinders = mo.ui.dropdown(cylinder_options, label="Cylinders")@@ -51,13 +51,13 @@ def __(cylinder_options, df, manufacturer_options, mo):@app.cell-def __(df, filter_df):+def _(df, filter_df):filter_df(df)return@app.cell-def __(cylinders, horse_power, manufacturer):+def _(cylinders, horse_power, manufacturer):def filter_df(df):filtered_df = dfif manufacturer.value:@@ -76,15 +76,13 @@ def __(cylinders, horse_power, manufacturer):return (filter_df,)-def __():- def data_url(file):- return f"https://cdn.jsdelivr.net/npm/[email protected]/data/{file}"- return (data_url,)+def data_url(file):+ return f"https://cdn.jsdelivr.net/npm/[email protected]/data/{file}"@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pddiff --git a/examples/misc/iss.py b/examples/misc/iss.pyindex 1f4fba9959..cb8baddeca 100644--- a/examples/misc/iss.py+++ b/examples/misc/iss.py@@ -11,19 +11,12 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def _(- chart,- iss_df,- mo,- n_points_slider,- refresh_interval_slider,- refresher,-):+def _(chart, iss_df, mo, n_points_slider, refresh_interval_slider, refresher):mo.hstack([mo.vstack(@@ -94,7 +87,7 @@ def _(alt, get_iss_positions, sphere, world):.project(type="naturalEarth1").properties(width=640, title=""))- return chart, hover, iss, iss_df+ return chart, iss_df@app.cell@@ -111,18 +104,11 @@ def _(alt, data):world = alt.Chart(countries).mark_geoshape(fill="mintcream", stroke="black", strokeWidth=0.35)- return countries, sphere, world+ return sphere, world@app.cell-def _(- n_points_slider,- pd,- refresh_interval_slider,- refresher,- requests,- time,-):+def _(n_points_slider, pd, refresh_interval_slider, refresher, requests, time):def get_iss_positions(refresher=refresher):refreshertimepoints = [int(time())]diff --git a/examples/misc/monotonic_splines.py b/examples/misc/monotonic_splines.pyindex be9d91bb2b..fc9d2abfd6 100644--- a/examples/misc/monotonic_splines.py+++ b/examples/misc/monotonic_splines.py@@ -13,12 +13,12 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport matplotlibimport matplotlib.pyplot as plt@@ -30,11 +30,11 @@ def __():np.random.seed(0)matplotlib.style.use("ggplot")plt.rcParams["figure.figsize"] = [10, 4]- return check_array, make_pipeline, matplotlib, mo, np, plt, sklearn+ return mo, np, plt@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Introduction to monotonic splines@@ -50,16 +50,16 @@ def __(mo):@app.cell-def __(mo):+def _(mo):from drawdata import ScatterWidgetwidget = mo.ui.anywidget(ScatterWidget())widget- return ScatterWidget, widget+ return (widget,)@app.cell-def __(mo, widget):+def _(mo, widget):mo.stop(not widget.value["data"],mo.md("Draw a dataset above to proceed!").callout(),@@ -71,7 +71,7 @@ def __(mo, widget):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## General splines@@ -85,7 +85,7 @@ def __(mo):@app.cell(hide_code=True)-def __(X, np, plt, tfm):+def _(X, np, plt, tfm):X_tfm = tfm.fit_transform(X)x_range = np.linspace(-50, 900, 2000).reshape(-1, 1)@@ -96,7 +96,7 @@ def __(X, np, plt, tfm):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""You can see the x-values that our drawing widget can provide and you can also see all the generated features. Each feature is represented with a different colored line and you should also see how each hill goes up and typically goes back down again. At the edges of the samples that we have we see straight lines in an attempt to also have some features for extrapolation.@@ -110,7 +110,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):n_knots = mo.ui.slider(2, 20, step=1, show_value=True, label="number of knots", value=5)@@ -121,30 +121,30 @@ def __(mo):@app.cell-def __(degree, knots, n_knots):+def _(degree, knots, n_knots):from sklearn.preprocessing import SplineTransformertfm = SplineTransformer(n_knots=n_knots.value, knots=knots.value, degree=degree.value)tfm- return SplineTransformer, tfm+ return (tfm,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""When you then take these generated features and pass them to a linear model, you should be able to see that we're indeed able to fit a very non-linear curve with a linear model.""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""... turn into these features:""")return@app.cell-def __(X_tfm, df, y):+def _(X_tfm, df, y):import altair as altfrom sklearn.linear_model import Ridge@@ -156,11 +156,11 @@ def __(X_tfm, df, y):p2 = alt.Chart(pltr).mark_line(color="red").encode(x="x", y="preds")(p1 + p2).properties(width=1000)- return Ridge, alt, p1, p2, pltr, preds+ return Ridge, alt, pltr@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Towards monotonic features@@ -174,25 +174,25 @@ def __(mo):@app.cell-def __(plt, x_range, x_range_tfm):+def _(plt, x_range, x_range_tfm):plt.plot(x_range, x_range_tfm)return@app.cell-def __(plt, x_range, x_range_tfm):+def _(plt, x_range, x_range_tfm):plt.plot(x_range, x_range_tfm.cumsum(axis=0))return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""Note the correspondence between the lines here. The color in the chart above has a direct correspondence with the line below.""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""You could wonder ... what would happen if I use these 'cumsum' features? Would I still be able to get a nice fit?@@ -204,7 +204,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):strictly_positive = mo.ui.checkbox(label="Strictly positive")show_iso = mo.ui.checkbox(label="Show Isotonic Regression")@@ -213,13 +213,13 @@ def __(mo):@app.cell-def __():+def _():import pandas as pdreturn (pd,)@app.cell-def __(Ridge, X, X_tfm, alt, pd, pltr, show_iso, strictly_positive, y):+def _(Ridge, X, X_tfm, alt, pd, pltr, show_iso, strictly_positive, y):from sklearn.isotonic import IsotonicRegressionpreds_mono = (@@ -244,20 +244,11 @@ def __(Ridge, X, X_tfm, alt, pd, pltr, show_iso, strictly_positive, y):)together.properties(width=1000).interactive()- return (- IsotonicRegression,- df_iso,- final_df,- iso,- p1_mono,- p2_mono,- preds_mono,- together,- )+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""You can choose to compare the results with a prediction made by an [IsotonicRegression](https://scikit-learn.org/1.5/modules/isotonic.html) model. It may help to appreciate the feature generation technique, especially when you force the linear model to only learn strictly positive weights.diff --git a/examples/misc/mortgage_calculator.py b/examples/misc/mortgage_calculator.pyindex 1be9655331..00059a322b 100644--- a/examples/misc/mortgage_calculator.py+++ b/examples/misc/mortgage_calculator.py@@ -10,24 +10,24 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Mortgage Calculator""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Income""")return@app.cell-def __(mo):+def _(mo):income = mo.ui.number(1, 1e8, step=50, value=100, label="income (thousands)")retirement_contribution = mo.ui.number(10, 40, step=10, value=19.5)@@ -42,7 +42,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.callout(mo.md("""@@ -62,7 +62,7 @@ def __(mo):@app.cell-def __(income, mo, np, retirement_contribution):+def _(income, mo, np, retirement_contribution):standard_deduction = 25100taxable_income = (income.value * 1000@@ -102,19 +102,11 @@ def __(income, mo, np, retirement_contribution):**\${net_cash_per_month:,.02f}** every month.""")- return (- ca_tax,- calculate_federal_tax,- fed_tax,- net_cash,- net_cash_per_month,- standard_deduction,- taxable_income,- )+ return net_cash, net_cash_per_month@app.cell-def __(mo):+def _(mo):home_price = mo.ui.number(100, 5000, step=100, value=500, label="home price (thousands)")@@ -160,24 +152,24 @@ def __(mo):@app.cell-def __(home_expense_parameters, home_purchase_parameters, mo):+def _(home_expense_parameters, home_purchase_parameters, mo):mo.hstack([home_purchase_parameters, home_expense_parameters])return@app.cell-def __(down_payment_pct, home_price, mortgage, rate, years):+def _(down_payment_pct, home_price, mortgage, rate, years):down_payment = down_payment_pct.value / 100 * home_price.valueprincipal = home_price.value - down_paymentloan = mortgage.Loan(principal=principal * 1e3, interest=rate.value / 100, term=years.value)- return down_payment, loan, principal+ return down_payment, loan@app.cell-def __(+def _(down_payment,home_insurance,home_price,@@ -221,25 +213,17 @@ def __(month for expenses and saving.""").callout()- return (- annual_home_payment,- cash_less_housing,- home_insurance_monthly,- monthly_home_payment,- mortgage_monthly,- property_tax_monthly,- utilities_monthly,- )+ return (cash_less_housing,)@app.cell-def __(mo):+def _(mo):mo.md("""## Monthly Expenses""")return@app.cell-def __(mo):+def _(mo):mo.md("""In addition to paying for your home, you'll have monthly expenses on@@ -251,7 +235,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):vacation = mo.ui.number(0, 100000, step=100, value=100)groceries = mo.ui.number(0, 100000, step=100, value=100)dining_out = mo.ui.number(0, 100000, step=100, value=100)@@ -273,7 +257,7 @@ def __(mo):@app.cell-def __(+def _(car_payment,clothing,dining_out,@@ -304,7 +288,7 @@ def __(@app.cell-def __(+def _(car_payment,cash_less_housing,clothing,@@ -337,17 +321,17 @@ def __(or **\${annual_cash_saved:,.02f}** annually.""")- return annual_cash_saved, monthly_expenses+ return@app.cell-def __(loan):+def _(loan):schedule = loan.schedule()[1:]return (schedule,)@app.cell-def __(np, schedule):+def _(np, schedule):_interest, _principal = zip(*[(payment.interest, payment.principal) for payment in schedule])@@ -358,7 +342,7 @@ def __(np, schedule):@app.cell-def __(interest_payments, mo, np, principal_payments, years):+def _(interest_payments, mo, np, principal_payments, years):import matplotlib.pyplot as pltfig, axs = plt.subplots(1, 2)@@ -399,11 +383,11 @@ def __(interest_payments, mo, np, principal_payments, years):{mo.as_html(fig)}""")- return axs, fig, plt+ return@app.cell-def __():+def _():import marimo as moimport mortgageimport numpy as npdiff --git a/examples/misc/movies_by_the_decade.py b/examples/misc/movies_by_the_decade.pyindex c697ddaf20..4d8ff58d4a 100644--- a/examples/misc/movies_by_the_decade.py+++ b/examples/misc/movies_by_the_decade.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""!!! tip "This notebook is best viewed as an app."@@ -27,7 +27,7 @@ def __(mo):@app.cell-def __(+def _(button_00s,button_10s,button_80s,@@ -56,7 +56,7 @@ def __(@app.cell-def __(mo, pd, set_end_date, set_start_date):+def _(mo, pd, set_end_date, set_start_date):def decade_button(decade):s = pd.to_datetime(f"{decade}-01-01")e = pd.to_datetime(f"{decade + 10}-01-01")@@ -75,11 +75,11 @@ def __(mo, pd, set_end_date, set_start_date):button_90s = decade_button(1990)button_00s = decade_button(2000)button_10s = decade_button(2010)- return button_00s, button_10s, button_80s, button_90s, decade_button+ return button_00s, button_10s, button_80s, button_90s@app.cell-def __(mo, previous_end_date, previous_start_date):+def _(mo, previous_end_date, previous_start_date):mo.md(f"""> Compared to: {previous_start_date.strftime("%Y-%m-%d")} - {previous_end_date.strftime("%Y-%m-%d")}@@ -89,7 +89,7 @@ def __(mo, previous_end_date, previous_start_date):@app.cell-def __(get_end_date, get_start_date, mo, pd, set_end_date, set_start_date):+def _(get_end_date, get_start_date, mo, pd, set_end_date, set_start_date):start_date = mo.ui.date(label="Start Date",value=get_start_date().strftime("%Y-%m-%d"),@@ -104,7 +104,7 @@ def __(get_end_date, get_start_date, mo, pd, set_end_date, set_start_date):@app.cell-def __(+def _(filtered_movies,get_average_budget,get_average_gross,@@ -181,31 +181,11 @@ def __(widths="equal",gap=1,)- return (- average_rating,- budget_current,- budget_previous,- budget_rate,- budget_stat,- gross_current,- gross_previous,- gross_rate,- gross_stat,- previous_total_movies_change_rate,- previous_total_movies_count,- rating_current,- rating_previous,- rating_rate,- runtime_current,- runtime_previous,- runtime_rate,- runtime_stat,- total_movies,- )+ return@app.cell-def __(filtered_movies, mo):+def _(filtered_movies, mo):mo.ui.tabs({"📑 Data": mo.ui.table(@@ -220,7 +200,7 @@ def __(filtered_movies, mo):@app.cell-def __(alt, filtered_movies, mo):+def _(alt, filtered_movies, mo):# chart of rating by budget_chart = (alt.Chart(filtered_movies)@@ -244,7 +224,7 @@ def __(alt, filtered_movies, mo):@app.cell-def __(+def _(chart,get_average_budget,get_average_gross,@@ -298,7 +278,7 @@ def __(@app.cell-def __(alt, filtered_movies, mo):+def _(alt, filtered_movies, mo):# chart of ratings by genre# colored by decade_bar_chart = (@@ -313,11 +293,11 @@ def __(alt, filtered_movies, mo):)bar_chart = mo.ui.altair_chart(_bar_chart)bar_chart- return (bar_chart,)+ return@app.cell-def __(datetime):+def _(datetime):def get_average_budget(df, previous):current = df["US_Gross"].mean()previous = previous["US_Gross"].mean()@@ -352,7 +332,6 @@ def __(datetime):def format_date(date):return date.strftime("%Y-%m-%d")return (- format_date,get_average_budget,get_average_gross,get_average_rating,@@ -362,18 +341,18 @@ def __(datetime):@app.cell-def __():+def _():import marimo as moimport vega_datasets as dataimport timeimport pandas as pdimport datetimeimport altair as alt- return alt, data, datetime, mo, pd, time+ return alt, data, datetime, mo, pd@app.cell-def __(data, pd):+def _(data, pd):movies = data.data.movies()# convert to date@@ -382,25 +361,18 @@ def __(data, pd):@app.cell-def __(mo, pd):+def _(mo, pd):# min = movies["Release_Date"].min()# max = movies["Release_Date"].max()min = "2010-01-01"max = "2021-01-01"get_start_date, set_start_date = mo.state(pd.to_datetime(min))get_end_date, set_end_date = mo.state(pd.to_datetime(max))- return (- get_end_date,- get_start_date,- max,- min,- set_end_date,- set_start_date,- )+ return get_end_date, get_start_date, set_end_date, set_start_date@app.cell-def __(end_date, get_previous_date_range, movies, pd, start_date):+def _(end_date, get_previous_date_range, movies, pd, start_date):start = pd.to_datetime(start_date.value)end = pd.to_datetime(end_date.value)filtered_movies = movies[@@ -419,17 +391,15 @@ def __(end_date, get_previous_date_range, movies, pd, start_date):previous_end_date = endprevious_movies = filtered_moviesreturn (- end,filtered_movies,previous_end_date,previous_movies,previous_start_date,- start,)@app.cell-def __():+def _():returndiff --git a/examples/misc/notebook_dir.py b/examples/misc/notebook_dir.pyindex e778ed07ec..b9a54bd4ca 100644--- a/examples/misc/notebook_dir.py+++ b/examples/misc/notebook_dir.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -16,7 +16,7 @@ def _(mo):contents = f.read()mo.plain_text(contents)- return contents, f+ returnif __name__ == "__main__":diff --git a/examples/misc/pokemon_stats.py b/examples/misc/pokemon_stats.pyindex 37951fdaaf..9b00d2f543 100644--- a/examples/misc/pokemon_stats.py+++ b/examples/misc/pokemon_stats.py@@ -13,18 +13,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Pokémon Statistics 📊🔬""")return@app.cell(hide_code=True)-def __(clear_selection, mo, pokemon_types):+def _(clear_selection, mo, pokemon_types):mo.md(f"""Compare Pokémon by primary type, or drill down into@@ -37,28 +37,28 @@ def __(clear_selection, mo, pokemon_types):@app.cell-def __(pokemon):+def _(pokemon):types = pokemon.groupby(["Type 1"])["#"].count()types_name = list(types.keys())types_name.sort()- return types, types_name+ return (types_name,)@app.cell-def __(mo):+def _(mo):clear_selection = mo.ui.button(label="_Clear selection_")return (clear_selection,)@app.cell-def __(clear_selection, mo, types_name):+def _(clear_selection, mo, types_name):clear_selectionpokemon_types = mo.ui.multiselect(types_name)return (pokemon_types,)@app.cell-def __(mo):+def _(mo):attribute = mo.ui.dropdown({"HP": "HP",@@ -75,13 +75,13 @@ def __(mo):@app.cell-def __(mo, pokemon_types):+def _(mo, pokemon_types):mo.md("`selected types: " + ", ".join(pokemon_types.value) + "`") if pokemon_types.value else Nonereturn@app.cell-def __(mo, pokemon_types):+def _(mo, pokemon_types):mo.md("""**Compare distributions** by type or **drill down**@@ -92,7 +92,7 @@ def __(mo, pokemon_types):@app.cell-def __(pokemon, pokemon_types):+def _(pokemon, pokemon_types):def get_filtered_pokemon(value):if value == "All":return pokemon@@ -102,11 +102,11 @@ def __(pokemon, pokemon_types):filtered_pokemons = {}for pokemon_type in pokemon_types.value:filtered_pokemons[pokemon_type] = get_filtered_pokemon(pokemon_type)- return filtered_pokemons, get_filtered_pokemon, pokemon_type+ return (filtered_pokemons,)@app.cell-def __(distribution_plot, drilldown, mo, pokemon_types):+def _(distribution_plot, drilldown, mo, pokemon_types):mo.ui.tabs({"**Compare distributions**": distribution_plot,@@ -117,7 +117,7 @@ def __(distribution_plot, drilldown, mo, pokemon_types):@app.cell-def __(attribute, colors, filtered_pokemons, mo, plt, pokemon_types, sns):+def _(attribute, colors, filtered_pokemons, mo, plt, pokemon_types, sns):def plot():plt.figure(figsize=(6.5, 4))if attribute.value is not None:@@ -143,11 +143,11 @@ def __(attribute, colors, filtered_pokemons, mo, plt, pokemon_types, sns):distribution_plot = (plot() if pokemon_types.value else None)- return distribution_plot, plot+ return (distribution_plot,)@app.cell-def __(filtered_pokemons, mo, pokemon_types):+def _(filtered_pokemons, mo, pokemon_types):def make_table():records = [row@@ -158,11 +158,11 @@ def __(filtered_pokemons, mo, pokemon_types):table = make_table() if pokemon_types.value else None- return make_table, table+ return (table,)@app.cell-def __(mo, plot_pokemon, table):+def _(mo, plot_pokemon, table):_names = [v["Name"] for v in table.value] if table is not None else []stat_plot = plot_pokemon(_names)@@ -174,11 +174,11 @@ def __(mo, plot_pokemon, table):{mo.hstack([table, stat_plot], justify="start")}""")- return drilldown, stat_plot+ return (drilldown,)@app.cell-def __(pokemon):+def _(pokemon):def plot_single_pokemon(ax, angles, labels, name):pkmn = pokemon[pokemon.Name == name]@@ -199,7 +199,7 @@ def __(pokemon):@app.cell-def __(np, plot_single_pokemon, plt):+def _(np, plot_single_pokemon, plt):def plot_pokemon(names):fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))labels = np.array(@@ -219,7 +219,7 @@ def __(np, plot_single_pokemon, plt):@app.cell-def __():+def _():import marimo as moimport numpy as npimport pandas as pd@@ -233,11 +233,11 @@ def __():_downloaded = requests.get("https://gist.githubusercontent.com/armgilles/194bcff35001e7eb53a2a8b441e8b2c6/raw/92200bc0a673d5ce2110aaad4544ed6c4010f687/pokemon.csv").contentpokemon = pd.read_csv(io.BytesIO(_downloaded), encoding="utf8")pokemon = pokemon.drop(["Legendary", "Generation"], axis=1)- return io, mo, np, os, pd, plt, pokemon, requests, sns+ return mo, np, plt, pokemon, sns@app.cell-def __():+def _():# Defining colors for graphscolors = {"Bug": "#A6B91A",@@ -263,9 +263,9 @@ def __():@app.cell-def __():+def _():import plotly.express as px- return (px,)+ returnif __name__ == "__main__":diff --git a/examples/misc/public_folder.py b/examples/misc/public_folder.pyindex aad11ff3ad..e9e2a02511 100644--- a/examples/misc/public_folder.py+++ b/examples/misc/public_folder.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/misc/reactive_plots.py b/examples/misc/reactive_plots.pyindex e8287a6636..4c218e05fe 100644--- a/examples/misc/reactive_plots.py+++ b/examples/misc/reactive_plots.py@@ -9,31 +9,31 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Welcome to marimo!""")return@app.cell-def __(bars, mo, scatter):+def _(bars, mo, scatter):chart = mo.ui.altair_chart(scatter & bars)chartreturn (chart,)@app.cell-def __(chart, mo):+def _(chart, mo):(filtered_data := mo.ui.table(chart.value))return (filtered_data,)@app.cell-def __(alt, filtered_data, mo):+def _(alt, filtered_data, mo):mo.stop(not len(filtered_data.value))mpg_hist = mo.ui.altair_chart(alt.Chart(filtered_data.value)@@ -46,11 +46,11 @@ def __(alt, filtered_data, mo):.encode(alt.X("Horsepower:Q", bin=True), y="count()"))mo.hstack([mpg_hist, horsepower_hist], justify="space-around", widths="equal")- return horsepower_hist, mpg_hist+ return@app.cell-def __(alt, data):+def _(alt, data):cars = data.cars()brush = alt.selection_interval()scatter = (@@ -69,18 +69,18 @@ def __(alt, data):.encode(y="Origin:N", color="Origin:N", x="count(Origin):Q").transform_filter(brush))- return bars, brush, cars, scatter+ return bars, scatter@app.cell-def __():+def _():import altair as altfrom vega_datasets import datareturn alt, data@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/misc/seam_carving.py b/examples/misc/seam_carving.pyindex ee668f13e5..7522c0034f 100644--- a/examples/misc/seam_carving.py+++ b/examples/misc/seam_carving.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.9.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Seam Carving@@ -45,7 +45,7 @@ def __(mo):@app.cell(hide_code=True)-def __():+def _():import requestsinput_image = "The_Persistence_of_Memory.jpg"@@ -55,17 +55,17 @@ def __():with open(input_image, "wb") as handler:handler.write(img_data)- return handler, img_data, input_image, requests+ return (input_image,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Try it!""")return@app.cell-def __():+def _():import marimo as moslider = mo.ui.slider(@@ -81,17 +81,17 @@ def __():@app.cell-def __(efficient_seam_carve, input_image, mo, slider):+def _(efficient_seam_carve, input_image, mo, slider):with mo.persistent_cache("seam_carves"):scale_factor = slider.valueresult = efficient_seam_carve(input_image, scale_factor)mo.hstack([mo.image(input_image), mo.image(result)], justify="start")- return result, scale_factor+ return@app.cell-def __():+def _():import numpy as npfrom numba import jitfrom skimage import io, filters, transform@@ -170,20 +170,7 @@ def __():print(f"Seam carving completed in {end_time - start_time:.2f} seconds")return carved_img- return (- compute_energy_map,- efficient_seam_carve,- filters,- find_seam,- io,- jit,- np,- remove_seam,- rgb2gray,- seam_carving,- time,- transform,- )+ return (efficient_seam_carve,)if __name__ == "__main__":diff --git a/examples/misc/task_list.py b/examples/misc/task_list.pyindex 72fffe819c..ce7f8b77d4 100644--- a/examples/misc/task_list.py+++ b/examples/misc/task_list.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("# Task List").left()return@app.cell-def __(dataclass):+def _(dataclass):@dataclassclass Task:name: str@@ -27,14 +27,14 @@ def __(dataclass):@app.cell-def __(mo):+def _(mo):get_tasks, set_tasks = mo.state([])mutation_signal, set_mutation_signal = mo.state(False)return get_tasks, mutation_signal, set_mutation_signal, set_tasks@app.cell-def __(mo, mutation_signal):+def _(mo, mutation_signal):mutation_signaltask_entry_box = mo.ui.text(placeholder="a task ...")@@ -42,7 +42,7 @@ def __(mo, mutation_signal):@app.cell-def __(Task, mo, set_mutation_signal, set_tasks, task_entry_box):+def _(Task, mo, set_mutation_signal, set_tasks, task_entry_box):def add_task():if task_entry_box.value:set_tasks(lambda v: v + [Task(task_entry_box.value)])@@ -60,11 +60,11 @@ def __(Task, mo, set_mutation_signal, set_tasks, task_entry_box):lambda v: [task for task in v if not task.done]),)- return add_task, add_task_button, clear_tasks_button+ return add_task_button, clear_tasks_button@app.cell-def __(add_task_button, clear_tasks_button, mo, task_entry_box):+def _(add_task_button, clear_tasks_button, mo, task_entry_box):mo.hstack([task_entry_box, add_task_button, clear_tasks_button], justify="start")@@ -72,7 +72,7 @@ def __(add_task_button, clear_tasks_button, mo, task_entry_box):@app.cell-def __(Task, get_tasks, mo, set_tasks):+def _(Task, get_tasks, mo, set_tasks):task_list = mo.ui.array([mo.ui.checkbox(value=task.done, label=task.name) for task in get_tasks()],label="tasks",@@ -84,19 +84,19 @@ def __(Task, get_tasks, mo, set_tasks):@app.cell-def __(mo, task_list):+def _(mo, task_list):mo.as_html(task_list) if task_list.value else mo.md("No tasks! 🎉")return@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __():+def _():from dataclasses import dataclassreturn (dataclass,)diff --git a/examples/outputs/accordion.py b/examples/outputs/accordion.pyindex b6e37a6e9b..fc2e2d3d15 100644--- a/examples/outputs/accordion.py+++ b/examples/outputs/accordion.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/basic_markdown.py b/examples/outputs/basic_markdown.pyindex 76cbe8050d..6e0f0cb5cd 100644--- a/examples/outputs/basic_markdown.py+++ b/examples/outputs/basic_markdown.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/capture_console_outputs.py b/examples/outputs/capture_console_outputs.pyindex d0ba3b9abc..c2e1bc1186 100644--- a/examples/outputs/capture_console_outputs.py+++ b/examples/outputs/capture_console_outputs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@@ -16,7 +16,7 @@ def _(mo):print("Hello, world")mo.md(output.getvalue())- return (output,)+ returnif __name__ == "__main__":diff --git a/examples/outputs/cell_output.py b/examples/outputs/cell_output.pyindex df2db094f2..2f63357bec 100644--- a/examples/outputs/cell_output.py+++ b/examples/outputs/cell_output.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/conditional_output.py b/examples/outputs/conditional_output.pyindex 4458b70fcd..6f394511e4 100644--- a/examples/outputs/conditional_output.py+++ b/examples/outputs/conditional_output.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/console_outputs.py b/examples/outputs/console_outputs.pyindex f0d46b7cf9..6ff8aaa834 100644--- a/examples/outputs/console_outputs.py+++ b/examples/outputs/console_outputs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/dataframes.py b/examples/outputs/dataframes.pyindex 2064c67e0e..d428661f83 100644--- a/examples/outputs/dataframes.py+++ b/examples/outputs/dataframes.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/outputs/plots.py b/examples/outputs/plots.pyindex 13eebdc71c..453ea2b791 100644--- a/examples/outputs/plots.py+++ b/examples/outputs/plots.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@@ -38,7 +38,7 @@ def _(plt):x = np.linspace(0, 10)plt.plot(x, x**2)plt.gca()- return np, x+ return (x,)@app.cell(hide_code=True)diff --git a/examples/outputs/progress_bar.py b/examples/outputs/progress_bar.pyindex 5c0f912dbd..49a9d4d4e8 100644--- a/examples/outputs/progress_bar.py+++ b/examples/outputs/progress_bar.py@@ -1,19 +1,22 @@import marimo-+__generated_with = "0.15.5"app = marimo.App()+@app.celldef _():import marimo as moreturn (mo,)+@app.cell-def _(mo,):+def _(mo):rerun = mo.ui.button(label="Rerun")rerunreturn (rerun,)+@app.cellasync def _(mo, rerun):import asyncio@@ -31,4 +34,3 @@ async def _(mo, rerun):if __name__ == "__main__":app.run()-diff --git a/examples/outputs/showing_multiple_outputs.py b/examples/outputs/showing_multiple_outputs.pyindex 232063057e..fe25bb8263 100644--- a/examples/outputs/showing_multiple_outputs.py+++ b/examples/outputs/showing_multiple_outputs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@@ -16,7 +16,7 @@ def _(mo):mo.output.append(mo.md(f"$i = {i}$"))mo.output.append(mo.md("Completed iteration."))- return (i,)+ returnif __name__ == "__main__":diff --git a/examples/outputs/spinner.py b/examples/outputs/spinner.pyindex 25fa203107..fa3fe84e50 100644--- a/examples/outputs/spinner.py+++ b/examples/outputs/spinner.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@@ -27,7 +27,7 @@ async def _(mo, rerun):_spinner.update("Almost done")await asyncio.sleep(1)_spinner.update("Done")- return (asyncio,)+ returnif __name__ == "__main__":diff --git a/examples/outputs/stacks.py b/examples/outputs/stacks.pyindex a5face4e68..45db19d0a9 100644--- a/examples/outputs/stacks.py+++ b/examples/outputs/stacks.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/running_as_a_script/sharing_arguments.py b/examples/running_as_a_script/sharing_arguments.pyindex 39068c05b8..e549499845 100644--- a/examples/running_as_a_script/sharing_arguments.py+++ b/examples/running_as_a_script/sharing_arguments.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.31"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -66,7 +66,7 @@ def _(argparse, default):parser.add_argument("-iterations", default=default.value)args = parser.parse_args()print(args.iterations)- return args, parser+ returnif __name__ == "__main__":diff --git a/examples/running_as_a_script/textual_app.py b/examples/running_as_a_script/textual_app.pyindex cc7a1ac64b..67600a3266 100644--- a/examples/running_as_a_script/textual_app.py+++ b/examples/running_as_a_script/textual_app.py@@ -13,7 +13,7 @@ run with `python textual_app.py`import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App()with app.setup:diff --git a/examples/running_as_a_script/with_argparse.py b/examples/running_as_a_script/with_argparse.pyindex 67bb097daf..67e8ee5d5f 100644--- a/examples/running_as_a_script/with_argparse.py+++ b/examples/running_as_a_script/with_argparse.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.31"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/running_as_a_script/with_simple_parsing.py b/examples/running_as_a_script/with_simple_parsing.pyindex 7d7cd6cfe6..2f27c11176 100644--- a/examples/running_as_a_script/with_simple_parsing.py+++ b/examples/running_as_a_script/with_simple_parsing.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.11.31"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -21,7 +21,7 @@ def _():@app.celldef _():import simple_parsing- return (simple_parsing,)+ return@app.cell@@ -41,7 +41,7 @@ def _():learning_rate: float = 1e-4 # Help string for a float argumentparser.add_arguments(Options, dest="options")- return ArgumentParser, Options, dataclass, parser+ return Options, parser@app.cell@@ -55,14 +55,14 @@ def _(Options, mo, parser):else:args = parser.parse_args()return args.foo, args.options- return fields, parse_args+ return (parse_args,)@app.celldef _(parse_args):foo, options = parse_args()print(foo, options)- return foo, options+ returnif __name__ == "__main__":diff --git a/examples/running_cells/async_await.py b/examples/running_cells/async_await.pyindex a316730dc7..f80532fea5 100644--- a/examples/running_cells/async_await.py+++ b/examples/running_cells/async_await.py@@ -1,27 +1,25 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@app.celldef _():import marimo as mo- return (mo,)+ return-def wait_for():- async def wait_for(seconds):- import asyncio- print(f"Waiting for {seconds} seconds ...")- await asyncio.sleep(seconds)- print("Done!")- return (wait_for,)+async def wait_for(seconds):+ import asyncio+ print(f"Waiting for {seconds} seconds ...")+ await asyncio.sleep(seconds)+ print("Done!")@app.cell-async def _(wait_for):+async def _():await wait_for(1)returndiff --git a/examples/running_cells/basics.py b/examples/running_cells/basics.pyindex 5ed9118924..4a77dface3 100644--- a/examples/running_cells/basics.py+++ b/examples/running_cells/basics.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()@@ -35,7 +35,7 @@ def _():@app.celldef _():y = 1- return (y,)+ return@app.celldiff --git a/examples/running_cells/debugging.py b/examples/running_cells/debugging.pyindex e83fb354a0..d80e33b526 100644--- a/examples/running_cells/debugging.py+++ b/examples/running_cells/debugging.py@@ -1,19 +1,17 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()-def foo():- def foo(x):- breakpoint()- return 1 / x- return (foo,)+def foo(x):+ breakpoint()+ return 1 / x@app.cell-def _(foo):+def _():foo(1)returndiff --git a/examples/running_cells/in_memory_cache.py b/examples/running_cells/in_memory_cache.pyindex 60addb7705..7155abeaa4 100644--- a/examples/running_cells/in_memory_cache.py+++ b/examples/running_cells/in_memory_cache.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App(app_title="In Memory Cache")@@ -44,4 +44,4 @@ def _(sleep_for):if __name__ == "__main__":- app.run()\ No newline at end of file+ app.run()diff --git a/examples/running_cells/multiple_definitions.py b/examples/running_cells/multiple_definitions.pyindex 876ad5b009..20e07b6a6b 100644--- a/examples/running_cells/multiple_definitions.py+++ b/examples/running_cells/multiple_definitions.py@@ -5,9 +5,10 @@# "matplotlib==3.10.1",# ]# ///+import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/running_cells/persistent_cache.py b/examples/running_cells/persistent_cache.pyindex e171ed8a30..a1b17db941 100644--- a/examples/running_cells/persistent_cache.py+++ b/examples/running_cells/persistent_cache.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App(app_title="In Memory Cache")diff --git a/examples/sql/connect_to_motherduck.py b/examples/sql/connect_to_motherduck.pyindex 6b7498d115..3df6b80c2c 100644--- a/examples/sql/connect_to_motherduck.py+++ b/examples/sql/connect_to_motherduck.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.9.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# MotherDuck 🧡 marimo@@ -30,7 +30,7 @@ def __(mo):@app.cell(hide_code=True)-def __(__file__, md_token, mo):+def _(md_token, mo):callout = mo.md(f"""There is no **MotherDuck** token found in your environment. To set one up, go to the [MotherDuck's settings page](https://app.motherduck.com/settings/general), create a token, and copy it below.And re-run this notebook:@@ -44,27 +44,27 @@ def __(__file__, md_token, mo):mo.output.replace(mo.accordion({"Tired of logging in to MotherDuck?": callout}))- return (callout,)+ return@app.cell(hide_code=True)-def __():+def _():import osmd_token = os.environ.get("motherduck_token") or os.environ.get("MOTHERDUCK_TOKEN")- return md_token, os+ return (md_token,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Let's attach a remote MotherDuck database using `md:`""")return@app.cell-def __():+def _():import duckdbimport marimo as mo@@ -73,11 +73,11 @@ def __():)# or add your own md instance# duckdb.sql(f"ATTACH IF NOT EXISTS 'md:sample_data'")- return duckdb, mo, sample_data+ return duckdb, mo@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""!!! tip "Explore data sources"@@ -88,13 +88,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Let's make some queries 🦆""")return@app.cell-def __(mo):+def _(mo):most_shared_websites = mo.sql(f"""-- Most shared websites@@ -116,7 +116,7 @@ def __(mo):@app.cell-def __(hacker_news, mo, ranked_stories, sample_data):+def _(mo):most_commented_stories_each_month = mo.sql(f"""-- Most Commented Stories Each Month@@ -152,11 +152,11 @@ def __(hacker_news, mo, ranked_stories, sample_data):-- Which can be used in Python to create charts""")- return (most_commented_stories_each_month,)+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Let's make some charts 📈@@ -168,7 +168,7 @@ def __(mo):@app.cell-def __(most_shared_websites):+def _(most_shared_websites):import altair as altchart = (@@ -185,11 +185,11 @@ def __(most_shared_websites):)chart- return alt, chart+ return (alt,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Adding reactivity ⚡@@ -201,7 +201,7 @@ def __(mo):@app.cell-def __(MONTHS, duckdb, hacker_news, mo, sample_data):+def _(MONTHS, duckdb, mo):month_select = mo.ui.multiselect(MONTHS,label="Month",@@ -218,11 +218,11 @@ def __(MONTHS, duckdb, hacker_news, mo, sample_data):).df()hn_type_select = mo.ui.dropdown.from_series(hn_types["HN Type"], value="story")- return hn_type_select, hn_types, month_select+ return hn_type_select, month_select@app.cell(hide_code=True)-def __(hn_type_select, mo, month_select):+def _(hn_type_select, mo, month_select):month_list = ",".join([str(month) for month in month_select.value])mo.hstack([@@ -235,14 +235,7 @@ def __(hn_type_select, mo, month_select):@app.cell(hide_code=True)-def __(- hacker_news,- hn_type_select,- mo,- month_list,- ranked_stories,- sample_data,-):+def _(hn_type_select, mo, month_list):most_monthly_voted = mo.sql(f"""-- Most monthly voted@@ -287,7 +280,7 @@ def __(@app.cell(hide_code=True)-def __(alt, hn_type_select, most_monthly_voted):+def _(alt, hn_type_select, most_monthly_voted):_chart = (alt.Chart(most_monthly_voted).mark_circle()@@ -313,20 +306,20 @@ def __(alt, hn_type_select, most_monthly_voted):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Additional Reactivity ⚡⚡""")return@app.cell-def __(mo):+def _(mo):search_input = mo.ui.text(label="Search for keywords", value="duckdb")search_inputreturn (search_input,)@app.cell-def __(hacker_news, mo, sample_data, search_value):+def _(mo, search_value):keyword_results = mo.sql(f"""SELECT@@ -344,13 +337,13 @@ def __(hacker_news, mo, sample_data, search_value):@app.cell(hide_code=True)-def __(search_input):+def _(search_input):search_value = search_input.valuereturn (search_value,)@app.cell(hide_code=True)-def __(alt, keyword_results, mo, search_value):+def _(alt, keyword_results, mo, search_value):if keyword_results.is_empty():mo.stop(True, f"No results for {search_value}")@@ -386,7 +379,7 @@ def __(alt, keyword_results, mo, search_value):@app.cell(hide_code=True)-def __():+def _():MONTHS = {"January": 1,"February": 2,diff --git a/examples/sql/connect_to_persistent_db.py b/examples/sql/connect_to_persistent_db.pyindex e1a02674cb..62e60691c8 100644--- a/examples/sql/connect_to_persistent_db.py+++ b/examples/sql/connect_to_persistent_db.py@@ -1,34 +1,34 @@import marimo-__generated_with = "0.9.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Connect to duckdb [persistent storage](https://duckdb.org/docs/connect/overview.html#persistent-database) using the `ATTACH` command:""")return@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""ATTACH 'test.db' as test;SHOW ALL TABLES;""")- return (test,)+ return@app.cell-def __(mo, test, test_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM test.test_table;diff --git a/examples/sql/connect_to_postgres.py b/examples/sql/connect_to_postgres.pyindex e44ed68125..b65fee6838 100644--- a/examples/sql/connect_to_postgres.py+++ b/examples/sql/connect_to_postgres.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.9.1"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md(r"""# Connect to Postgres@@ -32,7 +32,7 @@ def __(mo):@app.cell(hide_code=True)-def __():+def _():import marimo as mo@@ -50,11 +50,11 @@ def __():download_sample_data()- return download_sample_data, mo+ return (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.accordion({"Tip: Creating SQL Cells": mo.md(@@ -74,15 +74,15 @@ def __(mo):@app.cell-def __():+def _():import osPASSWORD = os.getenv("PGPASSWORD", "mysecretpassword")- return PASSWORD, os+ return (PASSWORD,)@app.cell-def __(PASSWORD, mo):+def _(PASSWORD, mo):_df = mo.sql(f"""-- Boilerplate: detach the database so this cell works when you re-run it@@ -103,7 +103,7 @@ def __(PASSWORD, mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""Once the database is attached, you can query it with SQL. Note that this involves copying data from Postgres SQL and@@ -114,7 +114,7 @@ def __(mo):@app.cell-def __(db, mo, test_table):+def _(mo):_df = mo.sql(f"""-- Query your tables! This assumes a database with schema public and a sample table called test_table.@@ -125,7 +125,7 @@ def __(db, mo, test_table):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(f"""You can explore the schemas of all your tables at a glance in the **data sources panel**: click@@ -136,7 +136,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Copy data from Postgres to duckdb@@ -148,7 +148,7 @@ def __(mo):@app.cell-def __(db, duckdb_table, mo, test_table):+def _(mo):_df = mo.sql(f"""CREATE OR REPlACE TABLE duckdb_table AS FROM db.public.test_table;@@ -156,11 +156,11 @@ def __(db, duckdb_table, mo, test_table):SELECT * FROM duckdb_table;""")- return (duckdb_table,)+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Execute queries directly in PostgresSQL@@ -172,7 +172,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""SELECT * FROM postgres_query('db', 'SELECT * FROM test_table');diff --git a/examples/sql/connect_to_sqlite.py b/examples/sql/connect_to_sqlite.pyindex 60c8131529..aab4f13e1b 100644--- a/examples/sql/connect_to_sqlite.py+++ b/examples/sql/connect_to_sqlite.py@@ -12,7 +12,7 @@import marimo-__generated_with = "0.10.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -51,7 +51,7 @@ def _():download_sample_data()- return download_sample_data, mo+ return (mo,)@app.cell(hide_code=True)@@ -75,7 +75,7 @@ def _(mo):@app.cell-def _(INFORMATION_SCHEMA, TABLES, mo):+def _(mo):_df = mo.sql(f"""-- Boilerplate: detach the database so this cell works when you re-run it@@ -88,7 +88,7 @@ def _(INFORMATION_SCHEMA, TABLES, mo):SELECT table_name FROM INFORMATION_SCHEMA.TABLES where table_catalog == 'chinook';""")- return (chinook,)+ return@app.cell(hide_code=True)@@ -98,7 +98,7 @@ def _(mo):@app.cell-def _(chinook, mo, track):+def _(mo):_df = mo.sql(f"""SELECT composer, MEAN(Milliseconds) as avg_track_ms from chinook.track GROUP BY composer ORDER BY avg_track_ms DESC;diff --git a/examples/sql/duckdb_example.py b/examples/sql/duckdb_example.pyindex 68ed1b44ba..e0c0d3458e 100644--- a/examples/sql/duckdb_example.py+++ b/examples/sql/duckdb_example.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App(width="medium", sql_output="polars")@@ -40,7 +40,7 @@ def _(digits, mo):SELECT * FROM random_data;""")- return random_data, result+ return (result,)@app.celldiff --git a/examples/sql/histograms.py b/examples/sql/histograms.pyindex 19143bb517..bf01263c54 100644--- a/examples/sql/histograms.py+++ b/examples/sql/histograms.py@@ -12,12 +12,12 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md(r"""# SQL Histograms@@ -29,29 +29,29 @@ def __(mo):@app.cell-def __():+def _():import marimo as moimport duckdbimport polarsimport pyarrowimport altair as alt- return alt, duckdb, mo, polars, pyarrow+ return alt, mo@app.cell-def __():+def _():URL = "hf://datasets/scikit-learn/Fish/Fish.csv"return (URL,)@app.cell(hide_code=True)-def __(URL, mo):+def _(URL, mo):mo.md(rf"""First we read the dataset at: **{URL}**""")return@app.cell-def __(URL, dataset, mo):+def _(URL, mo):dataset = mo.sql(f"""CREATE OR REPLACE VIEW dataset AS@@ -64,7 +64,7 @@ def __(URL, dataset, mo):@app.cell-def __(dataset, mo):+def _(dataset, mo):column = mo.ui.dropdown(dataset.columns, value=dataset.columns[0], label="Choose a column")@@ -73,7 +73,7 @@ def __(dataset, mo):@app.cell-def __(column, mo):+def _(column, mo):histogram = mo.sql(f"""-- Use the duckdb histogram function@@ -84,13 +84,13 @@ def __(column, mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""Now we will take the histogram result and plot it using [Altair](https://altair-viz.github.io/).""")return@app.cell-def __(alt, histogram):+def _(alt, histogram):(alt.Chart(histogram).mark_bar()diff --git a/examples/sql/misc/database_explorer.py b/examples/sql/misc/database_explorer.pyindex 8a34e60b67..b6bd5231b9 100644--- a/examples/sql/misc/database_explorer.py+++ b/examples/sql/misc/database_explorer.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App(width="full")@@ -61,7 +61,7 @@ def _(database_url, duckdb):ATTACH DATABASE '{database_url.value}' AS my_db (TYPE postgres, READ_ONLY);""")- return (my_db,)+ return@app.cell@@ -181,7 +181,7 @@ def _(mo, table_select):@app.cell-def _(limit, mo, my_db, null, table_select_value):+def _(limit, mo, table_select_value):selected_table = mo.sql(f"""select * from my_db.{table_select_value} LIMIT {limit.value};diff --git a/examples/sql/misc/electric_vehicles.py b/examples/sql/misc/electric_vehicles.pyindex a029b1bba5..f6e52fd6ba 100644--- a/examples/sql/misc/electric_vehicles.py+++ b/examples/sql/misc/electric_vehicles.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Electric Vehicle Population Data@@ -28,7 +28,7 @@ def __(mo):@app.cell-def __(evs, mo):+def _(mo):evs = mo.sql(f"""create or replace table evs as@@ -36,38 +36,38 @@ def __(evs, mo):select * from evs""")- return (evs,)+ return@app.cell-def __(mo, years):+def _(mo, years):all_years = years["Model Year"]year_select = mo.ui.multiselect.from_series(years["Model Year"])- return all_years, year_select+ return (year_select,)@app.cell-def __(cities, mo):+def _(cities, mo):all_cities = cities["City"]city_select = mo.ui.multiselect.from_series(cities["City"])- return all_cities, city_select+ return (city_select,)@app.cell-def __(makes, mo):+def _(makes, mo):all_makes = makes["Make"]make_select = mo.ui.multiselect.from_series(makes["Make"])- return all_makes, make_select+ return (make_select,)@app.cell-def __(city_select, make_select, mo, year_select):+def _(city_select, make_select, mo, year_select):mo.hstack([year_select, city_select, make_select], justify="space-between")return@app.cell-def __(alt, grouped_by_city, mo):+def _(alt, grouped_by_city, mo):_chart = (alt.Chart(grouped_by_city).mark_bar()@@ -83,7 +83,7 @@ def __(alt, grouped_by_city, mo):@app.cell-def __(alt, grouped_by_make, mo):+def _(alt, grouped_by_make, mo):_chart = (alt.Chart(grouped_by_make).mark_bar()@@ -99,19 +99,19 @@ def __(alt, grouped_by_make, mo):@app.cell-def __(chart1, chart2, mo):+def _(chart1, chart2, mo):mo.hstack([chart1, chart2], widths="equal")return@app.cell-def __(mo):+def _(mo):mo.md(r"""## Appendix""")return@app.cell-def __(evs, mo):+def _(mo):years = mo.sql(f"""SELECT DISTINCT CAST(evs."Model Year" AS VARCHAR) AS "Model Year" FROM evs;@@ -121,7 +121,7 @@ def __(evs, mo):@app.cell-def __(evs, mo):+def _(mo):cities = mo.sql(f"""SELECT DISTINCT CAST(evs."City" AS VARCHAR) AS "City" FROM evs WHERE "City" != 'null';@@ -131,7 +131,7 @@ def __(evs, mo):@app.cell-def __(evs, mo):+def _(mo):makes = mo.sql(f"""SELECT DISTINCT CAST(evs."Make" AS VARCHAR) AS "Make" FROM evs;@@ -141,15 +141,7 @@ def __(evs, mo):@app.cell-def __(- cast_to_ints,- city_select,- evs,- make_select,- mo,- sql_list,- year_select,-):+def _(cast_to_ints, city_select, make_select, mo, sql_list, year_select):grouped_by_city = mo.sql(f"""SELECT COUNT(*) AS "count", "City", "Model Year"@@ -169,15 +161,7 @@ def __(@app.cell-def __(- cast_to_ints,- city_select,- evs,- make_select,- mo,- sql_list,- year_select,-):+def _(cast_to_ints, city_select, make_select, mo, sql_list, year_select):grouped_by_make = mo.sql(f"""SELECT COUNT(*) AS "count", "Make", "Model Year"@@ -197,7 +181,7 @@ def __(@app.cell-def __():+def _():def sql_list(column, items):if not items:return "True == True"@@ -211,11 +195,11 @@ def __():def cast_to_ints(items):return [int(i) for i in items]- return as_literal, cast_to_ints, sql_list+ return cast_to_ints, sql_list@app.cell-def __():+def _():# Importsimport marimo as moimport altair as altdiff --git a/examples/sql/misc/sql_cars.py b/examples/sql/misc/sql_cars.pyindex e20565efd0..98d4c58c1e 100644--- a/examples/sql/misc/sql_cars.py+++ b/examples/sql/misc/sql_cars.py@@ -9,22 +9,23 @@# "vega-datasets==0.9.0",# ]# ///+import marimo-__generated_with = "0.7.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(data):+def _(data):# Load the cars datasetcars_df = data.cars()cars_df["Year"] = cars_df["Year"].apply(lambda x: x.year)- return cars_df,+ return (cars_df,)@app.cell-def __(cars_df, mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE cars AS SELECT * FROM cars_df;@@ -34,7 +35,7 @@ def __(cars_df, mo):@app.cell-def __(cars_df, mo):+def _(cars_df, mo):origin = mo.ui.dropdown.from_series(cars_df["Origin"])year_range = mo.ui.range_slider.from_series(cars_df["Year"], show_value=True)top_n = mo.ui.number(value=5, start=1, stop=50, label="Top N Cars")@@ -43,15 +44,15 @@ def __(cars_df, mo):@app.cell-def __(origin):+def _(origin):origin_filter = (f"AND Origin = '{origin.value}'" if origin.value != None else "")- return origin_filter,+ return (origin_filter,)@app.cell-def __(mo, origin, top_n):+def _(mo, origin, top_n):mo.md(f"""##Top {top_n.value} Cars {f"in {origin.value}" if origin.value != None else ""} """)@@ -59,7 +60,7 @@ def __(mo, origin, top_n):@app.cell-def __(mo, origin_filter, top_n, year_range):+def _(mo, origin_filter, top_n, year_range):_df = mo.sql(f"""SELECT Name, Year, Origin, Horsepower, Miles_per_Gallon,@@ -75,13 +76,13 @@ def __(mo, origin_filter, top_n, year_range):@app.cell-def __(mo):+def _(mo):mo.md("""### Breakdown by Origin""")return@app.cell-def __(cars, mo, year_range):+def _(mo, year_range):_df = mo.sql(f"""WITH ranked_cars AS (@@ -107,7 +108,7 @@ def __(cars, mo, year_range):@app.cell-def __(alt, duckdb, mo, year_range):+def _(alt, duckdb, mo, year_range):_query = f"""SELECT Year,AVG(Horsepower) as Avg_Horsepower,@@ -139,11 +140,11 @@ def __(alt, duckdb, mo, year_range):))mo.ui.altair_chart(_chart, chart_selection=None)- return base, line1, line2+ return@app.cell(hide_code=True)-def __(alt, duckdb, mo, year_range):+def _(alt, duckdb, mo, year_range):_query = f"""SELECT Horsepower, Miles_per_Gallon, OriginFROM cars@@ -165,18 +166,18 @@ def __(alt, duckdb, mo, year_range):chart = mo.ui.altair_chart(_chart)chart- return chart,+ return (chart,)@app.cell-def __(chart, mo):+def _(chart, mo):mo.stop(chart.value.empty, mo.callout("Select cars from the chart above."))selected_cars = chart.value- return selected_cars,+ return@app.cell(hide_code=True)-def __(aggs, aggs_selected, mo):+def _(aggs, aggs_selected, mo):def title_case(title):return title.title().replace("_", " ")@@ -200,11 +201,11 @@ def __(aggs, aggs_selected, mo):for column in aggs.columns])- return diff, title_case+ return@app.cell(hide_code=True)-def __(cars, mo, selected_cars):+def _(mo):aggs_selected = mo.sql("""SELECTCOUNT(*) as count,@@ -232,7 +233,7 @@ def __(cars, mo, selected_cars):@app.cell-def __():+def _():import marimo as moimport duckdbimport altair as altdiff --git a/examples/sql/parametrizing_sql_queries.py b/examples/sql/parametrizing_sql_queries.pyindex 4900d790bc..4b6b6ea5a5 100644--- a/examples/sql/parametrizing_sql_queries.py+++ b/examples/sql/parametrizing_sql_queries.py@@ -11,18 +11,18 @@import marimo-__generated_with = "0.9.1"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Parametrizing SQL Queries@@ -36,33 +36,33 @@ def __(mo):@app.cell-def __():+def _():from vega_datasets import datadf = data.iris()df- return data, df+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""Next, we create a dropdown that selects the iris species.""")return@app.cell-def __(mo):+def _(mo):species_dropdown = mo.ui.dropdown(["setosa", "versicolor", "virginica"], value="setosa")species_dropdownreturn (species_dropdown,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Next, we **create a SQL cell** that filters the table to the selected species.-+Notice that we can reference the Python variable `species_dropdown` in our queryusing **curly braces**. This is because marimo represents SQL queries as Pythonf-strings.@@ -72,16 +72,16 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.accordion({"Tip: Creating SQL Cells": mo.md(f"""Create a SQL cell in one of two ways:-+1. Click the {mo.icon("lucide:database")} `SQL` button at the **bottom of your notebook**2. **Right-click** the {mo.icon("lucide:circle-plus")} button to the **left of a cell**, and choose `SQL`.-+In the SQL cell, you can query dataframes in your notebook as ifthey were tables — just reference them by name."""@@ -92,7 +92,7 @@ def __(mo):@app.cell-def __(df, mo, species_dropdown):+def _(mo, species_dropdown):result = mo.sql(f"""SELECT * FROM df where species == '{species_dropdown.value}'@@ -102,7 +102,7 @@ def __(df, mo, species_dropdown):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""The query output is returned to Python as a dataframe (Polars if you have it installed, Pandas otherwise).@@ -118,7 +118,7 @@ def __(mo):@app.cell-def __(result):+def _(result):resultreturndiff --git a/examples/sql/querying_dataframes.py b/examples/sql/querying_dataframes.pyindex 01c2c2939c..6b8d64421d 100644--- a/examples/sql/querying_dataframes.py+++ b/examples/sql/querying_dataframes.py@@ -11,18 +11,18 @@import marimo-__generated_with = "0.9.1"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Querying dataframes@@ -36,22 +36,22 @@ def __(mo):@app.cell-def __():+def _():from vega_datasets import datadf = data.iris()df.head()- return data, df+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(f"""Next, we **create a SQL cell**.-+Create a SQL cell in one of two ways:-+1. Click the {mo.icon("lucide:database")} `SQL` button at the **bottom of your notebook**2. **Right-click** the {mo.icon("lucide:circle-plus")} button to the **left of a cell**, and choose `SQL`.@@ -62,7 +62,7 @@ def __(mo):@app.cell-def __(df, mo):+def _(mo):result = mo.sql(f"""SELECT species, mean(petalLength) as meanPetalLength FROM df GROUP BY species ORDER BY meanPetalLength@@ -72,7 +72,7 @@ def __(df, mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""The query output is returned to Python as a dataframe (Polars if you have it installed, Pandas otherwise).@@ -86,7 +86,7 @@ def __(mo):@app.cell-def __(result):+def _(result):resultreturndiff --git a/examples/sql/read_csv.py b/examples/sql/read_csv.pyindex 5e963a1431..5f59f19519 100644--- a/examples/sql/read_csv.py+++ b/examples/sql/read_csv.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -33,7 +33,7 @@ def _():import polars as plpl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_csv("data.csv")- return mo, pl+ return (mo,)@app.cell(hide_code=True)@@ -118,11 +118,11 @@ def _(mo):CREATE TABLE myTable AS SELECT * FROM "data.csv"""")- return (myTable,)+ return@app.cell-def _(mo, myTable):+def _(mo):_df = mo.sql(f"""SELECT * FROM myTablediff --git a/examples/sql/read_json.py b/examples/sql/read_json.pyindex 9162672ad7..09ab509d41 100644--- a/examples/sql/read_json.py+++ b/examples/sql/read_json.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.10.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -33,7 +33,7 @@ def _():import polars as plpl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_json("data.json")- return mo, pl+ return (mo,)@app.cell(hide_code=True)@@ -128,11 +128,11 @@ def _(mo):CREATE OR REPLACE TABLE myTable AS SELECT * FROM 'data.json'""")- return (myTable,)+ return@app.cell-def _(mo, myTable):+def _(mo):_df = mo.sql(f"""SELECT * FROM myTablediff --git a/examples/sql/read_parquet.py b/examples/sql/read_parquet.pyindex 3f7da99961..369e4ad7d2 100644--- a/examples/sql/read_parquet.py+++ b/examples/sql/read_parquet.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.9.1"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Read Parquet@@ -28,22 +28,22 @@ def __(mo):@app.cell(hide_code=True)-def __():+def _():import marimo as moimport polars as plpl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_parquet("data.parquet")- return mo, pl+ return (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Reading from a Parquet file is as easy as `SELECT * from "data.parquet"`, where `data.parquet` is the path or URL to your parquet file.""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.accordion({"Tip: Creating SQL Cells": mo.md(@@ -63,7 +63,7 @@ def __(mo):@app.cell-def __(data, mo):+def _(mo):result = mo.sql(f"""-- Tip: you can also specify the data files using a glob, such as '/path/to/*.parquet'@@ -75,7 +75,7 @@ def __(data, mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.accordion({"Tip: Query output": mo.md(@@ -93,13 +93,13 @@ def __(mo):@app.cell-def __(result):+def _(result):resultreturn@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Create an in-memory table from a Parquet file@@ -111,17 +111,17 @@ def __(mo):@app.cell-def __(data, mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE myTable AS SELECT * FROM 'data.parquet'""")- return (myTable,)+ return@app.cell-def __(mo, myTable):+def _(mo):_df = mo.sql(f"""SELECT * FROM myTable@@ -131,13 +131,13 @@ def __(mo, myTable):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""## Advanced usage""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""To customize how your parquet file is read, use [duckdb's `read_parquet` function](https://duckdb.org/docs/data/parquet/overview.html).""")returndiff --git a/examples/testing/running_doctests.py b/examples/testing/running_doctests.pyindex 979dac391a..d92fa19d6f 100644--- a/examples/testing/running_doctests.py+++ b/examples/testing/running_doctests.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -10,30 +10,28 @@ def _():return (mo,)-def _():- def euclid_mcd(a: int, b: int) -> int:- """Return the MCD between positive a, b.- >>> euclid_mcd(42, 24)- 6- >>> euclid_mcd(24, 42)- 6- >>> euclid_mcd(42, 42)- 42- """- assert a > 0- assert b > 0- if a < b:- a, b = b, a- if (a != b):- r = a - b- return euclid_mcd(b, r)- return a- return (euclid_mcd,)+def euclid_mcd(a: int, b: int) -> int:+ """Return the MCD between positive a, b.+ >>> euclid_mcd(42, 24)+ 6+ >>> euclid_mcd(24, 42)+ 6+ >>> euclid_mcd(42, 42)+ 42+ """+ assert a > 0+ assert b > 0+ if a < b:+ a, b = b, a+ if (a != b):+ r = a - b+ return euclid_mcd(b, r)+ return a@app.cell-def _(euclid_mcd, mo):+def _(mo):# Include a reference to each function to testeuclid_mcd@@ -41,7 +39,7 @@ def _(euclid_mcd, mo):failures, success = doctest.testmod(verbose=True)mo.md(f"Success: {success}, Failures: {failures}")- return doctest, failures, success+ returnif __name__ == "__main__":diff --git a/examples/testing/test_with_pytest.py b/examples/testing/test_with_pytest.pyindex a8bad13601..78b7fff421 100644--- a/examples/testing/test_with_pytest.py+++ b/examples/testing/test_with_pytest.py@@ -1,24 +1,25 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()-def _():- def inc(x):- return x + 1- return inc+def inc(x):+ return x + 1@app.cell-def test_answer(inc):+def test_answer():assert inc(3) == 5, "This test fails"+ return@app.cell-def test_sanity(inc):+def test_sanity():assert inc(3) == 4, "This test passes"+ return+if __name__ == "__main__":- app.run()+ app.run()diff --git a/examples/third_party/aframe/aframe_example.py b/examples/third_party/aframe/aframe_example.pyindex 654322a036..043710f837 100644--- a/examples/third_party/aframe/aframe_example.py+++ b/examples/third_party/aframe/aframe_example.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(Aframe, xyz):+def _(Aframe, xyz):a = Aframe()a.set_scene(background="color: #ECECEC; fog: type: exponential; color: #AAA; density: 0.05"@@ -48,13 +48,13 @@ def __(Aframe, xyz):@app.cell-def __(a, mo):+def _(a, mo):mo.iframe(a.generate())return@app.cell-def __():+def _():import marimo as mofrom aframe import Aframe, xyzreturn Aframe, mo, xyzdiff --git a/examples/third_party/anywidget/reactive_quak.py b/examples/third_party/anywidget/reactive_quak.pyindex e2cb3de64e..543e74a988 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.13.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/third_party/anywidget/tldraw_colorpicker.py b/examples/third_party/anywidget/tldraw_colorpicker.pyindex 90729fb0c8..3a02482322 100644--- a/examples/third_party/anywidget/tldraw_colorpicker.py+++ b/examples/third_party/anywidget/tldraw_colorpicker.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as npplt.style.use('_mpl-gallery')@@ -31,22 +31,22 @@ def __():@app.cell-def __():+def _():from tldraw import ReactiveColorPickerimport marimo as mowidget = mo.ui.anywidget(ReactiveColorPicker())- return ReactiveColorPicker, mo, widget+ return mo, widget@app.cell-def __(mo, np, opacity, plt, sizes, widget, x, y):+def _(mo, np, opacity, plt, sizes, widget, x, y):fig, ax = plt.subplots()fig.set_size_inches(3, 3)ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8))ax.scatter(x, y, s=sizes*5, color=widget.color or None, alpha=opacity)mo.hstack([widget, plt.gca()], justify="start", widths=[1, 1])- return ax, fig+ returnif __name__ == "__main__":diff --git a/examples/third_party/chroma/multimodal_retrieval.py b/examples/third_party/chroma/multimodal_retrieval.pyindex ddbaa8ba3c..be1153cb28 100644--- a/examples/third_party/chroma/multimodal_retrieval.py+++ b/examples/third_party/chroma/multimodal_retrieval.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/third_party/cvxpy/regularization_and_sparsity.py b/examples/third_party/cvxpy/regularization_and_sparsity.pyindex 4ff8a0e31f..fbfb69bd93 100644--- a/examples/third_party/cvxpy/regularization_and_sparsity.py+++ b/examples/third_party/cvxpy/regularization_and_sparsity.py@@ -10,18 +10,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Regularization and Sparsity""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""This app shows how the choice of regularization in a least squares regression@@ -59,14 +59,14 @@ def __(mo):@app.cell-def __():+def _():m = 100n = 20return m, n@app.cell-def __(m, n, np):+def _(m, n, np):np.random.seed(0)A = np.random.randn(m, n)b = np.random.randn(m)@@ -74,14 +74,14 @@ def __(m, n, np):@app.cell-def __(A, b, sparse_solver):+def _(A, b, sparse_solver):l2_solver = sparse_solver(A, b, p=2)l1_solver = sparse_solver(A, b, p=1)return l1_solver, l2_solver@app.cell-def __(functools, l1_solver, l2_solver, np, sparsity_parameter):+def _(functools, l1_solver, l2_solver, np, sparsity_parameter):x_min_max= [np.inf, -np.inf]@functools.cache@@ -89,17 +89,17 @@ def __(functools, l1_solver, l2_solver, np, sparsity_parameter):return l2_solver(lambd), l1_solver(lambd)x_l2, x_l1 = solve(sparsity_parameter.value)- return solve, x_l1, x_l2, x_min_max+ return x_l1, x_l2, x_min_max@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""## Parameter selection""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):sparsity_parameter = mo.ui.slider(0, 10, step=0.1)mo.md(f"""@@ -109,7 +109,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo, n, number_of_zeros, sparsity_parameter, x_l1, x_l2):+def _(mo, n, number_of_zeros, sparsity_parameter, x_l1, x_l2):(mo.md("""@@ -138,17 +138,17 @@ def __(mo, n, number_of_zeros, sparsity_parameter, x_l1, x_l2):@app.cell-def __(cdf, plt, x_l1, x_l2):+def _(cdf, plt, x_l1, x_l2):cdf_figure, cdf_axs = plt.subplots(2, 1, sharex=True)cdf(x_l1, cdf_axs[0]).set_title("$p=1$")cdf(x_l2, cdf_axs[1]).set_title("$p=2$")plt.tight_layout()cdf_figure- return cdf_axs, cdf_figure+ return@app.cell-def __(mo):+def _(mo):mo.md("""## Sparsity@@ -166,14 +166,14 @@ def __(mo):@app.cell-def __(np):+def _(np):def number_of_zeros(x):return np.isclose(x, 0).sum()return (number_of_zeros,)@app.cell-def __(np, x_min_max):+def _(np, x_min_max):def cdf(x, ax):heights = np.arange(1, x.size+1) / x.sizexs = np.sort(x)@@ -190,7 +190,7 @@ def __(np, x_min_max):@app.cell-def __(cp):+def _(cp):def sparse_solver(A, b, p):x = cp.Variable(A.shape[1])lambd = cp.Parameter(nonneg=True)@@ -208,7 +208,7 @@ def __(cp):@app.cell-def __():+def _():import cvxpy as cpimport matplotlib.pyplot as pltimport numpy as np@@ -216,13 +216,13 @@ def __():@app.cell-def __():+def _():import functoolsreturn (functools,)@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/cvxpy/signals/app.py b/examples/third_party/cvxpy/signals/app.pyindex c9bc7f464a..99eee86616 100644--- a/examples/third_party/cvxpy/signals/app.py+++ b/examples/third_party/cvxpy/signals/app.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.1.4"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("# Signal Decomposition")return@app.cell-def __(mo):+def _(mo):mo.md("""This app is a hands-on introduction to _signal decomposition_, an@@ -23,7 +23,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""The simpler signals that come out of a decomposition are called@@ -38,7 +38,7 @@ def __(mo):@app.cell-def __(complib, mo):+def _(complib, mo):component_options = [complib.Components.TREND_LINE,complib.Components.PERIODIC,@@ -61,25 +61,24 @@ def __(complib, mo):component_radio,get_component_radio_tracker,other_component_radio,- set_component_radio_tracker,)@app.cell-def __(component_options, get_component_radio_tracker):+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,+ return (user_tried_all_components,)@app.cell-def __(component_radio, other_component_radio):+def _(component_radio, other_component_radio):radios = [component_radio, other_component_radio]- return radios,+ return (radios,)@app.cell-def __(intro_problem, mo):+def _(intro_problem, mo):intro = intro_problem.IntroProblem()mo.md(@@ -91,11 +90,11 @@ def __(intro_problem, mo):{mo.as_html(intro.plot())}""")- return intro,+ return (intro,)@app.cell-def __(get_show_third_component, mo):+def _(get_show_third_component, mo):_n_components = "2" if not get_show_third_component() else "3"_three_component_text = " and third " if get_show_third_component() else ""@@ -122,7 +121,7 @@ def __(get_show_third_component, mo):@app.cell-def __(get_show_third_component, intro, mo, radios):+def _(get_show_third_component, intro, mo, radios):# Show radios(mo.hstack(@@ -143,7 +142,7 @@ def __(get_show_third_component, intro, mo, radios):@app.cell-def __(get_show_third_component, intro, mo, radios):+def _(get_show_third_component, intro, mo, radios):# Plot 3-component decomposition(None@@ -163,7 +162,7 @@ def __(get_show_third_component, intro, mo, radios):@app.cell-def __(explainer, get_show_third_component, mo, radios):+def _(explainer, get_show_third_component, mo, radios):# Component explainer callout(mo.md(explainer.explainer(radios[0].value)).callout(kind="neutral")@@ -174,7 +173,7 @@ def __(explainer, get_show_third_component, mo, radios):@app.cell-def __(mo):+def _(mo):get_show_third_component, set_show_third_component = mo.state(False)add_component_button = mo.ui.button(@@ -189,12 +188,11 @@ def __(mo):add_component_button,get_show_third_component,remove_component_button,- set_show_third_component,)@app.cell-def __(+def _(add_component_button,get_show_third_component,mo,@@ -222,7 +220,7 @@ def __(@app.cell-def __():+def _():class StickyBool:value = False@@ -235,11 +233,11 @@ def __():solved_ever = StickyBool()- return StickyBool, solved_ever+ return (solved_ever,)@app.cell-def __(complib, radios, solved_ever):+def _(complib, radios, solved_ever):_chosen_components = set([r.value for r in radios])@@ -255,11 +253,11 @@ def __(complib, radios, solved_ever):)if solved.now:solved_ever.set()- return Solved, solved+ return (solved,)@app.cell-def __(get_show_third_component, mo, solved):+def _(get_show_third_component, mo, solved):# Solved callout(mo.md(@@ -290,7 +288,7 @@ def __(get_show_third_component, mo, solved):@app.cell-def __(mo, solved):+def _(mo, solved):(mo.md("""**Heads up!**@@ -311,7 +309,7 @@ def __(mo, solved):@app.cell-def __(+def _(get_show_third_component,mo,remove_component_button,@@ -340,13 +338,13 @@ def __(@app.cell-def __(mo):+def _(mo):mo.md("## Part 2: More Decompositions")return@app.cell-def __(mo, problems):+def _(mo, problems):selected_problem = mo.ui.dropdown({problems.MaunaLoa.name(): problems.MaunaLoa,@@ -357,11 +355,11 @@ def __(mo, problems):},label="Choose a signal:",)- return selected_problem,+ return (selected_problem,)@app.cell-def __(mo, selected_problem, solved):+def _(mo, selected_problem, solved):# Solve part 1 callout(mo.md(@@ -390,14 +388,14 @@ def __(mo, selected_problem, solved):@app.cell-def __(mo):+def _(mo):data_uploader = mo.ui.file(filetypes=[".csv"], kind="area")csv_has_header = mo.ui.checkbox(value=True)return csv_has_header, data_uploader@app.cell-def __(csv_has_header, data_uploader, mo):+def _(csv_has_header, data_uploader, mo):def read_uploaded_csv():from io import BytesIOimport pandas as pd@@ -434,7 +432,7 @@ def __(csv_has_header, data_uploader, mo):@app.cell-def __(data_uploader, mo, problems, selected_problem, show_csv_parameters):+def _(data_uploader, mo, problems, selected_problem, show_csv_parameters):mo.stop(selected_problem.value != problems.CustomDataProblem)mo.md(@@ -453,7 +451,7 @@ def __(data_uploader, mo, problems, selected_problem, show_csv_parameters):@app.cell-def __(+def _(column_name,data_uploader,mo,@@ -508,7 +506,7 @@ def __(@app.cell-def __(mo, set_k):+def _(mo, set_k):add_button = mo.ui.button(on_change=lambda _: set_k(lambda v: v + 1),label="Add a component",@@ -522,13 +520,7 @@ def __(mo, set_k):@app.cell-def __(- complib,- get_k,- get_selected_components,- mo,- set_selected_components,-):+def _(complib, get_k, get_selected_components, mo, set_selected_components):def _get_default_component_value(index):if index >= len(get_selected_components()):return None@@ -547,17 +539,11 @@ def __(component_array = mo.ui.array(_dropdowns, label="Components", on_change=set_selected_components)- return component_array,+ return (component_array,)@app.cell-def __(- complib,- component_array,- get_selected_params,- mo,- set_selected_params,-):+def _(complib, component_array, get_selected_params, mo, set_selected_params):component_params = mo.ui.dictionary({f"{i}": complib.parameter_controls(@@ -569,11 +555,11 @@ def __(label="Parameters",on_change=set_selected_params,)- return component_params,+ return (component_params,)@app.cell-def __(mo, problem):+def _(mo, problem):mo.stop(problem is None)mo.md(f"### {problem.name()}")@@ -581,7 +567,7 @@ def __(mo, problem):@app.cell-def __(mo, problem):+def _(mo, problem):mo.stop(problem is None)problem.description()@@ -589,7 +575,7 @@ def __(mo, problem):@app.cell-def __(add_button, mo, problem, remove_button):+def _(add_button, mo, problem, remove_button):mo.stop(problem is None)mo.md(@@ -601,7 +587,7 @@ def __(add_button, mo, problem, remove_button):@app.cell-def __(component_array, component_params, mo, problem):+def _(component_array, component_params, mo, problem):mo.stop(problem is None)mo.hstack([component_array, component_params])@@ -609,7 +595,7 @@ def __(component_array, component_params, mo, problem):@app.cell-def __(+def _(complib,component_array,component_params,@@ -648,11 +634,11 @@ def __(label="Aggregates",on_change=set_selected_aggregate_components,)- return aggregates,+ return (aggregates,)@app.cell-def __(+def _(aggregates,complib,get_selected_aggregate_params,@@ -679,11 +665,11 @@ def __()(mo.hstack([aggregates, aggregate_params]) if aggregates.value else None)- return aggregate_params, defaults+ return (aggregate_params,)@app.cell-def __(aggregate_params, aggregates, component_params):+def _(aggregate_params, aggregates, component_params):def _rollup_aggregate_params(aggregates, aggregate_params, params_dict):params_dict = params_dict.copy()for component_key, components in aggregates.items():@@ -699,26 +685,26 @@ def __(aggregate_params, aggregates, component_params):rolled_up_params = _rollup_aggregate_params(aggregates.value, aggregate_params.value, component_params.value)- return rolled_up_params,+ return (rolled_up_params,)@app.cell-def __(component_array):+def _(component_array):noise_component_selected = component_array.value[0] is not None- return noise_component_selected,+ return (noise_component_selected,)@app.cell-def __(component_array, noise_component_selected, problem):+def _(component_array, noise_component_selected, problem):should_compute_decomposition = (noise_component_selectedand sum(1 for v in component_array.value if v is not None) >= 2) and problem is not None- return should_compute_decomposition,+ return (should_compute_decomposition,)@app.cell-def __(+def _(component_array,mo,noise_component_selected,@@ -755,7 +741,7 @@ def __(@app.cell-def __(complib, problem, problems):+def _(complib, problem, problems):def construct_components(names, parameters):center_periodic = isinstance(problem, problems.MaunaLoa)return list(@@ -767,21 +753,21 @@ def __(complib, problem, problems):],))- return construct_components,+ return (construct_components,)@app.cell-def __(construct_components):+def _(construct_components):def decompose(problem, components, params):c = construct_components(components, params)f = problem.decompose(c)f.set_figwidth(6.4)return f- return decompose,+ return (decompose,)@app.cell-def __(+def _(component_array,decompose,mo,@@ -809,13 +795,13 @@ def __(@app.cell-def __(complib, mo):+def _(complib, mo):explainer_choice = mo.ui.dropdown(complib.COMPONENT_LIBRARY)- return explainer_choice,+ return (explainer_choice,)@app.cell-def __(explainer_choice, mo, solved):+def _(explainer_choice, mo, solved):mo.stop(not solved.ever)mo.md(@@ -829,7 +815,7 @@ def __(explainer_choice, mo, solved):@app.cell-def __(explainer, explainer_choice, mo):+def _(explainer, explainer_choice, mo):mo.md(explainer.explainer(explainer_choice.value)).callout() if explainer_choice.value is not None else ""@@ -837,7 +823,7 @@ def __(explainer, explainer_choice, mo):@app.cell-def __(mo, solved):+def _(mo, solved):mo.stop(not solved.ever)mo.md(@@ -857,17 +843,17 @@ def __(mo, solved):@app.cell-def __():+def _():import gfosdimport gfosd.components as gfcimport numpy as npimport marimo as moimport matplotlib.pyplot as plt- return gfc, gfosd, mo, np, plt+ return mo, plt@app.cell-def __():+def _():import importlibimport modules.components as complibimport modules.intro_problem as intro_problem@@ -879,7 +865,7 @@ def __():_ = importlib.reload(explainer)_ = importlib.reload(problems)_ = importlib.reload(intro_problem)- return complib, explainer, importlib, intro_problem, problems+ return complib, explainer, intro_problem, problemsif __name__ == "__main__":diff --git a/examples/third_party/cvxpy/signals/examples.py b/examples/third_party/cvxpy/signals/examples.pyindex f0a247e82b..2dc698b025 100644--- a/examples/third_party/cvxpy/signals/examples.py+++ b/examples/third_party/cvxpy/signals/examples.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.0.1a0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("# Examples")return@@ -30,7 +30,7 @@ def _(dataloaders, mo, plt):co2_df.plot(y="average", x="decimal", ax=plt.gca())plt.tight_layout()mo.tree([co2_df.head(2), plt.gca()], label="data")- return co2_df,+ return (co2_df,)@app.cell@@ -40,7 +40,7 @@ def _(co2_df, mo, solutions):mo.tree([co2_problem.plot_decomposition(figsize=(6, 5))], label="decomposition")- return co2_problem,+ return (co2_problem,)@app.cell@@ -72,7 +72,7 @@ def _(dataloaders, mo, plt):],label="data",)- return pv_df,+ return (pv_df,)@app.cell@@ -83,7 +83,7 @@ def _(mo, pv_df, solutions):[pv_problem.plot_decomposition(exponentiate=True, figsize=(6, 5))],label="decomposition",)- return pv_problem,+ return@app.cell@@ -127,7 +127,7 @@ def _(bcd_X_real, bcd_y, mo, solutions):],label="decomposition",)- return bcd_problem_ncvx,+ return@app.cell@@ -144,7 +144,7 @@ def _(bcd_X_real, bcd_y, mo, solutions):[bcd_problem.plot_decomposition(X_real=bcd_X_real, figsize=(6, 5))],"decomposition",)- return bcd_problem,+ return@app.cell@@ -175,7 +175,7 @@ def _(hcd_X_real, hcd_y, mo, solutions):[hcd_problem.plot_decomposition(X_real=hcd_X_real, figsize=(6, 5))],"decomposition",)- return hcd_problem,+ return@app.cell@@ -200,7 +200,7 @@ def _(dataloaders, mo, plt):plt.legend(loc=3)plt.title(_name)mo.tree([plt.gca()], label="data")- return ss_df,+ return (ss_df,)@app.cell@@ -212,24 +212,24 @@ def _(mo, np, plt, solutions, ss_df):_fig.axes[1].set_ylim(_avg - 2.5, _avg + 2.5)plt.tight_layout()mo.tree([plt.gca()], "decomposition")- return ss_problem,+ return@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as npimport pandas as pdimport modules.dataloaders as dataloadersimport modules.solutions as solutions- return dataloaders, np, pd, plt, solutions+ return dataloaders, np, plt, solutions@app.celldef _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/examples/third_party/cvxpy/smallest_enclosing_circle.py b/examples/third_party/cvxpy/smallest_enclosing_circle.pyindex ded8bbaae4..bcfd46d67c 100644--- a/examples/third_party/cvxpy/smallest_enclosing_circle.py+++ b/examples/third_party/cvxpy/smallest_enclosing_circle.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Smallest Enclosing Circle@@ -34,7 +34,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):number_of_circles = mo.ui.slider(1, 15, value=3, label='Number of circles')number_of_circles@@ -42,7 +42,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo, number_of_circles):+def _(mo, number_of_circles):resample_button = mo.ui.button(label='Click this button')mo.md(f"""@@ -54,7 +54,7 @@ def __(mo, number_of_circles):@app.cell(hide_code=True)-def __(np):+def _(np):def generate_circles(number_of_circles):circles = []for i in range(number_of_circles):@@ -66,7 +66,7 @@ def __(np):@app.cell(hide_code=True)-def __(generate_circles, number_of_circles, resample_button):+def _(generate_circles, number_of_circles, resample_button):resample_buttoncircles = generate_circles(number_of_circles.value)@@ -74,13 +74,13 @@ def __(generate_circles, number_of_circles, resample_button):@app.cell-def __(circles, smallest_enclosing_circle):+def _(circles, smallest_enclosing_circle):center, radius = smallest_enclosing_circle(circles)return center, radius@app.cell-def __(center, circles, plot_circle, plt, radius):+def _(center, circles, plot_circle, plt, radius):for (c_i, r_i) in circles:plot_circle(c_i, r_i, color='gray')plot_circle(center, radius, color='green', label='smallest enclosing circle')@@ -89,11 +89,11 @@ def __(center, circles, plot_circle, plt, radius):plt.legend(loc='upper right')plt.gcf().set_size_inches((6, 6))plt.gca()- return c_i, r_i+ return@app.cell-def __(plt):+def _(plt):def plot_circle(center, radius, ax=None, **kwargs):ax = plt.gca() if ax is None else axax.add_patch(plt.Circle(center, radius, fill=False, **kwargs))@@ -102,13 +102,13 @@ def __(plt):@app.cell-def __(mo):+def _(mo):mo.md("""## The solution method""")return@app.cell-def __(mo):+def _(mo):mo.md(r"""We can write down a convex optimization problem whose solution gives us@@ -152,7 +152,7 @@ def __(mo):@app.cell-def __(cp):+def _(cp):def smallest_enclosing_circle(circles):radius = cp.Variable()center = cp.Variable(2)@@ -167,7 +167,7 @@ def __(cp):@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as npimport cvxpy as cp@@ -175,7 +175,7 @@ def __():@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/databricks/databricks_connect.py b/examples/third_party/databricks/databricks_connect.pyindex f66b827fda..e784891aa2 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.13.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/third_party/duckdb/duckdb_example.py b/examples/third_party/duckdb/duckdb_example.pyindex 3099fd68e7..8cd4003fee 100644--- a/examples/third_party/duckdb/duckdb_example.py+++ b/examples/third_party/duckdb/duckdb_example.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# 🤗 Hugging Face dataset search and exploration@@ -28,7 +28,7 @@ def __(mo):@app.cell(hide_code=True)-def __(fetch_hugging_face_datasets, mo, pd):+def _(fetch_hugging_face_datasets, mo, pd):# Load the datasetswith mo.status.spinner(title="Loading datasets from Hugging Face",@@ -40,7 +40,7 @@ def __(fetch_hugging_face_datasets, mo, pd):@app.cell(hide_code=True)-def __(datasets, duckdb, print_month_year):+def _(datasets, duckdb):# Extract info from the datasetsall_tags = (duckdb.sql("""SELECT DISTINCT tags FROM datasets WHERE tags IS NOT NULL""")@@ -56,7 +56,7 @@ def __(datasets, duckdb, print_month_year):@app.cell(hide_code=True)-def __(all_tags, dataset_date_range, dataset_length, mo):+def _(all_tags, dataset_date_range, dataset_length, mo):# Create stats cardsstats = mo.hstack([@@ -80,7 +80,7 @@ def __(all_tags, dataset_date_range, dataset_length, mo):@app.cell-def __(all_tags, mo, stats):+def _(all_tags, mo, stats):# Search filterssearch_filter = mo.ui.text_area(label="Search",@@ -98,7 +98,7 @@ def __(all_tags, mo, stats):@app.cell(hide_code=True)-def __(datasets, duckdb, mo, search_filter, tag_filter):+def _(datasets, duckdb, mo, search_filter, tag_filter):# Filter and display the datasets in a tabledatasets_fields = [@@ -133,7 +133,7 @@ def __(datasets, duckdb, mo, search_filter, tag_filter):@app.cell-def __(table):+def _(table):selected_dataset = (table.value.iloc[0]if table.value is not None and len(table.value)@@ -143,7 +143,7 @@ def __(table):@app.cell-def __(mo, selected_dataset):+def _(mo, selected_dataset):mo.stop(selected_dataset is None)mo.md(@@ -163,7 +163,7 @@ def __(mo, selected_dataset):@app.cell-def __(load_hugging_face_dataset, mo, selected_dataset):+def _(load_hugging_face_dataset, mo, selected_dataset):# Load the selected dataset's parquet filesmo.stop(selected_dataset is None)@@ -183,7 +183,7 @@ def __(load_hugging_face_dataset, mo, selected_dataset):@app.cell-def __(selected_parquet):+def _(selected_parquet):has_selected_file = (selected_parquet.value is not None and len(selected_parquet.value) > 0)@@ -192,7 +192,7 @@ def __(selected_parquet):@app.cell-def __(duckdb, mo, url):+def _(duckdb, mo, url):# Load the selected parquet into duckdbmo.stop(not url)@@ -232,7 +232,7 @@ def __(duckdb, mo, url):@app.cell-def __(has_selected_file, mo, render_sql_editor):+def _(has_selected_file, mo, render_sql_editor):mo.stop(not has_selected_file)sql_editor = render_sql_editor()@@ -256,7 +256,7 @@ def __(has_selected_file, mo, render_sql_editor):@app.cell-def __(has_selected_file, mo, render_sql_results, sql_editor):+def _(has_selected_file, mo, render_sql_results, sql_editor):mo.stop(not has_selected_file)render_sql_results(sql_editor)@@ -264,7 +264,7 @@ def __(has_selected_file, mo, render_sql_results, sql_editor):@app.cell-def __(datasets, mo, render_dataframe_editor):+def _(datasets, mo, render_dataframe_editor):mo.stop(len(datasets) == 0)df_editor = render_dataframe_editor()@@ -281,11 +281,11 @@ def __(datasets, mo, render_dataframe_editor):df_editor,])- return (df_editor,)+ return@app.cell-def __(con, mo, url):+def _(con, mo, url):# UI renderers@@ -316,18 +316,16 @@ def __(con, mo, url):return render_dataframe_editor, render_sql_editor, render_sql_results-def __():- # Utils+# Utils- def print_month_year(date):- return date.strftime("%b %Y")- return (print_month_year,)+def print_month_year(date):+ return date.strftime("%b %Y")@app.cell-def __(functools, json, pd, requests):+def _(functools, json, pd, requests):# Cached requests@@ -351,7 +349,7 @@ def __(functools, json, pd, requests):@app.cell-def __():+def _():import requestsimport jsonimport functoolsdiff --git a/examples/third_party/great_tables/great_tables_example.py b/examples/third_party/great_tables/great_tables_example.pyindex f44735d49b..98b71f2fa4 100644--- a/examples/third_party/great_tables/great_tables_example.py+++ b/examples/third_party/great_tables/great_tables_example.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.13.13"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/third_party/huggingface/chatbot.py b/examples/third_party/huggingface/chatbot.pyindex 3df0d3ba4b..8ce5ca7724 100644--- a/examples/third_party/huggingface/chatbot.py+++ b/examples/third_party/huggingface/chatbot.py@@ -8,12 +8,12 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport osfrom huggingface_hub import InferenceClient@@ -21,13 +21,13 @@ def __():@app.cell-def __():+def _():MODEL_NAME = "HuggingFaceH4/zephyr-7b-beta"return (MODEL_NAME,)@app.cell(hide_code=True)-def __(MODEL_NAME, mo):+def _(MODEL_NAME, mo):mo.md(f"""# Chat with **{MODEL_NAME}**""")@@ -35,7 +35,7 @@ def __(MODEL_NAME, mo):@app.cell-def __(max_tokens, mo, system_message, temperature, top_p):+def _(max_tokens, mo, system_message, temperature, top_p):mo.hstack([system_message,@@ -46,17 +46,17 @@ def __(max_tokens, mo, system_message, temperature, top_p):@app.cell-def __(mo, respond):+def _(mo, respond):chat = mo.ui.chat(model=respond,prompts=["Tell me a joke.", "What is the square root of {{number}}?"],)chat- return (chat,)+ return@app.cell-def __(InferenceClient, MODEL_NAME, os):+def _(InferenceClient, MODEL_NAME, os):"""For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.26.2/en/guides/inference"""@@ -69,11 +69,11 @@ def __(InferenceClient, MODEL_NAME, os):MODEL_NAME,token=hf_token,)- return client, hf_token+ return (client,)@app.cell-def __(client, mo):+def _(client, mo):# Create UI controlssystem_message = mo.ui.text_area(value="You are a friendly Chatbot.",@@ -149,7 +149,7 @@ def __(client, mo):@app.cell-def __():+def _():# If you need to do anything _reactively_ to the chat messages,# you can access the chat messages using the `chat.value` attribute.# chat.valuediff --git a/examples/third_party/huggingface/text-to-image.py b/examples/third_party/huggingface/text-to-image.pyindex 4258e5d874..da8c61c3f5 100644--- a/examples/third_party/huggingface/text-to-image.py+++ b/examples/third_party/huggingface/text-to-image.py@@ -13,12 +13,12 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell(hide_code=True)-def __():+def _():import marimo as moimport numpy as npimport random@@ -44,22 +44,19 @@ def __():MAX_SEED,mo,model_repo_id,- np,random,torch,- tqdm,- transformers,)@app.cell-def __(mo, model_repo_id):+def _(mo, model_repo_id):mo.md(f"""# HuggingFace Text-to-Image: **{model_repo_id}**""")return@app.cell(hide_code=True)-def __():+def _():examples = ["Astronaut in a jungle, cold color palette, muted colors, detailed, 8k","An astronaut riding a green horse",@@ -69,14 +66,7 @@ def __():@app.cell-def __(- DiffusionPipeline,- MAX_SEED,- mo,- model_repo_id,- random,- torch,-):+def _(DiffusionPipeline, MAX_SEED, mo, model_repo_id, random, torch):device = "cuda" if torch.cuda.is_available() else "cpu"if torch.cuda.is_available():@@ -119,17 +109,17 @@ def __(mo.output.clear() # Clear loading tdqm- return device, infer, pipe, torch_dtype+ return (infer,)@app.cell-def __(mo):+def _(mo):get_prompt, set_prompt = mo.state("")return get_prompt, set_prompt@app.cell-def __(get_prompt, mo, set_prompt):+def _(get_prompt, mo, set_prompt):prompt = mo.ui.text_area(placeholder="Enter your prompt",label="Prompt",@@ -141,7 +131,7 @@ def __(get_prompt, mo, set_prompt):@app.cell-def __(examples, mo, set_prompt):+def _(examples, mo, set_prompt):def _on_click(example):def handle(v):set_prompt(example)@@ -157,11 +147,11 @@ def __(examples, mo, set_prompt):)example_options = mo.vstack(buttons)- return buttons, example_options+ return (example_options,)@app.cell-def __(MAX_IMAGE_SIZE, MAX_SEED, example_options, mo, prompt):+def _(MAX_IMAGE_SIZE, MAX_SEED, example_options, mo, prompt):run_button = mo.ui.run_button(label="Run", kind="success", full_width=True)negative_prompt = mo.ui.text_area(@@ -206,7 +196,6 @@ def __(MAX_IMAGE_SIZE, MAX_SEED, example_options, mo, prompt):# Layout the main interfacemo.vstack([prompt, run_button, advanced_settings])return (- advanced_settings,guidance_scale,height,negative_prompt,@@ -219,13 +208,13 @@ def __(MAX_IMAGE_SIZE, MAX_SEED, example_options, mo, prompt):@app.cell-def __(mo):+def _(mo):get_image, set_image = mo.state(None)return get_image, set_image@app.cell-def __(+def _(guidance_scale,height,infer,@@ -257,7 +246,7 @@ def __(@app.cell-def __(get_image):+def _(get_image):get_image()returndiff --git a/examples/third_party/ibis/ibis_example.py b/examples/third_party/ibis/ibis_example.pyindex 35b73173f6..07da37b100 100644--- a/examples/third_party/ibis/ibis_example.py+++ b/examples/third_party/ibis/ibis_example.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(f"""# Using `Ibis` in `marimo`@@ -26,7 +26,7 @@ def __(mo):@app.cell-def __():+def _():import marimo as moimport ibisimport altair as alt@@ -34,7 +34,7 @@ def __():@app.cell-def __(ibis):+def _(ibis):df = ibis.read_csv("https://gist.githubusercontent.com/ritchie46/cac6b337ea52281aa23c049250a4ff03/raw/89a957ff3919d90e6ef2d34235e6bf22304f3366/pokemon.csv")@@ -42,7 +42,7 @@ def __(ibis):@app.cell-def __(df, mo):+def _(df, mo):# get all unique valuesvalues_1 = df["Type 1"].execute().tolist()values_2 = df["Type 2"].execute().tolist()@@ -59,11 +59,11 @@ def __(df, mo):)mo.hstack([type_1_filter, type_2_filter])- return type_1_filter, type_2_filter, values_1, values_2+ return type_1_filter, type_2_filter@app.cell-def __(alt, filtered, mo):+def _(alt, filtered, mo):# Convert Ibis table to pandas for Altairfiltered_df = filtered.execute()@@ -83,11 +83,11 @@ def __(alt, filtered, mo):_chart, legend_selection=True, label="Attack vs Defense")chart- return chart, filtered_df+ return (chart,)@app.cell-def __(df, type_1_filter, type_2_filter):+def _(df, type_1_filter, type_2_filter):filtered = dfif type_1_filter.value:filtered = filtered.filter(df["Type 1"] == type_1_filter.value)@@ -97,7 +97,7 @@ def __(df, type_1_filter, type_2_filter):@app.cell-def __(chart, mo):+def _(chart, mo):mo.ui.table(chart.value, selection=None)returndiff --git a/examples/third_party/leafmap/leafmap_example.py b/examples/third_party/leafmap/leafmap_example.pyindex 201ab220f1..c043971426 100644--- a/examples/third_party/leafmap/leafmap_example.py+++ b/examples/third_party/leafmap/leafmap_example.py@@ -8,12 +8,12 @@import marimo-__generated_with = "0.9.20"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Using Leafmap@@ -25,13 +25,13 @@ def __(mo):@app.cell-def __():+def _():import leafmapreturn (leafmap,)@app.cell-def __(leafmap):+def _(leafmap):m = leafmap.Map(center=(40, -100), zoom=4, height="400px")m.add_basemap("HYBRID")m.add_basemap("Esri.NatGeoWorldMap")@@ -41,11 +41,11 @@ def __(leafmap):attribution="Google",)m- return (m,)+ return@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/matplotlib/mandelbrot.py b/examples/third_party/matplotlib/mandelbrot.pyindex a556ac3f45..462593af84 100644--- a/examples/third_party/matplotlib/mandelbrot.py+++ b/examples/third_party/matplotlib/mandelbrot.py@@ -9,18 +9,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# The Mandelbrot Set""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""This program computes uses an iterative algorithm to visualize the@@ -46,7 +46,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo, n_max):+def _(mo, n_max):mo.md(f"""You can play with the number of iterations to see when points are@@ -59,7 +59,7 @@ def __(mo, n_max):@app.cell(hide_code=True)-def __(mo, reset_plot_scale, x_offset, y_offset, zoom):+def _(mo, reset_plot_scale, x_offset, y_offset, zoom):mo.md(f"""**Plot controls.**@@ -75,7 +75,7 @@ def __(mo, reset_plot_scale, x_offset, y_offset, zoom):@app.cell-def __(compute_mandelbrot, n_max, x_offset, y_offset, zoom):+def _(compute_mandelbrot, n_max, x_offset, y_offset, zoom):compute_mandelbrot(n_max.value, 2., 601, 401,zoom=zoom.value,x_offset=x_offset.value,@@ -84,19 +84,19 @@ def __(compute_mandelbrot, n_max, x_offset, y_offset, zoom):@app.cell-def __(mo):+def _(mo):n_max = mo.ui.slider(2, 256, step=1, value=30)return (n_max,)@app.cell-def __(mo):+def _(mo):reset_plot_scale = mo.ui.button(label="Click to reset")return (reset_plot_scale,)@app.cell-def __(mo, reset_plot_scale):+def _(mo, reset_plot_scale):reset_plot_scalezoom = mo.ui.slider(1, 10, step=0.1)@@ -106,7 +106,7 @@ def __(mo, reset_plot_scale):@app.cell-def __(np, plt):+def _(np, plt):import functools@functools.cache@@ -135,18 +135,18 @@ def __(np, plt):)plt.colorbar()return plt.gca()- return compute_mandelbrot, functools+ return (compute_mandelbrot,)@app.cell-def __():+def _():import numpy as npimport matplotlib.pyplot as pltreturn np, plt@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/matplotlib/surfaces.py b/examples/third_party/matplotlib/surfaces.pyindex 673e545d0b..32bd8d759a 100644--- a/examples/third_party/matplotlib/surfaces.py+++ b/examples/third_party/matplotlib/surfaces.py@@ -9,24 +9,24 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Surfaces""")return@app.cell-def __(plot_3d_surface, selected_function):+def _(plot_3d_surface, selected_function):ax = plot_3d_surface(selected_function)return (ax,)@app.cell-def __(ax, xlim, ylim, zlim):+def _(ax, xlim, ylim, zlim):ax.set_xlim(xlim.value)ax.set_ylim(ylim.value)ax.set_zlim(zlim.value)@@ -35,7 +35,7 @@ def __(ax, xlim, ylim, zlim):@app.cell(hide_code=True)-def __(+def _(a,b,function,@@ -103,13 +103,13 @@ def __(@app.cell-def __(function, function_options):+def _(function, function_options):selected_function = function_options[function.value]return (selected_function,)@app.cell-def __(paraboloid, saddle, sphere, torus):+def _(paraboloid, saddle, sphere, torus):function_options = {"paraboloid": paraboloid,"saddle": saddle,@@ -120,7 +120,7 @@ def __(paraboloid, saddle, sphere, torus):@app.cell-def __(mo):+def _(mo):function = mo.ui.dropdown(options=["paraboloid",@@ -133,7 +133,7 @@ def __(mo):@app.cell-def __(plt):+def _(plt):def plot_3d_surface(surface_function):fig = plt.figure()ax = fig.add_subplot(111, projection='3d')@@ -152,13 +152,13 @@ def __(plt):@app.cell-def __(mo):+def _(mo):mo.md("""### Controls""")return@app.cell-def __(function, mo):+def _(function, mo):if function.value == "paraboloid":_xlim, _ylim, _zlim = (-1, 1), (-1, 1), (0, 2)elif function.value == "saddle":@@ -195,7 +195,7 @@ def __(function, mo):@app.cell-def __(function, mo):+def _(function, mo):if function.value == "paraboloid":a = mo.ui.slider(1, 10)b = mo.ui.slider(1, 10)@@ -238,7 +238,7 @@ def __(function, mo):@app.cell-def __(grid, saddle_param_a, saddle_param_b):+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@@ -246,7 +246,7 @@ def __(grid, saddle_param_a, saddle_param_b):@app.cell-def __(a, b, grid):+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@@ -254,7 +254,7 @@ def __(a, b, grid):@app.cell-def __(grid, np, sphere_param_r):+def _(grid, np, sphere_param_r):def sphere():theta, phi = grid(xlim=(0, 2*np.pi), ylim=(0, np.pi))x = np.cos(theta)*np.sin(phi)@@ -265,7 +265,7 @@ def __(grid, np, sphere_param_r):@app.cell-def __(grid, np, torus_param_a, torus_param_c):+def _(grid, np, torus_param_a, torus_param_c):def torus():theta, phi = grid((0, 2 * np.pi), (0, 2 * np.pi))center_radius = torus_param_c.value@@ -279,7 +279,7 @@ def __(grid, np, torus_param_a, torus_param_c):@app.cell-def __(np):+def _(np):def grid(xlim, ylim):xmin, xmax = xlimymin, ymax = ylim@@ -290,15 +290,15 @@ def __(np):@app.cell-def __():+def _():import matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport numpy as np- return Axes3D, np, plt+ return np, plt@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/motherduck/embeddings/embeddings_explorer.py b/examples/third_party/motherduck/embeddings/embeddings_explorer.pyindex ad59d316ab..48951db3db 100644--- a/examples/third_party/motherduck/embeddings/embeddings_explorer.py+++ b/examples/third_party/motherduck/embeddings/embeddings_explorer.py@@ -16,9 +16,14 @@import marimo+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():return+++if __name__ == "__main__":+ app.run()diff --git a/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py b/examples/third_party/motherduck/embeddings/embeddings_explorer_final.pyindex c2b3e68911..857f3173a9 100644--- a/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py+++ b/examples/third_party/motherduck/embeddings/embeddings_explorer_final.py@@ -16,12 +16,12 @@import marimo-__generated_with = "0.9.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():# Data manipulation and database connectionsimport polars as plimport duckdb@@ -37,22 +37,21 @@ def __():import hdbscan # For clustering similar embeddingsimport numpy as npfrom sklearn.decomposition import PCA-- return PCA, alt, duckdb, hdbscan, mo, np, numba, pl, pyarrow, umap+ return PCA, alt, hdbscan, mo, np, pl, umap@app.cell-def __(mo):+def _(mo):_df = mo.sql("""ATTACH IF NOT EXISTS 'md:my_db'""")- return (my_db,)+ return@app.cell-def __(mo, my_db):+def _(mo):_df = mo.sql("""CREATE OR REPLACE TABLE my_db.demo_embedding AS@@ -63,11 +62,11 @@ def __(mo, my_db):LIMIT 50000;""")- return (demo_embedding,)+ return@app.cell-def __(demo_embedding, mo, my_db):+def _(mo):embeddings = mo.sql("""SELECT *, embedding(title) as text_embedding@@ -79,7 +78,7 @@ def __(demo_embedding, mo, my_db):@app.cell-def __(PCA, hdbscan, np, umap):+def _(PCA, hdbscan, np, umap):def umap_reduce(np_array):"""Reduce the dimensionality of the embeddings to 2D using@@ -112,22 +111,21 @@ def __(PCA, hdbscan, np, umap):return np.where(hdb.labels_ == -1, "outlier", "cluster_" + hdb.labels_.astype(str))-return cluster_points, umap_reduce@app.cell-def __(cluster_points, embeddings, mo, umap_reduce):+def _(cluster_points, embeddings, mo, umap_reduce):with mo.status.spinner("Clustering points...") as _s:embeddings_array = embeddings["text_embedding"].to_numpy()hdb_labels = cluster_points(embeddings_array)_s.update("Reducing dimensionality...")embeddings_2d = umap_reduce(embeddings_array)- return embeddings_2d, embeddings_array, hdb_labels+ return embeddings_2d, hdb_labels@app.cell-def __(embeddings, embeddings_2d, hdb_labels, pl):+def _(embeddings, embeddings_2d, hdb_labels, pl):data = embeddings.lazy() # Lazy evaluation for performancedata = data.with_columns(text_embedding_2d_1=embeddings_2d[:, 0],@@ -145,7 +143,7 @@ def __(embeddings, embeddings_2d, hdb_labels, pl):@app.cell-def __(alt, data, mo):+def _(alt, data, mo):chart = (alt.Chart(data).mark_point()@@ -162,7 +160,7 @@ def __(alt, data, mo):@app.cell-def __(chart):+def _(chart):chart.valuereturndiff --git a/examples/third_party/nvidia/nims.py b/examples/third_party/nvidia/nims.pyindex 46f0c9851a..761a0027d2 100644--- a/examples/third_party/nvidia/nims.py+++ b/examples/third_party/nvidia/nims.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.10.17"+__generated_with = "0.15.5"app = marimo.App()@@ -60,7 +60,7 @@ def _(mo, uploaded_file):mo.stop(not uploaded_file.value)base64_encoded = base64.b64encode(uploaded_file.contents()).decode("utf-8")- return base64, base64_encoded, io+ return (base64_encoded,)@app.cell@@ -116,7 +116,7 @@ def _(api_token, data_uri, mo, prompt, requests, temperature, top_p, url):response = requests.post(url, json=payload, headers=headers)res = response.json()- return headers, payload, res, response+ return (res,)@app.cell@@ -127,7 +127,7 @@ def _(mo, res):content = resmo.md(f"**Response:** \n{res}")- return (content,)+ returnif __name__ == "__main__":diff --git a/examples/third_party/plotly/image_selection.py b/examples/third_party/plotly/image_selection.pyindex e42fe107c1..d397db2401 100644--- a/examples/third_party/plotly/image_selection.py+++ b/examples/third_party/plotly/image_selection.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moimport plotly.graph_objects as goimport plotly.express as px@@ -24,13 +24,13 @@ def __():@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""#Example: Image with range selection""")return@app.cell-def __(io, mo, px):+def _(io, mo, px):# Create figureimg = io.imread("https://marimo.io/logo.png")_fig = px.imshow(img)@@ -38,11 +38,11 @@ def __(io, mo, px):# Wrap with marimoplot = mo.ui.plotly(_fig)- return img, plot+ return (plot,)@app.cell-def __(mo, plot):+def _(mo, plot):mo.hstack([plot,@@ -57,13 +57,13 @@ def __(mo, plot):@app.cell-def __(mo):+def _(mo):mo.md("""#Example: Image with overlaid trace""")return@app.cell-def __(go, mo):+def _(go, mo):# Create figure_fig = go.Figure()@@ -92,7 +92,7 @@ def __(go, mo):@app.cell-def __(mo, plot2):+def _(mo, plot2):mo.hstack([plot2,diff --git a/examples/third_party/plotly/mapbox.py b/examples/third_party/plotly/mapbox.pyindex c5edb00c29..17532e57d2 100644--- a/examples/third_party/plotly/mapbox.py+++ b/examples/third_party/plotly/mapbox.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Mapping Example@@ -26,27 +26,27 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):view_button = mo.ui.switch(value=False)mo.hstack([mo.md("Satellite view:"), view_button], justify="start")return (view_button,)@app.cell-def __(get_map, mo, view_button):+def _(get_map, mo, view_button):f = mo.ui.plotly(get_map(satellite=view_button.value))freturn (f,)@app.cell-def __(f, mo):+def _(f, mo):mo.ui.table(f.value)return@app.cell-def __(px, us_cities):+def _(px, us_cities):def get_map(satellite):map = px.scatter_mapbox(us_cities,@@ -81,7 +81,7 @@ def __(px, us_cities):@app.cell-def __(pd):+def _(pd):us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv")@@ -89,7 +89,7 @@ def __(pd):@app.cell-def __():+def _():import osimport sys@@ -97,7 +97,7 @@ def __():import plotly.express as pximport marimo as mo- return mo, os, pd, px, sys+ return mo, pd, pxif __name__ == "__main__":diff --git a/examples/third_party/plotly/scatter_map.py b/examples/third_party/plotly/scatter_map.pyindex 42d19aad03..10954aee30 100644--- a/examples/third_party/plotly/scatter_map.py+++ b/examples/third_party/plotly/scatter_map.py@@ -6,20 +6,21 @@# "plotly==5.24.1",# ]# ///+import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Selectable scatter map@@ -32,7 +33,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):import plotly.express as pxdf = px.data.carshare()@@ -47,11 +48,11 @@ def __(mo):zoom=10,mapbox_style="carto-positron",))- return df, fig, px+ return (fig,)@app.cell-def __(fig, mo):+def _(fig, mo):mo.hstack([fig, fig.value], justify="start")returndiff --git a/examples/third_party/polars/polars_example.py b/examples/third_party/polars/polars_example.pyindex c8220b3b0a..abe8d1ef10 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.10.12"+__generated_with = "0.15.5"app = marimo.App(width="full")@@ -32,7 +32,7 @@ def _():import polars as plimport numpy as npimport altair as alt- return alt, mo, np, pl+ return alt, mo, pl@app.cell@@ -60,7 +60,7 @@ def _(df, mo):mo.hstack([type_1_filter, type_2_filter], justify="start")- return type_1_filter, type_2_filter, values_1, values_2+ return type_1_filter, type_2_filter@app.celldiff --git a/examples/third_party/pygwalker/example.py b/examples/third_party/pygwalker/example.pyindex 30cd2485b6..3e7f0159fa 100644--- a/examples/third_party/pygwalker/example.py+++ b/examples/third_party/pygwalker/example.py@@ -5,14 +5,15 @@# "vega-datasets==0.9.0",# ]# ///+import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pygwalker as pygfrom vega_datasets import data@@ -20,11 +21,11 @@ def __():@app.cell-def __(data, pyg):+def _(data, pyg):df = data.iris()pyg.walk(df)- return (df,)+ returnif __name__ == "__main__":diff --git a/examples/third_party/pyiceberg/data_catalog.py b/examples/third_party/pyiceberg/data_catalog.pyindex 53e3210bb6..d488a31999 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.13.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/third_party/pymde/complete_graph.py b/examples/third_party/pymde/complete_graph.pyindex bd99770266..5c986a3563 100644--- a/examples/third_party/pymde/complete_graph.py+++ b/examples/third_party/pymde/complete_graph.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Visualizing Complete Graphs""")return@app.cell-def __(mo):+def _(mo):n_items = mo.ui.slider(start=3, stop=64, step=1)mo.md(f"""@@ -30,7 +30,7 @@ def __(mo):@app.cell-def __(mo, pymde):+def _(mo, pymde):penalty_function = mo.ui.dropdown(options={"Linear": pymde.penalties.Linear,@@ -48,7 +48,7 @@ def __(mo, pymde):@app.cell-def __(complete_graph, mo, n_items, penalty_function):+def _(complete_graph, mo, n_items, penalty_function):plot = complete_graph(n_items.value, penalty_function.value)mo.md(@@ -66,11 +66,11 @@ def __(complete_graph, mo, n_items, penalty_function):{mo.as_html(plot)}""")- return (plot,)+ return@app.cell-def __(pymde):+def _(pymde):import functools@functools.cache@@ -85,17 +85,17 @@ def __(pymde):)mde.embed(verbose=True)return mde.plot(edges=edges)- return complete_graph, functools+ return (complete_graph,)@app.cell-def __():+def _():import pymdereturn (pymde,)@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/third_party/pymde/debugging_embeddings.py b/examples/third_party/pymde/debugging_embeddings.pyindex 42e742e3e6..cd431ccbee 100644--- a/examples/third_party/pymde/debugging_embeddings.py+++ b/examples/third_party/pymde/debugging_embeddings.py@@ -4,14 +4,15 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.68"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Sanity-Checking Embeddings@@ -24,7 +25,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""We'll start by making a simple neighborhood-preserving embedding. This@@ -37,19 +38,19 @@ def __(mo):@app.cell-def __(n_neighbors):+def _(n_neighbors):n_neighborsreturn@app.cell-def __(n_neighbors):+def _(n_neighbors):ready = n_neighbors.value is not None- return ready,+ return (ready,)@app.cell-def __(mo, ready):+def _(mo, ready):mo.md("""Below, we've plotted an embedding along with a CDF of the distortions@@ -62,7 +63,7 @@ def __(mo, ready):@app.cell-def __(mnist, plt, quadratic_mde, ready):+def _(mnist, plt, quadratic_mde, ready):def compute_embedding():_ = quadratic_mde.embed(verbose=True)quadratic_mde.plot(color_by=mnist.attributes["digits"])@@ -78,36 +79,35 @@ def __(mnist, plt, quadratic_mde, ready):compute_embedding() if ready else (None, None, None))plots- return compute_embedding, distortions, pairs, plots+ return (pairs,)@app.cell-def __(mo):+def _(mo):n_neighbors = mo.ui.slider(3, 30, step=1, value=15, label="Number of neighbors in $k$-NN graph").form()- return n_neighbors,+ return (n_neighbors,)@app.cell-def __(knn, n_neighbors, ready):+def _(knn, n_neighbors, ready):knn_graph = knn(n_neighbors.value) if ready else None- return knn_graph,+ return (knn_graph,)@app.cell-def __(functools, mnist, pymde):+def _(functools, mnist, pymde):@functools.cachedef knn(n_neighbors):return pymde.preprocess.k_nearest_neighbors(mnist.data, k=n_neighbors, verbose=True)-- return knn,+ return (knn,)@app.cell-def __(knn_graph, mnist, pymde, ready, torch):+def _(knn_graph, mnist, pymde, ready, torch):def construct_mde_problem():if torch.cuda.is_available():device = "cuda"@@ -124,11 +124,11 @@ def __(knn_graph, mnist, pymde, ready, torch):)quadratic_mde = construct_mde_problem() if ready else None- return construct_mde_problem, quadratic_mde+ return (quadratic_mde,)@app.cell-def __(mo, ready):+def _(mo, ready):mo.md("""## Pairs with highest and lowest distortion@@ -143,14 +143,14 @@ def __(mo, ready):@app.cell-def __(mo, ready):+def _(mo, ready):n_pairs = mo.ui.slider(5, 10, label="number of pairs")n_pairs if ready else None- return n_pairs,+ return (n_pairs,)@app.cell-def __(mo, ready):+def _(mo, ready):mo.md("""### Low distortion pairs@@ -162,13 +162,13 @@ def __(mo, ready):@app.cell-def __(n_pairs, pairs, plot_pairs, ready):+def _(n_pairs, pairs, plot_pairs, ready):plot_pairs(pairs[-n_pairs.value :]) if ready else Nonereturn@app.cell-def __(mo, ready):+def _(mo, ready):mo.md("""### High distortion pairs@@ -185,13 +185,13 @@ def __(mo, ready):@app.cell-def __(n_pairs, pairs, plot_pairs, ready):+def _(n_pairs, pairs, plot_pairs, ready):plot_pairs(pairs[: n_pairs.value]) if ready else Nonereturn@app.cell-def __(mnist, plt):+def _(mnist, plt):def plot_pairs(pairs):fig, axs = plt.subplots(2, pairs.shape[0], figsize=(15.0, 3.0))for pair_index in range(pairs.shape[0]):@@ -207,17 +207,17 @@ def __(mnist, plt):axs[1][pair_index].set_yticks([])plt.tight_layout()return plt.gca()- return plot_pairs,+ return (plot_pairs,)@app.cell-def __(pymde):+def _(pymde):mnist = pymde.datasets.MNIST()- return mnist,+ return (mnist,)@app.cell-def __():+def _():import functoolsimport matplotlib.pyplot as pltdiff --git a/examples/third_party/pymde/drawing_graphs.py b/examples/third_party/pymde/drawing_graphs.pyindex c559f56ef5..ab3deddda5 100644--- a/examples/third_party/pymde/drawing_graphs.py+++ b/examples/third_party/pymde/drawing_graphs.py@@ -4,38 +4,39 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("# Drawing Graphs")return@app.cell-def __(mo):+def _(mo):n_items = mo.ui.slider(3, 15)- return n_items,+ return (n_items,)@app.cell-def __(mo, n_items):+def _(mo, n_items):mo.md(f"Embedding graphs on {n_items} **{n_items.value}** items")return@app.cell-def __(draw_graphs, loss, n_items, penalty):+def _(draw_graphs, loss, n_items, penalty):draw_graphs(n_items, penalty, loss)return@app.cell-def __(mo, pymde):+def _(mo, pymde):penalties = {"Linear": pymde.penalties.Linear,"Quadratic": pymde.penalties.Quadratic,@@ -47,7 +48,7 @@ def __(mo, pymde):@app.cell-def __(mo, pymde):+def _(mo, pymde):losses = {"Linear": pymde.losses.Absolute,"Quadratic": pymde.losses.Quadratic,@@ -58,7 +59,7 @@ def __(mo, pymde):@app.cell-def __(complete_graph, mo, tree):+def _(complete_graph, mo, tree):def draw_graphs(n_items, penalty, loss):complete_graph_tab = [penalty, complete_graph(n_items.value, penalty.value)]tree_tab = [loss, tree(n_items.value, loss.value)]@@ -68,17 +69,17 @@ def __(complete_graph, mo, tree):"Binary tree": tree_tab,})- return draw_graphs,+ return (draw_graphs,)@app.cell-def __():+def _():embedding_dim = 2- return embedding_dim,+ return (embedding_dim,)@app.cell-def __(format_axis, functools, penalties, pymde):+def _(functools, penalties, pymde):@functools.cachedef complete_graph(n_items, penalty):edges = pymde.all_edges(n_items)@@ -91,11 +92,11 @@ def __(format_axis, functools, penalties, pymde):)mde.embed(verbose=False)return format_axis(mde.plot(edges=edges))- return complete_graph,+ return (complete_graph,)@app.cell-def __(embedding_dim, format_axis, functools, losses, pymde, torch):+def _(embedding_dim, functools, losses, pymde, torch):@functools.cachedef tree(n_items, loss):edges = []@@ -121,23 +122,21 @@ def __(embedding_dim, format_axis, functools, losses, pymde, torch):)mde.embed(snapshot_every=1, max_iter=20, verbose=False)return format_axis(mde.plot(edges=tree.edges))- return tree,+ return (tree,)-def __():- def format_axis(ax):- ax.figure.set_size_inches(3.5, 3.5)- ax.set_title("embedding")- ax.figure.tight_layout()- ax.set_xticks([])- ax.set_yticks([])- return ax- return format_axis,+def format_axis(ax):+ ax.figure.set_size_inches(3.5, 3.5)+ ax.set_title("embedding")+ ax.figure.tight_layout()+ ax.set_xticks([])+ ax.set_yticks([])+ return ax@app.cell-def __():+def _():import marimo as moimport pymde@@ -145,7 +144,7 @@ def __():import numpy as npimport scipy.sparse as spimport torch- return functools, mo, np, pymde, sp, torch+ return functools, mo, pymde, torchif __name__ == "__main__":diff --git a/examples/third_party/pymde/embedding_numbers.py b/examples/third_party/pymde/embedding_numbers.pyindex ed10abb877..9744680af0 100644--- a/examples/third_party/pymde/embedding_numbers.py+++ b/examples/third_party/pymde/embedding_numbers.py@@ -4,14 +4,15 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Embedding MNIST@@ -30,7 +31,7 @@ def __(mo):@app.cell-def __(button, show_random_images):+def _(button, show_random_images):buttonshow_random_images(5)@@ -38,14 +39,14 @@ def __(button, show_random_images):@app.cell-def __(mo):+def _(mo):button = mo.ui.button(label="Click this button")mo.md(f"{button} _to view another random sample of images._").center()- return button,+ return (button,)@app.cell-def __(mo):+def _(mo):params = (mo.md("""@@ -67,11 +68,11 @@ def __(mo):)params- return params,+ return (params,)@app.cell-def __(params):+def _(params):if params.value is not None:embedding_dimension, constraint_type = (params.value["embedding_dimension"],@@ -83,7 +84,7 @@ def __(params):@app.cell-def __(constraint_type, pymde):+def _(constraint_type, pymde):if constraint_type is not None:_constraints = {"Centered": pymde.Centered(),@@ -91,18 +92,11 @@ def __(constraint_type, pymde):}constraint = _constraints[constraint_type]- return constraint,+ return (constraint,)@app.cell-def __(- compute_embedding,- constraint,- embedding_dimension,- mnist,- plt,- pymde,-):+def _(compute_embedding, constraint, embedding_dimension, mnist, plt, pymde):def show_embedding():_, embedding = compute_embedding(embedding_dimension, constraint)pymde.plot(embedding, color_by=mnist.attributes["digits"])@@ -110,11 +104,11 @@ def __(return plt.gca()show_embedding() if embedding_dimension is not None else None- return show_embedding,+ return@app.cell-def __(mnist, mo, pymde, torch):+def _(mnist, mo, pymde, torch):embedding_cache = {}@@ -137,17 +131,17 @@ def __(mnist, mo, pymde, torch):value = (mde, X)embedding_cache[key] = valuereturn value- return compute_embedding, embedding_cache+ return (compute_embedding,)@app.cell-def __(pymde):+def _(pymde):mnist = pymde.datasets.MNIST()- return mnist,+ return (mnist,)@app.cell-def __(mnist, plt, torch):+def _(mnist, plt, torch):def show_random_images(n_images):indices = torch.randperm(mnist.data.shape[0])[:n_images]images = mnist.data[indices].reshape((-1, 28, 28))@@ -159,11 +153,11 @@ def __(mnist, plt, torch):ax.set_xticks([])plt.tight_layout()return fig- return show_random_images,+ return (show_random_images,)@app.cell-def __():+def _():import matplotlib.pyplot as pltimport pymdeimport torchdiff --git a/examples/third_party/pymde/google_scholar.py b/examples/third_party/pymde/google_scholar.pyindex 1ce3492bd6..3c6fb9c25d 100644--- a/examples/third_party/pymde/google_scholar.py+++ b/examples/third_party/pymde/google_scholar.py@@ -4,9 +4,10 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.68"+__generated_with = "0.15.5"app = marimo.App()@@ -40,20 +41,20 @@ def _():@app.celldef _(pymde):gscholar = pymde.datasets.google_scholar()- return gscholar,+ return (gscholar,)@app.celldef _(gscholar):scholars_df = gscholar.other_data['dataframe']scholars_df- return scholars_df,+ return@app.celldef _(gscholar):coauthorship_graph = gscholar.data- return coauthorship_graph,+ return (coauthorship_graph,)@app.cell@@ -84,7 +85,7 @@ def _(DEVICE, coauthorship_graph, pymde):verbose=True)mde.embed(verbose=True)- return mde,+ return (mde,)@app.cell@@ -97,7 +98,7 @@ def _(mde, np, plt):plt.xticks(np.arange(1, 11))plt.xlabel('graph distances')plt.show()- return ax, original_distances+ return@app.cell@@ -122,7 +123,7 @@ def _(coauthorship_graph, gscholar, mde, plt, torch):_ax = mde.plot(edges=edges, color_by=gscholar.attributes['coauthors'], color_map='viridis', figsize_inches=(12, 12))plt.tight_layout()_ax- return edges, indices+ return@app.cell@@ -139,7 +140,7 @@ def _(gscholar):}scholar_disciplines_df = gscholar.other_data['disciplines']topic_colors = [legend[code] for code in scholar_disciplines_df['topic']]- return colors, legend, scholar_disciplines_df, topic_colors+ return scholar_disciplines_df, topic_colors@app.cell@@ -150,15 +151,15 @@ def _(mde, pymde, scholar_disciplines_df, topic_colors):@app.cell-def __(torch):+def _(torch):DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'- return DEVICE,+ return (DEVICE,)@app.celldef _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/examples/third_party/pymde/interactive_cluster_analysis.py b/examples/third_party/pymde/interactive_cluster_analysis.pyindex ffabdc64f1..c0ce909cbe 100644--- a/examples/third_party/pymde/interactive_cluster_analysis.py+++ b/examples/third_party/pymde/interactive_cluster_analysis.py@@ -5,20 +5,21 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Cluster analysis""")return@app.cell-def __(mo):+def _(mo):mo.md("""Here's an **embedding of MNIST**: each point represents a digit,@@ -29,13 +30,13 @@ def __(mo):@app.cell-def __(compute_embedding, constraint, embedding_dimension):+def _(compute_embedding, constraint, embedding_dimension):embedding = compute_embedding(embedding_dimension, constraint)- return embedding,+ return (embedding,)@app.cell-def __(alt, df, mo):+def _(alt, df, mo):chart = mo.ui.altair_chart(alt.Chart(df).mark_circle(size=4)@@ -48,17 +49,17 @@ def __(alt, df, mo):chart_selection="interval",)chart- return chart,+ return (chart,)@app.cell-def __(chart, mo):+def _(chart, mo):table = mo.ui.table(chart.value)- return table,+ return (table,)@app.cell-def __(chart, mo, show_images, table):+def _(chart, mo, show_images, table):# mo.stop() prevents this cell from running if the chart has# no selectionmo.stop(not len(chart.value))@@ -82,18 +83,18 @@ def __(chart, mo, show_images, table):{table}""")- return selected_images,+ return@app.cell-def __(pymde):+def _(pymde):embedding_dimension = 2constraint = pymde.Standardized()return constraint, embedding_dimension@app.cell-def __(embedding, mnist, pd, torch):+def _(embedding, mnist, pd, torch):indices = torch.randperm(mnist.data.shape[0])[:20000].numpy()embedding_sampled = embedding.numpy()[indices]@@ -105,11 +106,11 @@ def __(embedding, mnist, pd, torch):"digit": mnist.attributes["digits"][indices],})- return df, embedding_sampled, indices+ return (df,)@app.cell-def __(functools, mnist, mo, pymde, torch):+def _(functools, mnist, mo, pymde, torch):@functools.cachedef compute_embedding(embedding_dim, constraint):mo.output.append(@@ -126,17 +127,17 @@ def __(functools, mnist, mo, pymde, torch):X = mde.embed(verbose=True)mo.output.clear()return X- return compute_embedding,+ return (compute_embedding,)@app.cell-def __(pymde):+def _(pymde):mnist = pymde.datasets.MNIST()- return mnist,+ return (mnist,)@app.cell-def __(mnist, plt):+def _(mnist, plt):def show_images(indices, max_images=10):indices = indices[:max_images]images = mnist.data.reshape((-1, 28, 28))[indices]@@ -153,11 +154,11 @@ def __(mnist, plt):axes.set_xticks([])plt.tight_layout()return fig- return show_images,+ return (show_images,)@app.cell-def __():+def _():import functoolsimport matplotlib.pyplot as plt@@ -169,15 +170,15 @@ def __():@app.cell-def __():+def _():import altair as alt- return alt,+ return (alt,)@app.cell-def __():+def _():import pandas as pd- return pd,+ return (pd,)if __name__ == "__main__":diff --git a/examples/third_party/pymde/rotational_invariance.py b/examples/third_party/pymde/rotational_invariance.pyindex 8be58071e0..aac3bace03 100644--- a/examples/third_party/pymde/rotational_invariance.py+++ b/examples/third_party/pymde/rotational_invariance.py@@ -4,50 +4,51 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.56"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(mo):+def _(mo):mo.md("# Rotational Invariance of Embeddings")return@app.cell-def __():+def _():import pymde- return pymde,+ return (pymde,)@app.cell-def __():+def _():import matplotlib.pyplot as plt- return plt,+ return (plt,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):degrees = mo.ui.slider(0, 360, step=5, label=r"$\theta$")- return degrees,+ return (degrees,)@app.cell-def __(embedding, mde):+def _(embedding, mde):E_X = mde.average_distortion(embedding)- return E_X,+ return (E_X,)@app.cell-def __(E_X, degrees, mde, mo, rotated_embedding):+def _(E_X, degrees, mde, mo, rotated_embedding):_E_X_hat = mde.average_distortion(rotated_embedding)rotation = mo.md(@@ -83,11 +84,11 @@ def __(E_X, degrees, mde, mo, rotated_embedding):which should match $E(X)$!""").style({"max-width": "550px"})- return rotation,+ return (rotation,)@app.cell-def __(embedding, mnist, plt, pymde):+def _(embedding, mnist, plt, pymde):import functools@functools.cache@@ -102,37 +103,37 @@ def __(embedding, mnist, plt, pymde):)plt.tight_layout()return rotated_embedding, ax- return functools, rotate_embedding+ return (rotate_embedding,)@app.cell-def __(degrees, rotate_embedding):+def _(degrees, rotate_embedding):rotated_embedding, ax = rotate_embedding(degrees.value)return ax, rotated_embedding@app.cell-def __(ax, mo, rotation):+def _(ax, mo, rotation):mo.hstack([rotation, mo.center(ax)], justify="start", align="start")return@app.cell-def __(pymde):+def _(pymde):mnist = pymde.datasets.MNIST()- return mnist,+ return (mnist,)@app.cell-def __(mnist, pymde):+def _(mnist, pymde):mde = pymde.laplacian_embedding(mnist.data, verbose=True)- return mde,+ return (mde,)@app.cell-def __(mde):+def _(mde):embedding = mde.embed(verbose=True)- return embedding,+ return (embedding,)if __name__ == "__main__":diff --git a/examples/third_party/pymde/tree.py b/examples/third_party/pymde/tree.pyindex 6da64bfbb6..4aafb92ebe 100644--- a/examples/third_party/pymde/tree.py+++ b/examples/third_party/pymde/tree.py@@ -4,14 +4,15 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo, n_items):+def _(mo, n_items):mo.md(f"""# Embedding binary trees@@ -26,32 +27,32 @@ def __(mo, n_items):@app.cell-def __(mo, n_items):+def _(mo, n_items):mo.md(f"Let's embed a binary tree on **{n_items.value}** vertices.")return@app.cell-def __(embedding, pymde, tree):+def _(embedding, pymde, tree):pymde.plot(embedding, edges=tree.edges)return@app.cell-def __(embed, make_graph, n_items):+def _(embed, make_graph, n_items):tree, graph = make_graph(n_items.value)embedding = embed(graph)- return embedding, graph, tree+ return embedding, tree@app.cell-def __(mo):+def _(mo):n_items = mo.ui.slider(64, 1024, step=64)- return n_items,+ return (n_items,)@app.cell-def __(functools, pymde, torch):+def _(functools, pymde, torch):@functools.cachedef make_graph(n_items):edges = []@@ -68,11 +69,11 @@ 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,+ return (make_graph,)@app.cell-def __(functools, pymde):+def _(functools, pymde):@functools.cachedef embed(shortest_paths_graph):mde = pymde.MDE(@@ -84,11 +85,11 @@ def __(functools, pymde):),)return mde.embed(verbose=True)- return embed,+ return (embed,)@app.cell-def __():+def _():import functoolsimport pymdediff --git a/examples/third_party/pymde/us_counties.py b/examples/third_party/pymde/us_counties.pyindex b37f946f11..c0dd62f04c 100644--- a/examples/third_party/pymde/us_counties.py+++ b/examples/third_party/pymde/us_counties.py@@ -5,9 +5,10 @@# "pymde==0.1.18",# ]# ///+import marimo-__generated_with = "0.1.56"+__generated_with = "0.15.5"app = marimo.App()@@ -29,7 +30,7 @@ def _(mo):embedding vaguely resembles a map of the US, clustered by political partypreference, though no geographic or party preference data wereused to compute the embedding!-+⚡ We use `mo.ui.altair_chart` to create a reactive and interactivescatter plot of the embedding: this makes it possible to see where countiesland in the embedding!@@ -41,13 +42,13 @@ def _(mo):@app.celldef _():import pymde- return pymde,+ return (pymde,)@app.celldef _(pymde):dataset = pymde.datasets.counties()- return dataset,+ return (dataset,)@app.cell@@ -73,7 +74,7 @@ def _(mo):mo.md("""## The embedding-+We now make a neighbor-preserving embedding, to explore the localrelationships in the data."""@@ -84,13 +85,13 @@ def _(mo):@app.celldef _(dataset, pymde):mde = pymde.preserve_neighbors(data=dataset.data, verbose=True)- return mde,+ return (mde,)@app.celldef _(mde):embedding = mde.embed()- return embedding,+ return (embedding,)@app.cell@@ -113,11 +114,11 @@ def _(mo):def _(embedding, pymde):# Rotate the embedding by some amount of degreesrotated_embedding = pymde.rotate(embedding, -30.0)- return rotated_embedding,+ return (rotated_embedding,)@app.cell-def __(dataset, pd, rotated_embedding):+def _(dataset, pd, rotated_embedding):embedding_df = pd.concat([pd.DataFrame(@@ -133,11 +134,11 @@ def __(dataset, pd, rotated_embedding):],axis=1,)- return embedding_df,+ return (embedding_df,)@app.cell-def __(mo):+def _(mo):mo.md("""### Try it! 👆@@ -150,7 +151,7 @@ def __(mo):@app.cell-def __(alt, embedding_df, mo):+def _(alt, embedding_df, mo):plot = mo.ui.altair_chart(alt.Chart(data=embedding_df, width=400, height=400).mark_circle(size=10, opacity=1)@@ -161,37 +162,37 @@ def __(alt, embedding_df, mo):))plot- return plot,+ return (plot,)@app.cell-def __(mo, plot):+def _(mo, plot):mo.ui.table(plot.value)return@app.cell-def __():+def _():import matplotlib.pyplot as plt- return plt,+ return@app.cell-def __():+def _():import pandas as pd- return pd,+ return (pd,)@app.cell-def __():+def _():import altair as alt- return alt,+ return (alt,)@app.celldef _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/examples/third_party/sage/chat_with_github_repo.py b/examples/third_party/sage/chat_with_github_repo.pyindex 93cd124613..efc381aacc 100644--- a/examples/third_party/sage/chat_with_github_repo.py+++ b/examples/third_party/sage/chat_with_github_repo.py@@ -8,24 +8,24 @@import marimo-__generated_with = "0.9.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo, sys):+def _(mo, sys):mo.md(f"# 🤖💬 {sys.argv[-1]} ")return@app.cell(hide_code=True)-def __(mo, sys):+def _(mo, sys):mo.md(f"""I'm a chatbot that can answer questions about the **{sys.argv[-1]}** GitHub repo. Ask me anything!@@ -35,7 +35,7 @@ def __(mo, sys):@app.cell-def __():+def _():import sysimport logging@@ -63,8 +63,6 @@ def __():create_history_aware_retriever,create_retrieval_chain,create_stuff_documents_chain,- dotenv,- gr,logging,sage_config,sys,@@ -72,7 +70,7 @@ def __():@app.cell-def __(+def _(ChatPromptTemplate,MessagesPlaceholder,build_llm_via_langchain,@@ -129,7 +127,7 @@ def __(@app.cell-def __(configargparse, sage_config, sys):+def _(configargparse, sage_config, sys):parser = configargparse.ArgParser(description="Batch-embeds a GitHub repository and its issues.",ignore_unknown_config_file_keys=True,@@ -153,17 +151,17 @@ def __(configargparse, sage_config, sys):args = parser.parse_args(_argv)for validator in arg_validators:validator(args)- return arg_validators, args, parser, validator+ return (args,)@app.cell-def __(args):+def _(args):argsreturn@app.cell-def __(AIMessage, HumanMessage, args, build_rag_chain, logging, mo):+def _(AIMessage, HumanMessage, args, build_rag_chain, logging, mo):rag_chain = build_rag_chain(args)@@ -220,11 +218,11 @@ def __(AIMessage, HumanMessage, args, build_rag_chain, logging, mo):logging.info(f"Query rewrite: {query_rewrite}")response += chunkyield mo.md(response)- return predict, rag_chain, source_md+ return (predict,)@app.cell-def __(mo, predict):+def _(mo, predict):mo.ui.chat(predict, prompts=["What does this repo do?", "Give me some sample code"])returndiff --git a/examples/third_party/substrate/video_generation.py b/examples/third_party/substrate/video_generation.pyindex 9f78ff8ee2..4c22339fcd 100644--- a/examples/third_party/substrate/video_generation.py+++ b/examples/third_party/substrate/video_generation.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):API_KEY = mo.ui.text(label="Enter your [substrate.run](https://substrate.run) API Key:",kind="password",@@ -29,7 +29,7 @@ def __(mo):@app.cell-def __(substrate):+def _(substrate):from substrate import GenerateImage, UpscaleImage, StableVideoDiffusionprompt = "aerial shot of rainforest at sunset clouds sun rays"@@ -47,33 +47,24 @@ def __(substrate):)res = substrate.run(video_node)- return (- GenerateImage,- StableVideoDiffusion,- UpscaleImage,- image_node,- prompt,- res,- upscale_node,- video_node,- )+ return res, video_node@app.cell-def __(mo, res, video_node):+def _(mo, res, video_node):video = res.get(video_node)mo.image(video.video_uri)- return (video,)+ return@app.cell-def __(API_KEY, mo):+def _(API_KEY, mo):mo.stop(API_KEY.value is None)from substrate import Substrate, ComputeText, sbsubstrate = Substrate(api_key=API_KEY.value)- return ComputeText, Substrate, sb, substrate+ return (substrate,)if __name__ == "__main__":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 8cd4a5d6ea..fcb1932946 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@@ -11,29 +11,30 @@# "xformers",# ]# ///+import marimo-__generated_with = "0.8.13"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():from unsloth import FastLanguageModelfrom transformers import TextStreamerimport torch- return FastLanguageModel, TextStreamer, torch+ return FastLanguageModel, torch@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""<span class="align-center" style="display:flex; flex-direction:row; gap: 16px">@@ -59,7 +60,7 @@ def __(mo):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""* We support Llama, Mistral, Phi-3, Gemma, Yi, DeepSeek, Qwen, TinyLlama, Vicuna, Open Hermes etc@@ -74,19 +75,19 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("### Load the model")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Start by choosing a couple of parameters:""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):max_seq_length = mo.ui.number(value=2048, start=1, stop=4096, label="Max sequence length")@@ -98,19 +99,19 @@ def __(mo):@app.cell-def __():+def _():dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+- return dtype,+ return (dtype,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""We now add LoRA adapters so we only need to update 1 to 10% of all parameters!""")return@app.cell-def __(FastLanguageModel, dtype, load_in_4bit, max_seq_length):+def _(FastLanguageModel, dtype, load_in_4bit, max_seq_length):model, tokenizer = FastLanguageModel.from_pretrained(model_name="unsloth/Meta-Llama-3.1-8B",max_seq_length=max_seq_length.value,@@ -143,7 +144,7 @@ def __(FastLanguageModel, dtype, load_in_4bit, max_seq_length):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""<a name="Data"></a>@@ -163,7 +164,7 @@ def __(mo):@app.cell-def __(tokenizer):+def _(tokenizer):alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.### Instruction:@@ -201,17 +202,11 @@ def __(tokenizer):formatting_prompts_func,batched=True,)- return (- EOS_TOKEN,- alpaca_prompt,- dataset,- formatting_prompts_func,- load_dataset,- )+ return alpaca_prompt, dataset@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""### Train the model@@ -222,7 +217,7 @@ def __(mo):@app.cell(hide_code=True)-def __(dataset, max_seq_length, model, tokenizer):+def _(dataset, max_seq_length, model, tokenizer):from trl import SFTTrainerfrom transformers import TrainingArgumentsfrom unsloth import is_bfloat16_supported@@ -252,11 +247,11 @@ def __(dataset, max_seq_length, model, tokenizer):output_dir="outputs",),)- return SFTTrainer, TrainingArguments, is_bfloat16_supported, trainer+ return (trainer,)@app.cell(hide_code=True)-def __(torch):+def _(torch):# @title Show current memory statsgpu_stats = torch.cuda.get_device_properties(0)start_gpu_memory = round(@@ -265,26 +260,26 @@ def __(torch):max_memory = round(gpu_stats.total_memory / 1024 / 1024 / 1024, 3)print(f"GPU = {gpu_stats.name}. Max memory = {max_memory} GB.")print(f"{start_gpu_memory} GB of memory reserved.")- return gpu_stats, max_memory, start_gpu_memory+ return max_memory, start_gpu_memory@app.cell-def __(mo):+def _(mo):train_button = mo.ui.run_button(label="Click to train!", kind="danger"); train_button.center()- return train_button,+ return (train_button,)@app.cell-def __(train_button, trainer):+def _(train_button, trainer):if train_button.value:trainer_stats = trainer.train()else:trainer_stats = None- return trainer_stats,+ return (trainer_stats,)@app.cell-def __(max_memory, mo, start_gpu_memory, torch, trainer_stats):+def _(max_memory, mo, start_gpu_memory, torch, trainer_stats):mo.stop(trainer_stats is None, mo.md("Train the model 👆"))# Show final memory and time stats@@ -302,16 +297,11 @@ def __(max_memory, mo, start_gpu_memory, torch, trainer_stats):print(f"Peak reserved memory for training % of max memory = {lora_percentage} %.")- return (- lora_percentage,- used_memory,- used_memory_for_lora,- used_percentage,- )+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""<a name="Inference"></a>@@ -325,7 +315,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):inf_instr_inp = mo.md("""{instr}@@ -339,18 +329,11 @@ def __(mo):inf_instr_inp- return inf_instr_inp,+ return (inf_instr_inp,)@app.cell-def __(- FastLanguageModel,- alpaca_prompt,- inf_instr_inp,- mo,- model,- tokenizer,-):+def _(FastLanguageModel, alpaca_prompt, inf_instr_inp, mo, model, tokenizer):mo.stop(inf_instr_inp.value is None)FastLanguageModel.for_inference(model) # Enable native 2x faster inference@@ -367,11 +350,11 @@ def __(outputs = model.generate(**_inputs, max_new_tokens=64, use_cache=True)tokenizer.batch_decode(outputs)- return outputs,+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""And we're done! If you have any questions on Unsloth, we have a [Discord](https://discord.gg/u54VK8m8tk) channel! If you find any bugs or want to keep updated with the latest LLM stuff, or need help, join projects etc, feel free to join our Discord!diff --git a/examples/ui/array_element.py b/examples/ui/array_element.pyindex 469fadb1eb..b9079fe281 100644--- a/examples/ui/array_element.py+++ b/examples/ui/array_element.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/arrays_and_dicts.py b/examples/ui/arrays_and_dicts.pyindex 7211d78edc..55061b06a1 100644--- a/examples/ui/arrays_and_dicts.py+++ b/examples/ui/arrays_and_dicts.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()@@ -127,7 +127,7 @@ def _(create, mo):],justify="space-around",)- return date, mo_d, py_d, slider, text+ return mo_d, py_d@app.cell(hide_code=True)@@ -141,7 +141,7 @@ def _(mo, mo_d, py_d):],justify="space-around",)- return mo_d_ref, py_d_ref+ return@app.cell(hide_code=True)diff --git a/examples/ui/batch.py b/examples/ui/batch.pyindex 3bb21da747..eea93de73b 100644--- a/examples/ui/batch.py+++ b/examples/ui/batch.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/batch_and_form.py b/examples/ui/batch_and_form.pyindex a74cab88fa..fb2d863080 100644--- a/examples/ui/batch_and_form.py+++ b/examples/ui/batch_and_form.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()@@ -79,7 +79,7 @@ def _(mo, reset, submitted_values, variables):{mo.hstack([mo.tree(submitted_values), reset], align="center", gap=4)}""").callout()- return x, y+ return@app.celldiff --git a/examples/ui/button.py b/examples/ui/button.pyindex 28b07610f9..ded421debb 100644--- a/examples/ui/button.py+++ b/examples/ui/button.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/chat.py b/examples/ui/chat.pyindex b27e35968b..b45c813db2 100644--- a/examples/ui/chat.py+++ b/examples/ui/chat.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -21,7 +21,7 @@ def _(mo):show_configuration_controls=True)chatbot- return chatbot, simple_echo_model+ return (chatbot,)@app.celldiff --git a/examples/ui/checkbox.py b/examples/ui/checkbox.pyindex e8d4b6e11f..7bfbfe090c 100644--- a/examples/ui/checkbox.py+++ b/examples/ui/checkbox.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/code_editor.py b/examples/ui/code_editor.pyindex 937586b711..fbdf7c2187 100644--- a/examples/ui/code_editor.py+++ b/examples/ui/code_editor.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/data_editor.py b/examples/ui/data_editor.pyindex c104cfa6d6..838fad6c80 100644--- a/examples/ui/data_editor.py+++ b/examples/ui/data_editor.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/data_explorer.py b/examples/ui/data_explorer.pyindex 7fca1940d0..35a2265949 100644--- a/examples/ui/data_explorer.py+++ b/examples/ui/data_explorer.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/dataframe.py b/examples/ui/dataframe.pyindex 9e2882d753..ae720e8b38 100644--- a/examples/ui/dataframe.py+++ b/examples/ui/dataframe.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/date.py b/examples/ui/date.pyindex c70b85b269..b5e53c11ba 100644--- a/examples/ui/date.py+++ b/examples/ui/date.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/date_range.py b/examples/ui/date_range.pyindex e845cd8ad0..eafe4c5f20 100644--- a/examples/ui/date_range.py+++ b/examples/ui/date_range.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -18,7 +18,7 @@ def _(mo):start=dt.date(2023, 1, 1), stop=dt.date(2023, 12, 31))date_range- return date_range, dt+ return (date_range,)@app.celldiff --git a/examples/ui/datetime_input.py b/examples/ui/datetime_input.pyindex 3ffdcb5b3e..a8d8c4ef18 100644--- a/examples/ui/datetime_input.py+++ b/examples/ui/datetime_input.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/dictionary.py b/examples/ui/dictionary.pyindex 2bf58c6c44..00b355c313 100644--- a/examples/ui/dictionary.py+++ b/examples/ui/dictionary.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/download.py b/examples/ui/download.pyindex 2501123f18..93c1d25e3f 100644--- a/examples/ui/download.py+++ b/examples/ui/download.py@@ -5,9 +5,10 @@# "pandas==2.2.3",# ]# ///+import marimo-__generated_with = "0.10.14"+__generated_with = "0.15.5"app = marimo.App()@@ -46,7 +47,7 @@ def _(json, mo, pd):)mo.hstack([text_download, csv_download, json_download])- return csv_download, data, df, json_download, text_download+ return@app.cell(hide_code=True)@@ -102,16 +103,7 @@ def _(json, mo, pd):mo.hstack([text_download_lazy, csv_download_lazy, json_download_lazy])- return (- asyncio,- csv_download_lazy,- get_csv_data,- get_json_data,- get_text_data,- json_download_lazy,- text_download_lazy,- time,- )+ return@app.celldiff --git a/examples/ui/dropdown.py b/examples/ui/dropdown.pyindex 786c782649..0de2598de8 100644--- a/examples/ui/dropdown.py+++ b/examples/ui/dropdown.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/file.py b/examples/ui/file.pyindex a2a8f2ba31..9c0484ef5c 100644--- a/examples/ui/file.py+++ b/examples/ui/file.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/file_browser.py b/examples/ui/file_browser.pyindex b345260946..a7db341aa4 100644--- a/examples/ui/file_browser.py+++ b/examples/ui/file_browser.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/form.py b/examples/ui/form.pyindex ca8c9165cb..2098af1ef8 100644--- a/examples/ui/form.py+++ b/examples/ui/form.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -17,9 +17,9 @@ def _(mo):mo.md("""**Your form.**-+{name}-+{date}""")diff --git a/examples/ui/image_comparison_demo.py b/examples/ui/image_comparison_demo.pyindex 9662aec708..78beaed76f 100644--- a/examples/ui/image_comparison_demo.py+++ b/examples/ui/image_comparison_demo.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/layout.py b/examples/ui/layout.pyindex e968e0ebae..5451b7528a 100644--- a/examples/ui/layout.py+++ b/examples/ui/layout.py@@ -7,24 +7,24 @@import marimo-__generated_with = "0.8.19"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""# Stacks""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Use `mo.hstack` and `mo.vstack` to layout outputs in rows and columns.""")return@app.cell-def __(mo):+def _(mo):align = mo.ui.dropdown(label="Align", options=["start", "end", "center", "stretch"])@@ -49,13 +49,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""## Horizontal Stack: `hstack`""")return@app.cell-def __(align, boxes, gap, justify, mo, wrap):+def _(align, boxes, gap, justify, mo, wrap):mo.hstack(boxes,align=align.value,@@ -67,13 +67,13 @@ def __(align, boxes, gap, justify, mo, wrap):@app.cell-def __(mo):+def _(mo):mo.md("""## Vertical Stack: `vstack`""")return@app.cell-def __(align, boxes, gap, mo):+def _(align, boxes, gap, mo):mo.vstack(boxes,align=align.value,@@ -83,7 +83,7 @@ def __(align, boxes, gap, mo):@app.cell-def __(mo, size):+def _(mo, size):def create_box(num):box_size = size.value + num * 10return mo.Html(@@ -92,11 +92,11 @@ def __(mo, size):boxes = [create_box(i) for i in range(1, 5)]- return boxes, create_box+ return (boxes,)@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/examples/ui/microphone.py b/examples/ui/microphone.pyindex 98a46826e0..9ed2a0d104 100644--- a/examples/ui/microphone.py+++ b/examples/ui/microphone.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/multiselect.py b/examples/ui/multiselect.pyindex 71a48f36a1..02cea7b174 100644--- a/examples/ui/multiselect.py+++ b/examples/ui/multiselect.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/number.py b/examples/ui/number.pyindex d7bdf57b7b..f4ef8df9fe 100644--- a/examples/ui/number.py+++ b/examples/ui/number.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/radio.py b/examples/ui/radio.pyindex a461d77d50..e881915e7d 100644--- a/examples/ui/radio.py+++ b/examples/ui/radio.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/range_slider.py b/examples/ui/range_slider.pyindex 2f7455f553..90bfaf1b6e 100644--- a/examples/ui/range_slider.py+++ b/examples/ui/range_slider.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/refresh.py b/examples/ui/refresh.pyindex ca748b5674..6339fe035f 100644--- a/examples/ui/refresh.py+++ b/examples/ui/refresh.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/run_button.py b/examples/ui/run_button.pyindex ed3b901adc..fdb98cfb0c 100644--- a/examples/ui/run_button.py+++ b/examples/ui/run_button.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/slider.py b/examples/ui/slider.pyindex db51799f32..9950553056 100644--- a/examples/ui/slider.py+++ b/examples/ui/slider.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/examples/ui/switch.py b/examples/ui/switch.pyindex de915ec2b3..66bc31b42c 100644--- a/examples/ui/switch.py+++ b/examples/ui/switch.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/table.py b/examples/ui/table.pyindex f1434a1e5b..51b483da2d 100644--- a/examples/ui/table.py+++ b/examples/ui/table.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/table_advanced.py b/examples/ui/table_advanced.pyindex 49aa558c57..4d26f145c3 100644--- a/examples/ui/table_advanced.py+++ b/examples/ui/table_advanced.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.11.26"+__generated_with = "0.15.5"app = marimo.App()@@ -95,7 +95,7 @@ def _(mo, office_characters):)table- return (table,)+ return@app.cell(hide_code=True)@@ -108,7 +108,7 @@ def _(mo):def _(mo):data = {str(col): [col * 10 + row for row in range(10)] for col in range(10)}mo.ui.table(data, selection="multi-cell", initial_selection=[("3", "5"),("9","8")])- return (data,)+ return@app.cell@@ -140,7 +140,7 @@ def _(mo):data=colors, pagination=True, page_size=16, style_cell=apply_styling)color_table- return apply_styling, color_table, colors+ return@app.celldiff --git a/examples/ui/tabs.py b/examples/ui/tabs.pyindex d3aa3b8da6..79f88b1c4b 100644--- a/examples/ui/tabs.py+++ b/examples/ui/tabs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/tabs_advanced.py b/examples/ui/tabs_advanced.pyindex 8dd01fa376..c47b55d091 100644--- a/examples/ui/tabs_advanced.py+++ b/examples/ui/tabs_advanced.py@@ -7,7 +7,7 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()@@ -55,7 +55,7 @@ def _(mo):"🏢 Organization": organization,})- return employees, first, last, org, organization, settings+ return employees, first, last, org@app.celldiff --git a/examples/ui/text.py b/examples/ui/text.pyindex 6054bc2f1b..5bf193c186 100644--- a/examples/ui/text.py+++ b/examples/ui/text.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.6"+__generated_with = "0.15.5"app = marimo.App()diff --git a/examples/ui/text_area.py b/examples/ui/text_area.pyindex 2b15536115..8ffd9beca8 100644--- a/examples/ui/text_area.py+++ b/examples/ui/text_area.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.9"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/2d-cells.py b/marimo/_smoke_tests/2d-cells.pyindex c7fd8094b6..2e40e9ef12 100644--- a/marimo/_smoke_tests/2d-cells.py+++ b/marimo/_smoke_tests/2d-cells.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.13"+__generated_with = "0.15.5"app = marimo.App(width="columns")diff --git a/marimo/_smoke_tests/_polars/polars_date_column.py b/marimo/_smoke_tests/_polars/polars_date_column.pyindex 261ef61149..b36ccfec0d 100644--- a/marimo/_smoke_tests/_polars/polars_date_column.py+++ b/marimo/_smoke_tests/_polars/polars_date_column.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import polars as plfrom datetime import date@@ -19,7 +19,7 @@ def __():pl.col("date").dt.timestamp("ms").alias("timestamp_ms"),pl.lit(None).cast(pl.Datetime).alias("test"),)- return date, df, pl+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/_polars/polars_to_csv.py b/marimo/_smoke_tests/_polars/polars_to_csv.pyindex 059039161d..0be4ae77ca 100644--- a/marimo/_smoke_tests/_polars/polars_to_csv.py+++ b/marimo/_smoke_tests/_polars/polars_to_csv.py@@ -6,14 +6,15 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.8"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import datetimeimport marimo as moimport polars as pl@@ -61,17 +62,17 @@ def __():},strict=False,)- return complex_data, datetime, mo, pl+ return complex_data, mo@app.cell-def __(complex_data, mo):+def _(complex_data, mo):mo.plain(complex_data)return@app.cell-def __(complex_data):+def _(complex_data):complex_datareturndiff --git a/marimo/_smoke_tests/_transformers/text_streamer.py b/marimo/_smoke_tests/_transformers/text_streamer.pyindex 3d1916ff69..c1407393f8 100644--- a/marimo/_smoke_tests/_transformers/text_streamer.py+++ b/marimo/_smoke_tests/_transformers/text_streamer.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.12.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -32,14 +32,7 @@ def _():tokenizer = AutoTokenizer.from_pretrained("sshleifer/tiny-gpt2")pipeline = pipeline("text-generation", model="sshleifer/tiny-gpt2")streamer = TextIteratorStreamer(tokenizer)- return (- AutoModelForCausalLM,- AutoTokenizer,- TextIteratorStreamer,- pipeline,- streamer,- tokenizer,- )+ return pipeline, streamer@app.celldiff --git a/marimo/_smoke_tests/admonitions.py b/marimo/_smoke_tests/admonitions.pyindex 401a38d0bb..2b4459bab4 100644--- a/marimo/_smoke_tests/admonitions.py+++ b/marimo/_smoke_tests/admonitions.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):kinds = [# ---"info",@@ -51,17 +51,17 @@ def __(mo):mo.vstack([create(kind) for kind in kinds])- return create, kinds+ return@app.cell-def __(mo):+def _(mo):mo.md("""# Misc""")return@app.cell-def __(mo):+def _(mo):mo.md(rf"""!!! important ""@@ -72,18 +72,18 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""!!! tip ""Importa recordar as seguintes regras de diferenciação de matrizes:-+$$\frac{\partial\, u'v}{\partial\, v} = \frac{\partial\, v'u}{\partial\, v} = u$$-+sendo $u$ e $v$ dois vetores.-+$$\frac{\partial\, v'Av}{\partial\, v}=2Av=2v'A$$-+em que $A$ é uma matriz simétrica. No nosso caso, $A=X'X$ e $v=\hat{\boldsymbol{\beta}}$.import marimo as mo""")diff --git a/marimo/_smoke_tests/ai/gemini_responses.py b/marimo/_smoke_tests/ai/gemini_responses.pyindex c3e766dcff..022dd61d20 100644--- a/marimo/_smoke_tests/ai/gemini_responses.py+++ b/marimo/_smoke_tests/ai/gemini_responses.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -56,7 +56,7 @@ def _(api_token):from google import genaiclient = genai.Client(api_key=api_token.value)- return genai, client+ return (client,)@app.cell(hide_code=True)diff --git a/marimo/_smoke_tests/ai/github_model_check.py b/marimo/_smoke_tests/ai/github_model_check.pyindex 33243035f4..eab43656bf 100644--- a/marimo/_smoke_tests/ai/github_model_check.py+++ b/marimo/_smoke_tests/ai/github_model_check.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.14.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/ai/model_check.py b/marimo/_smoke_tests/ai/model_check.pyindex c4e4da04ff..eef8aae447 100644--- a/marimo/_smoke_tests/ai/model_check.py+++ b/marimo/_smoke_tests/ai/model_check.py@@ -12,7 +12,7 @@import marimo-__generated_with = "0.14.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/ai/openai_responses.py b/marimo/_smoke_tests/ai/openai_responses.pyindex 25ccdc640b..86e3e63c59 100644--- a/marimo/_smoke_tests/ai/openai_responses.py+++ b/marimo/_smoke_tests/ai/openai_responses.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -60,7 +60,7 @@ def _(api_token):stream=True,)response- return OpenAI, client, response+ return (client,)@app.cell(hide_code=True)diff --git a/marimo/_smoke_tests/altair_examples/altair_brush.py b/marimo/_smoke_tests/altair_examples/altair_brush.pyindex 9950bf6a65..5fa7341043 100644--- a/marimo/_smoke_tests/altair_examples/altair_brush.py+++ b/marimo/_smoke_tests/altair_examples/altair_brush.py@@ -11,18 +11,18 @@import marimo-__generated_with = "0.7.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md(r"""## Data""")return@app.cell-def __():+def _():import altair as altimport numpy as npimport pandas as pd@@ -38,17 +38,17 @@ def __():traces = pd.DataFrame(data)print(traces.head())- return alt, data, mo, np, pd, traces+ return alt, mo, traces@app.cell-def __(mo):+def _(mo):mo.md(r"""## Plain Altair""")return@app.cell-def __(alt, traces):+def _(alt, traces):_brush = alt.selection_interval(encodings=["x"])_chart_overview = (@@ -70,13 +70,13 @@ def __(alt, traces):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Example of the Or ( | ) operator""")return@app.cell-def __(alt, mo, traces):+def _(alt, mo, traces):_brush = alt.selection_interval(encodings=["x"])chart_overview = mo.ui.altair_chart(@@ -100,20 +100,20 @@ def __(alt, mo, traces):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Example of the Or ( | ) operator with selection""")return@app.cell-def __(chart_detail, chart_overview):+def _(chart_detail, chart_overview):combined = chart_overview | chart_detailcombinedreturn (combined,)@app.cell-def __(combined):+def _(combined):combined.valuereturndiff --git a/marimo/_smoke_tests/altair_examples/altair_charts.py b/marimo/_smoke_tests/altair_examples/altair_charts.pyindex 138f388f2b..2fb05316f8 100644--- a/marimo/_smoke_tests/altair_examples/altair_charts.py+++ b/marimo/_smoke_tests/altair_examples/altair_charts.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell(hide_code=True)-def __():+def _():import jsonimport numpy as np@@ -24,12 +24,11 @@ def __():from vega_datasets import dataimport marimo as mo-- return data, json, mo, np, pd+ return data, mo, np, pd@app.cell-def __(data):+def _(data):# datacars = data.cars()employment = data.unemployment_across_industries.url@@ -38,7 +37,7 @@ def __(data):@app.cell(hide_code=True)-def __(mo):+def _(mo):chart_selection_type = mo.ui.radio(["default", "point", "interval"],label="Selection Type",@@ -56,7 +55,7 @@ def __(mo):@app.cell-def __(chart_selection_type, legend_selection_type, theme):+def _(chart_selection_type, legend_selection_type, theme):import altair as altalt.themes.enable(theme.value)@@ -71,7 +70,7 @@ def __(chart_selection_type, legend_selection_type, theme):@app.cell-def __(alt, cars, chart_selection_value, legend_selection_value, mo):+def _(alt, cars, chart_selection_value, legend_selection_value, mo):_chart = (alt.Chart(cars).mark_point()@@ -91,13 +90,13 @@ def __(alt, cars, chart_selection_value, legend_selection_value, mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Basic Chart""")return@app.cell-def __(alt, chart1, chart_selection_value, legend_selection_value, mo):+def _(alt, chart1, chart_selection_value, legend_selection_value, mo):mo.vstack([chart1,@@ -123,7 +122,7 @@ def __(alt, chart1, chart_selection_value, legend_selection_value, mo):@app.cell-def __(alt, chart_selection_value, employment, legend_selection_value, mo):+def _(alt, chart_selection_value, employment, legend_selection_value, mo):# _selection = alt.selection_point(fields=["series"], bind="legend")_chart = (@@ -148,25 +147,25 @@ def __(alt, chart_selection_value, employment, legend_selection_value, mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Another Chart""")return@app.cell-def __(chart2, mo):+def _(chart2, mo):mo.vstack([chart2, chart2.value.head(10)])return@app.cell-def __(mo):+def _(mo):mo.md("""# Defined Width + Height""")return@app.cell-def __(alt, iris, mo):+def _(alt, iris, mo):_chart = (alt.Chart(iris).mark_circle()@@ -188,7 +187,7 @@ def __(alt, iris, mo):@app.cell-def __(alt, chart_selection_value, iris, legend_selection_value, mo):+def _(alt, chart_selection_value, iris, legend_selection_value, mo):# _color_sel = alt.selection_point(fields=["species"], bind="legend")# _size_sel = alt.selection_point(fields=["petalWidth"], bind="legend")@@ -216,43 +215,43 @@ def __(alt, chart_selection_value, iris, legend_selection_value, mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Chart + Chart""")return@app.cell-def __(chart3, mo):+def _(chart3, mo):mo.hstack([chart3, chart3])return@app.cell-def __(mo):+def _(mo):mo.md("""# Chart + Table""")return@app.cell-def __(chart3, mo):+def _(chart3, mo):mo.hstack([chart3, chart3.value.head(10)], widths="equal")return@app.cell-def __(mo):+def _(mo):mo.md("""# Chart + Table returned as an array""")return@app.cell-def __(chart3):+def _(chart3):[chart3, chart3.value.head(10)]return@app.cell-def __(alt, cars, chart_selection_value, legend_selection_value, mo):+def _(alt, cars, chart_selection_value, legend_selection_value, mo):brush = alt.selection_interval()points = (alt.Chart(cars)@@ -276,39 +275,39 @@ def __(alt, cars, chart_selection_value, legend_selection_value, mo):chart_selection=chart_selection_value,legend_selection=legend_selection_value,)- return bars, brush, chart4, plot, points+ return (chart4,)@app.cell-def __(mo):+def _(mo):mo.md("""# Chart with transform""")return@app.cell-def __(chart4, mo):+def _(chart4, mo):mo.vstack([chart4, chart4.value.head(10)])return@app.cell-def __(mo):+def _(mo):mo.md("""# Bar chart""")return@app.cell-def __(alt, data, mo):+def _(alt, data, mo):binned = mo.ui.altair_chart(alt.Chart(data.cars()).mark_bar().encode(x=alt.X("Miles_per_Gallon:Q", bin=True), y="count()"))- return (binned,)+ return@app.cell-def __(alt, cars, mo):+def _(alt, cars, mo):mean = mo.ui.altair_chart(alt.Chart(cars).mark_bar()@@ -321,13 +320,13 @@ def __(alt, cars, mo):@app.cell-def __(mean, mo):+def _(mean, mo):mo.vstack([mean, mean.value])return@app.cell-def __(alt, data, mo):+def _(alt, data, mo):hist = (alt.Chart(data.cars()).mark_bar()@@ -338,19 +337,19 @@ def __(alt, data, mo):@app.cell-def __(hist, mo):+def _(hist, mo):mo.vstack([hist, hist.value])return@app.cell-def __(mo):+def _(mo):mo.md("""# Pivot and horizontal bar chart""")return@app.cell-def __(alt, mo, pd):+def _(alt, mo, pd):df = pd.DataFrame.from_records([{"country": "Norway", "type": "gold", "count": 14},@@ -374,17 +373,17 @@ def __(alt, mo, pd):y="country:N",))- return df, pivot+ return (pivot,)@app.cell-def __(mo, pivot):+def _(mo, pivot):mo.vstack([pivot, pivot.value.head()])return@app.cell-def __(alt, data, mo):+def _(alt, data, mo):_source = data.population.urlhorizontal_bar = mo.ui.altair_chart(@@ -401,13 +400,13 @@ def __(alt, data, mo):@app.cell-def __(horizontal_bar, mo):+def _(horizontal_bar, mo):mo.vstack([horizontal_bar, horizontal_bar.value.head()])return@app.cell-def __(alt, mo, pd):+def _(alt, mo, pd):_source = pd.DataFrame({"category": [1, 2, 3, 4, 5, 6], "value": [4, 6, 10, 3, 7, 8]})@@ -424,19 +423,19 @@ def __(alt, mo, pd):@app.cell-def __(mo, pie):+def _(mo, pie):mo.vstack([pie, pie.value])return@app.cell-def __(mo):+def _(mo):mo.md("""# Line Chart""")return@app.cell-def __(alt, mo, np, pd):+def _(alt, mo, np, pd):x = np.arange(100)source = pd.DataFrame({"x": x, "f(x)": np.sin(x / 5)})@@ -445,23 +444,23 @@ def __(alt, mo, np, pd):chart_selection="interval",)line_chart- return line_chart, source, x+ return (line_chart,)@app.cell-def __(line_chart, mo):+def _(line_chart, mo):mo.hstack([line_chart.value, line_chart.selections])return@app.cell-def __(mo):+def _(mo):mo.md("""# Multi-Line Chart""")return@app.cell-def __(alt, data, mo):+def _(alt, data, mo):_source = data.stocks()alt.Chart(_source).mark_line().encode(@@ -484,13 +483,13 @@ def __(alt, data, mo):@app.cell-def __(mo, multiline_chart):+def _(mo, multiline_chart):mo.hstack([multiline_chart.value, multiline_chart.selections])return@app.cell-def __(alt, mo, np, pd):+def _(alt, mo, np, pd):# Example dataset_data = pd.DataFrame({@@ -520,13 +519,13 @@ def __(alt, mo, np, pd):@app.cell-def __(facet_chart, mo):+def _(facet_chart, mo):mo.hstack([facet_chart.value, facet_chart.selections])return@app.cell-def __(mo):+def _(mo):mo.md("""# With `transform_filter`@@ -537,7 +536,7 @@ def __(mo):@app.cell-def __(alt, data, mo):+def _(alt, data, mo):from altair import datum_chart = (@@ -555,19 +554,19 @@ def __(alt, data, mo):@app.cell-def __(mo, with_transform):+def _(mo, with_transform):mo.vstack([with_transform, with_transform.value])return@app.cell-def __(mo):+def _(mo):mo.md("""# Layers""")return@app.cell-def __(alt, mo, pd):+def _(alt, mo, pd):_source = pd.DataFrame({"yield_error": [7.5522, 6.9775, 3.9167, 11.9732],@@ -599,11 +598,11 @@ def __(alt, mo, pd):_chart = bar + point# layered_chart = mo.ui.altair_chart(_chart, chart_selection="point")layered_chart = mo.ui.altair_chart(_chart, chart_selection="interval")- return bar, layered_chart, point+ return (layered_chart,)@app.cell-def __(layered_chart, mo):+def _(layered_chart, mo):mo.vstack([layered_chart,@@ -614,13 +613,13 @@ def __(layered_chart, mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""# layered""")return@app.cell-def __(alt, data, datum, mo):+def _(alt, data, datum, mo):stocks = data.stocks.urlbase = (@@ -631,29 +630,29 @@ def __(alt, data, datum, mo):t = mo.ui.altair_chart(base.mark_line() + base.mark_point())t- return base, stocks, t+ return (base,)@app.cell-def __(mo):+def _(mo):mo.md(r"""# hconcat""")return@app.cell-def __(base, mo):+def _(base, mo):mo.ui.altair_chart(base.mark_line() | base.mark_point())return@app.cell-def __(mo):+def _(mo):mo.md("""# vconcat""")return@app.cell-def __(base, mo):+def _(base, mo):mo.ui.altair_chart(base.mark_line() & base.mark_point())returndiff --git a/marimo/_smoke_tests/altair_examples/altair_datetime.py b/marimo/_smoke_tests/altair_examples/altair_datetime.pyindex 566eabde2a..358ef8dc2a 100644--- a/marimo/_smoke_tests/altair_examples/altair_datetime.py+++ b/marimo/_smoke_tests/altair_examples/altair_datetime.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.33"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from datetime import datetime, timedelta, timezoneimport altair as alt@@ -23,11 +23,11 @@ def __():for i in range(1000)])- return alt, datetime, df, mo, pd, timedelta, timezone+ return alt, df, mo@app.cell-def __(alt, df, mo):+def _(alt, df, mo):bars = (alt.Chart(df).mark_bar()@@ -35,11 +35,11 @@ def __(alt, df, mo):)selection = mo.ui.altair_chart(bars)selection- return bars, selection+ return (selection,)@app.cell-def __(selection):+def _(selection):selection.valuereturndiff --git a/marimo/_smoke_tests/altair_examples/altair_geoshape.py b/marimo/_smoke_tests/altair_examples/altair_geoshape.pyindex 0aba39e1b0..d71d77c9bb 100644--- a/marimo/_smoke_tests/altair_examples/altair_geoshape.py+++ b/marimo/_smoke_tests/altair_examples/altair_geoshape.py@@ -10,19 +10,18 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo-return (mo,)@app.cell-def __():+def _():import altair as altimport geopandas as gpdfrom vega_datasets import data@@ -30,17 +29,17 @@ def __():url = "https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"gdf_ne = gpd.read_file(url) # zipped shapefilegdf_ne = gdf_ne[["NAME", "CONTINENT", "POP_EST", "geometry"]]- return alt, data, gdf_ne, gpd, url+ return alt, gdf_ne@app.cell-def __(gdf_ne):+def _(gdf_ne):gdf_sel = gdf_ne.query("CONTINENT == 'Africa'")return (gdf_sel,)@app.cell-def __(alt, gdf_sel):+def _(alt, gdf_sel):chart = (alt.Chart(gdf_sel).mark_geoshape(stroke="white", strokeWidth=1.5)@@ -50,32 +49,32 @@ def __(alt, gdf_sel):@app.cell-def __(chart):+def _(chart):chartreturn@app.cell-def __(chart):+def _(chart):chart.mark.typereturn@app.cell-def __(chart, mo):+def _(chart, mo):mo_chart = mo.ui.altair_chart(chart)mo_chartreturn (mo_chart,)@app.cell-def __(mo, mo_chart):+def _(mo, mo_chart):mo.ui.table(mo_chart.value)return@app.cell-def __(chart, mo):+def _(chart, mo):mo.ui.altair_chart(chart, chart_selection=None)returndiff --git a/marimo/_smoke_tests/altair_examples/altair_polars.py b/marimo/_smoke_tests/altair_examples/altair_polars.pyindex 8ce072753c..d0e23332cd 100644--- a/marimo/_smoke_tests/altair_examples/altair_polars.py+++ b/marimo/_smoke_tests/altair_examples/altair_polars.py@@ -6,34 +6,34 @@# "polars",# ]# ///+import marimo-__generated_with = "0.8.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import altair as altimport marimo as mo-return alt, mo@app.cell-def __():+def _():import polars as pldf = pl.DataFrame({"year": [2020, 2021, 2022], "population": [1000, 2000, 3000]})df- return df, pl+ return (df,)@app.cell-def __(alt, df, mo):+def _(alt, df, mo):chart = mo.ui.altair_chart(alt.Chart(df).mark_bar()@@ -47,7 +47,7 @@ def __(alt, df, mo):@app.cell-def __(chart):+def _(chart):chart.valuereturndiff --git a/marimo/_smoke_tests/altair_examples/binary_values.py b/marimo/_smoke_tests/altair_examples/binary_values.pyindex 6a9f4d8779..cd98943a8e 100644--- a/marimo/_smoke_tests/altair_examples/binary_values.py+++ b/marimo/_smoke_tests/altair_examples/binary_values.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.8"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -35,7 +35,7 @@ def _():)mo.hstack([pd_chart, pl_chart])- return alt, df, mo, pd, pd_chart, pl, pl_chart, pl_df+ return alt, mo, pd_chart, pl_chart@app.celldiff --git a/marimo/_smoke_tests/altair_examples/boxplot.py b/marimo/_smoke_tests/altair_examples/boxplot.pyindex 5cd960def4..ed8a8c0523 100644--- a/marimo/_smoke_tests/altair_examples/boxplot.py+++ b/marimo/_smoke_tests/altair_examples/boxplot.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -38,7 +38,7 @@ def _():)boxplot- return alt, boxplot, data, data_pd, pl+ return boxplot, pl@app.cell@@ -66,7 +66,7 @@ def _(pl):boxplot2 = df.plot.boxplot(y="grp", x="val", color="grp")boxplot2- return boxplot2, df, random+ return (boxplot2,)@app.cell@@ -78,7 +78,6 @@ def _(boxplot2, mo):@app.celldef _():import marimo as mo-return (mo,)diff --git a/marimo/_smoke_tests/altair_examples/chart_dates.py b/marimo/_smoke_tests/altair_examples/chart_dates.pyindex 29940cc8e0..2733d167fb 100644--- a/marimo/_smoke_tests/altair_examples/chart_dates.py+++ b/marimo/_smoke_tests/altair_examples/chart_dates.py@@ -1,13 +1,12 @@import marimo-__generated_with = "0.11.30"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():import marimo as mo-return (mo,)@@ -17,7 +16,6 @@ def _():import altair as altimport polars as pl-return alt, date, pldiff --git a/marimo/_smoke_tests/altair_examples/embed_options.py b/marimo/_smoke_tests/altair_examples/embed_options.pyindex 791ea3ba01..9d57c50f8a 100644--- a/marimo/_smoke_tests/altair_examples/embed_options.py+++ b/marimo/_smoke_tests/altair_examples/embed_options.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import altair as altimport pandas as pd@@ -19,11 +19,11 @@ def __():# Plain chartchart = alt.Chart(data).mark_line().encode(x="x", y="y")chart- return alt, chart, data, mo, pd+ return chart, mo@app.cell-def __(chart, mo):+def _(chart, mo):# Wrapped chartmo.ui.altair_chart(chart)returndiff --git a/marimo/_smoke_tests/altair_examples/layered_charts.py b/marimo/_smoke_tests/altair_examples/layered_charts.pyindex 787c9b520f..bdaf1c5b3a 100644--- a/marimo/_smoke_tests/altair_examples/layered_charts.py+++ b/marimo/_smoke_tests/altair_examples/layered_charts.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.21"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import altair as altimport pandas as pd@@ -19,17 +19,17 @@ def __():{"Level1": "c", "count": 3, "stage": "england"},])- return alt, mo, pd, test_counts+ return alt, mo, test_counts@app.cell-def __(mo):+def _(mo):mo.md(r"""## Layered""")return@app.cell-def __(alt, mo, test_counts):+def _(alt, mo, test_counts):# Base_base = alt.Chart(test_counts)@@ -60,19 +60,19 @@ def __(alt, mo, test_counts):@app.cell-def __(layered_chart):+def _(layered_chart):layered_chart.valuereturn@app.cell-def __(mo):+def _(mo):mo.md(r"""## Warnings""")return@app.cell-def __(alt, chart, mo, rule):+def _(alt, chart, mo, rule):mo.ui.altair_chart(alt.layer(chart, rule), chart_selection="point")Nonereturndiff --git a/marimo/_smoke_tests/altair_examples/map_selection.py b/marimo/_smoke_tests/altair_examples/map_selection.pyindex 0c00ccaf4c..d3720f1361 100644--- a/marimo/_smoke_tests/altair_examples/map_selection.py+++ b/marimo/_smoke_tests/altair_examples/map_selection.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.8"+__generated_with = "0.15.5"app = marimo.App(width="columns")@@ -15,7 +15,6 @@ def _():import altair as altimport geopandas as gpdfrom vega_datasets import data-return alt, data, gpd@@ -96,7 +95,6 @@ def _(alt, us_population, us_states):)return (choropleth & bars).add_params(click_state)-return (population_map,)@@ -145,7 +143,6 @@ def _():@app.celldef _():import marimo as mo-return (mo,)@@ -221,7 +218,6 @@ def _(alt, gdf_quakies, gdf_world):type="orthographic", rotate=alt.expr(f"[{rotate0.name}, 0, 0]"))return comb-return (world_map,)diff --git a/marimo/_smoke_tests/altair_examples/nans_infinity.py b/marimo/_smoke_tests/altair_examples/nans_infinity.pyindex ee17fb7886..1ee9359ceb 100644--- a/marimo/_smoke_tests/altair_examples/nans_infinity.py+++ b/marimo/_smoke_tests/altair_examples/nans_infinity.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.15.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/altair_examples/narwhals_compat.py b/marimo/_smoke_tests/altair_examples/narwhals_compat.pyindex a9f99e6513..c0d874ecbf 100644--- a/marimo/_smoke_tests/altair_examples/narwhals_compat.py+++ b/marimo/_smoke_tests/altair_examples/narwhals_compat.py@@ -1,22 +1,21 @@import marimo-__generated_with = "0.9.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import altair as altimport pandas as pdimport polars as plimport marimo as mo-return alt, mo, pd, pl@app.cell-def __(mo, pd, pl):+def _(mo, pd, pl):url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv"df_selection = mo.ui.dropdown(@@ -24,11 +23,11 @@ def __(mo, pd, pl):value="polars",)df_selection- return df_selection, url+ return (df_selection,)@app.cell-def __(alt, df_selection, mo):+def _(alt, df_selection, mo):df = df_selection.valuechart = mo.ui.altair_chart(alt.Chart(df)@@ -40,25 +39,25 @@ def __(alt, df_selection, mo):@app.cell-def __(chart):+def _(chart):chart.datareturn@app.cell-def __(chart, df):+def _(chart, df):["Types", type(df), type(chart.dataframe), type(chart.value)]return@app.cell-def __(chart):+def _(chart):chart.valuereturn@app.cell-def __(chart):+def _(chart):chart.dataframereturndiff --git a/marimo/_smoke_tests/altair_examples/nested_vconcat.py b/marimo/_smoke_tests/altair_examples/nested_vconcat.pyindex 5e042fa434..39c061f201 100644--- a/marimo/_smoke_tests/altair_examples/nested_vconcat.py+++ b/marimo/_smoke_tests/altair_examples/nested_vconcat.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/altair_examples/repeat.py b/marimo/_smoke_tests/altair_examples/repeat.pyindex 53ff6d96ec..76c66c01dd 100644--- a/marimo/_smoke_tests/altair_examples/repeat.py+++ b/marimo/_smoke_tests/altair_examples/repeat.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.4"+__generated_with = "0.15.5"app = marimo.App()@@ -26,7 +26,7 @@ def _():"value2": [100, 34],})- return alt, date, mo, pl, sample_data+ return alt, mo, sample_data@app.cell@@ -44,7 +44,7 @@ def _(alt, mo, sample_data):# expected output is to have two rows with same chartsmo.vstack([chart, mo.ui.altair_chart(chart)])- return (chart,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/altair_examples/text_selection.py b/marimo/_smoke_tests/altair_examples/text_selection.pyindex 19285c36ff..03fb1affe5 100644--- a/marimo/_smoke_tests/altair_examples/text_selection.py+++ b/marimo/_smoke_tests/altair_examples/text_selection.py@@ -9,14 +9,13 @@import marimo-__generated_with = "0.13.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():import marimo as mo-return (mo,)diff --git a/marimo/_smoke_tests/altair_examples/timestamp_with_no_timezone.py b/marimo/_smoke_tests/altair_examples/timestamp_with_no_timezone.pyindex 0cc33f8f43..afc1f8ecbc 100644--- a/marimo/_smoke_tests/altair_examples/timestamp_with_no_timezone.py+++ b/marimo/_smoke_tests/altair_examples/timestamp_with_no_timezone.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.34"-app = marimo.App(width="full", auto_download=["html"])+__generated_with = "0.15.5"+app = marimo.App(width="full")@app.cell-def __(alt, df, mo):+def _(alt, df, mo):tmc = mo.ui.altair_chart(alt.Chart(df.reset_index()).mark_bar()@@ -19,19 +19,19 @@ def __(alt, df, mo):@app.cell-def __(tmc):+def _(tmc):tmc.valuereturn@app.cell-def __(build_df, d):+def _(build_df, d):df = build_df(d)return (df,)@app.cell-def __(StringIO, date_format, pd):+def _(StringIO, date_format, pd):def build_df(data: str):res = pd.read_csv(StringIO(data))res["timestamp"] = pd.to_datetime(@@ -48,18 +48,17 @@ def __(StringIO, date_format, pd):]return res-return (build_df,)@app.cell-def __():+def _():date_format = "%b %d, %Y @ %H:%M:%S.%f"return (date_format,)@app.cell-def __():+def _():d = '''"@timestamp",message,severity,"kubernetes.pod_name""Nov 26, 2024 @ 00:29:59.795","time=""2024-11-26T00:29:59Z"" level=info msg=""app_disconn(device-ap-c8a608174aa0)(ap)(209766850)(1)(1)(Client Closed)(thirdparty-nats-3)"" @service=benthos label="""" path=root.pipeline.processors.0.workflow.processors.1 stream=sys_evts_acct_conn_disconn",,"thirdparty-benthos-fbfb4884d-wf775""Nov 26, 2024 @ 00:29:59.794","time=""2024-11-26T00:29:59Z"" level=info msg=""app_conn(device-ap-58fb961a30d0)(ap)(thirdparty-nats-4)"" @service=benthos label="""" path=root.pipeline.processors.0.workflow.processors.1 stream=sys_evts_acct_conn_disconn",,"thirdparty-benthos-fbfb4884d-wf775"@@ -75,7 +74,7 @@ def __():@app.cell-def __():+def _():from io import StringIOimport altair as alt@@ -83,8 +82,7 @@ def __():import pandas as pdimport marimo as mo-- return StringIO, alt, mo, np, pd+ return StringIO, alt, mo, pdif __name__ == "__main__":diff --git a/marimo/_smoke_tests/altair_examples/vegafusion_histograms.py b/marimo/_smoke_tests/altair_examples/vegafusion_histograms.pyindex 74cf233b97..9caa6122eb 100644--- a/marimo/_smoke_tests/altair_examples/vegafusion_histograms.py+++ b/marimo/_smoke_tests/altair_examples/vegafusion_histograms.py@@ -14,14 +14,13 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():import marimo as mo-return (mo,)@@ -62,7 +61,7 @@ def _():flights = pl.read_parquet("https://vegafusion-datasets.s3.amazonaws.com/vega/flights_1m.parquet")- return alt, flights, pl, vf+ return alt, flights@app.cell@@ -121,7 +120,7 @@ def _(alt, flights, mo):))mo.hstack(charts)- return charts, col, columns+ return@app.celldiff --git a/marimo/_smoke_tests/altair_examples/vegafusion_nb.py b/marimo/_smoke_tests/altair_examples/vegafusion_nb.pyindex d15ce5875a..5b456bf831 100644--- a/marimo/_smoke_tests/altair_examples/vegafusion_nb.py+++ b/marimo/_smoke_tests/altair_examples/vegafusion_nb.py@@ -12,14 +12,13 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():import marimo as mo-return (mo,)@@ -145,7 +144,6 @@ def _(alt):.transform_calculate("time", "hours(datum.date)").repeat(column=["distance", "delay", "time"]))-return (make_cross_filter_chart,)@@ -156,7 +154,7 @@ def _(alt, make_cross_filter_chart, pd):"https://vegafusion-datasets.s3.amazonaws.com/vega/flights_200k.parquet")make_cross_filter_chart(source_data)- return (source_data,)+ return@app.cell@@ -191,7 +189,6 @@ def _(alt):)return alt.layer(bars, line, data=source).properties(height=200)-return (make_average_chart,)@@ -260,7 +257,6 @@ def _(alt):bar,rect + circ,).resolve_legend(color="independent", size="independent")-return (make_movie_chart,)diff --git a/marimo/_smoke_tests/altair_examples/vegafusion_select.py b/marimo/_smoke_tests/altair_examples/vegafusion_select.pyindex 2172415853..0e432eef34 100644--- a/marimo/_smoke_tests/altair_examples/vegafusion_select.py+++ b/marimo/_smoke_tests/altair_examples/vegafusion_select.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.11.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -42,7 +42,7 @@ def _():# Make it reactive ⚡chart = mo.ui.anywidget(alt.JupyterChart(_chart))- return alt, cars, chart, data, mo+ return (chart,)@app.celldiff --git a/marimo/_smoke_tests/ansi.py b/marimo/_smoke_tests/ansi.pyindex a2cee0233c..b7ee4234bb 100644--- a/marimo/_smoke_tests/ansi.py+++ b/marimo/_smoke_tests/ansi.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return@app.cell-def __():+def _():print("".join("\x1b[{}m{}\n\x1b[0m".format(31 + i, "Hello, World!") for i in range(8)@@ -29,37 +29,37 @@ def __():@app.cell-def __():+def _():txt = "\n\n\x1B[1;33;40m 33;40 \x1B[1;33;41m 33;41 \x1B[1;33;42m 33;42 \x1B[1;33;43m 33;43 \x1B[1;33;44m 33;44 \x1B[1;33;45m 33;45 \x1B[1;33;46m 33;46 \x1B[1m\x1B[0\n\n\x1B[1;33;42m >> Tests OK\n\n"print(txt)- return txt,+ return@app.cell-def __():+def _():import sysprint("Hello world", file=sys.stderr)- return sys,+ return@app.cell-def __():+def _():# No ANSI conversion when not stdout or stderr"".join("\x1b[{}m{}\n\x1b[0m".format(31 + i, "Hello, World!") for i in range(8))return@app.cell-def __():+def _():# Colors input()input("\x1b[34mPress Enter to continue\x1b[0m")return@app.cell-def __():+def _():import logging# ANSI escape codes for colors@@ -94,7 +94,7 @@ def __():logger.warning("This is a warning message")logger.error("This is an error message")logger.critical("This is a critical message")- return AnsiColorFormatter, formatter, handler, logger, logging+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/anywidget_compat.py b/marimo/_smoke_tests/anywidget_compat.pyindex 6056ef3a37..f5b89e8677 100644--- a/marimo/_smoke_tests/anywidget_compat.py+++ b/marimo/_smoke_tests/anywidget_compat.py@@ -9,20 +9,21 @@# "drawdata",# ]# ///+import marimo-__generated_with = "0.2.13"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import anywidgetimport traitlets@@ -60,78 +61,78 @@ def __():# Stateful property that can be accessed by JavaScript & Pythoncount = traitlets.Int(0).tag(sync=True)- return CounterWidget, anywidget, traitlets+ return (CounterWidget,)@app.cell-def __(CounterWidget):+def _(CounterWidget):# Non-reactivew = CounterWidget()w- return w,+ return (w,)@app.cell-def __(w):+def _(w):# Non-reactive, but class is cachedwreturn@app.cell-def __(w):+def _(w):w.trait_values()["count"]return@app.cell-def __(CounterWidget, mo):+def _(CounterWidget, mo):w_reactive = mo.ui.anywidget(CounterWidget())w_reactive- return w_reactive,+ return (w_reactive,)@app.cell-def __(w_reactive):+def _(w_reactive):w_reactivereturn@app.cell-def __(w_reactive):+def _(w_reactive):w_reactive.valuereturn@app.cell-def __(w_reactive):+def _(w_reactive):w_reactive.widget.trait_values()["count"]return@app.cell-def __():+def _():import altair as altimport pandas as pdreturn alt, pd@app.cell-def __(mo):+def _(mo):from drawdata import ScatterWidgetdd_widget = mo.ui.anywidget(ScatterWidget())dd_widget- return ScatterWidget, dd_widget+ return (dd_widget,)@app.cell(hide_code=True)-def __(alt, dd_widget, mo, pd):+def _(alt, dd_widget, mo, pd):mo.stop(not dd_widget.value["data"])df = pd.DataFrame(dd_widget.value["data"])chart = alt.Chart(df).mark_point().encode(x="x", y="y", color="color")mo.ui.altair_chart(chart)- return chart, df+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/anywidget_examples/esm_rerender.py b/marimo/_smoke_tests/anywidget_examples/esm_rerender.pyindex 4042cba3a6..2c40637224 100644--- a/marimo/_smoke_tests/anywidget_examples/esm_rerender.py+++ b/marimo/_smoke_tests/anywidget_examples/esm_rerender.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport anywidgetimport traitlets@@ -22,7 +22,7 @@ def __():@app.cell-def __(anywidget, traitlets):+def _(anywidget, traitlets):class CounterWidget(anywidget.AnyWidget):# Widget front-end JavaScript code_esm = """@@ -60,13 +60,13 @@ def __(anywidget, traitlets):@app.cell-def __(CounterWidget, mo):+def _(CounterWidget, mo):widget = mo.ui.anywidget(CounterWidget())return (widget,)@app.cell-def __(widget):+def _(widget):widgetreturndiff --git a/marimo/_smoke_tests/anywidget_examples/lonboard_example.py b/marimo/_smoke_tests/anywidget_examples/lonboard_example.pyindex 1fd5ebf480..349464f676 100644--- a/marimo/_smoke_tests/anywidget_examples/lonboard_example.py+++ b/marimo/_smoke_tests/anywidget_examples/lonboard_example.py@@ -14,7 +14,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/anywidget_smoke_tests/maplibre_example.py b/marimo/_smoke_tests/anywidget_smoke_tests/maplibre_example.pyindex 5b40a4a52e..4d2f120afe 100644--- a/marimo/_smoke_tests/anywidget_smoke_tests/maplibre_example.py+++ b/marimo/_smoke_tests/anywidget_smoke_tests/maplibre_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/anywidget_smoke_tests/mosaic_example.py b/marimo/_smoke_tests/anywidget_smoke_tests/mosaic_example.pyindex df3b470e61..c28b98cec5 100644--- a/marimo/_smoke_tests/anywidget_smoke_tests/mosaic_example.py+++ b/marimo/_smoke_tests/anywidget_smoke_tests/mosaic_example.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/anywidget_smoke_tests/multiple_models.py b/marimo/_smoke_tests/anywidget_smoke_tests/multiple_models.pyindex d8a2e27c33..fdd05ea374 100644--- a/marimo/_smoke_tests/anywidget_smoke_tests/multiple_models.py+++ b/marimo/_smoke_tests/anywidget_smoke_tests/multiple_models.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/app_fn.py b/marimo/_smoke_tests/app_fn.pyindex f1abcf07cc..c219fe9521 100644--- a/marimo/_smoke_tests/app_fn.py+++ b/marimo/_smoke_tests/app_fn.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.11.19"+__generated_with = "0.15.5"app = marimo.App()with app.setup:@@ -68,7 +66,6 @@ def bad_divide_curry(x):# Filler line# To push the errorreturn divide(0, x)- # With lines below@app.celldiff --git a/marimo/_smoke_tests/appcomp/double_nested/inner.py b/marimo/_smoke_tests/appcomp/double_nested/inner.pyindex ebb9efc009..be06dd1fa0 100644--- a/marimo/_smoke_tests/appcomp/double_nested/inner.py+++ b/marimo/_smoke_tests/appcomp/double_nested/inner.py@@ -2,48 +2,48 @@import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("# Innermost")return@app.cell-def __(mo):+def _(mo):x = mo.ui.number(1, 10)- return x,+ return (x,)@app.cell-def __(x):+def _(x):xreturn@app.cell-def __(mo):+def _(mo):y = mo.ui.number(1, 10)- return y,+ return (y,)@app.cell-def __(y):+def _(y):yreturn@app.cell-def __(x, y):+def _(x, y):x.value + y.valuereturndiff --git a/marimo/_smoke_tests/appcomp/double_nested/main.py b/marimo/_smoke_tests/appcomp/double_nested/main.pyindex accc41a714..d00161cf4e 100644--- a/marimo/_smoke_tests/appcomp/double_nested/main.py+++ b/marimo/_smoke_tests/appcomp/double_nested/main.py@@ -2,25 +2,25 @@import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from middle import app as middle- return middle,+ return (middle,)@app.cell-async def __(middle):+async def _(middle):result = await middle.embed()result.output- return result,+ return (result,)@app.cell-def __(result):+def _(result):result.defs["x_plus_y"]returndiff --git a/marimo/_smoke_tests/appcomp/double_nested/middle.py b/marimo/_smoke_tests/appcomp/double_nested/middle.pyindex ba58969ef1..9a32434ba5 100644--- a/marimo/_smoke_tests/appcomp/double_nested/middle.py+++ b/marimo/_smoke_tests/appcomp/double_nested/middle.py@@ -1,40 +1,41 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():from inner import app- return app,+ return (app,)@app.cell-def __(mo):+def _(mo):mo.md("# middle")return@app.cell-def __(mo, result):+def _(mo, result):x_plus_y = result.defs['x'].value + result.defs['y'].valuemo.md(f"The middle app has calculated `x_plus_y` ... try retrieving it")- return x_plus_y,+ return@app.cell-async def __(app):+async def _(app):result = await app.embed()result.output- return result,+ return (result,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/appcomp/imperative_output/imperative_output.py b/marimo/_smoke_tests/appcomp/imperative_output/imperative_output.pyindex 82f2608ee8..d2d318c5bf 100644--- a/marimo/_smoke_tests/appcomp/imperative_output/imperative_output.py+++ b/marimo/_smoke_tests/appcomp/imperative_output/imperative_output.py@@ -1,37 +1,38 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("# hello")return@app.cell-def __(mo, time):+def _(mo, time):for i in mo.status.progress_bar(range(5)):time.sleep(0.5)print(i)- return i,+ return@app.cell-def __(mo):+def _(mo):import timemo.output.replace(mo.md("# output"))time.sleep(0.5)mo.output.replace(mo.md("# replaced"))- return time,+ return (time,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/appcomp/imperative_output/main.py b/marimo/_smoke_tests/appcomp/imperative_output/main.pyindex c640d2b056..8fc0962e22 100644--- a/marimo/_smoke_tests/appcomp/imperative_output/main.py+++ b/marimo/_smoke_tests/appcomp/imperative_output/main.py@@ -1,24 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from imperative_output import app- return app,+ return (app,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return@app.cell-async def __(app):+async def _(app):(await app.embed()).outputreturndiff --git a/marimo/_smoke_tests/appcomp/inner.py b/marimo/_smoke_tests/appcomp/inner.pyindex ebb9efc009..be06dd1fa0 100644--- a/marimo/_smoke_tests/appcomp/inner.py+++ b/marimo/_smoke_tests/appcomp/inner.py@@ -2,48 +2,48 @@import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("# Innermost")return@app.cell-def __(mo):+def _(mo):x = mo.ui.number(1, 10)- return x,+ return (x,)@app.cell-def __(x):+def _(x):xreturn@app.cell-def __(mo):+def _(mo):y = mo.ui.number(1, 10)- return y,+ return (y,)@app.cell-def __(y):+def _(y):yreturn@app.cell-def __(x, y):+def _(x, y):x.value + y.valuereturndiff --git a/marimo/_smoke_tests/appcomp/main.py b/marimo/_smoke_tests/appcomp/main.pyindex a2d453a8a0..e06c58f0c1 100644--- a/marimo/_smoke_tests/appcomp/main.py+++ b/marimo/_smoke_tests/appcomp/main.py@@ -2,88 +2,88 @@import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from inner import app- return app,+ return (app,)@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("## Render the same app multiple times")return@app.cell-async def __(app):+async def _(app):result = await app.embed()result.output- return result,+ return (result,)@app.cell-def __(result):+def _(result):result.defs["x"].valuereturn@app.cell-def __(result):+def _(result):result.defs["y"].valuereturn@app.cell-def __(mo):+def _(mo):mo.md("## Render an app inside tabs")return@app.cell-async def __(app, mo):+async def _(app, mo):tabs = mo.ui.tabs({"🧮": (await app.embed()).output, "📝": mo.md("Hello world")})tabs- return tabs,+ return@app.cell-def __(mo):+def _(mo):mo.md(rf"## Render an app that uses function calls")return@app.cell-def __():+def _():from make_table import app as table_app- return table_app,+ return (table_app,)@app.cell-async def __(table_app):+async def _(table_app):table_app_results = await table_app.embed()- return table_app_results,+ return (table_app_results,)@app.cell-def __(table_app_results):+def _(table_app_results):table_app_results.outputreturn@app.cell-def __(table_app_results):+def _(table_app_results):table_app_results.defsreturn@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/appcomp/make_table.py b/marimo/_smoke_tests/appcomp/make_table.pyindex f580a08523..357bbdf6b4 100644--- a/marimo/_smoke_tests/appcomp/make_table.py+++ b/marimo/_smoke_tests/appcomp/make_table.py@@ -1,24 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.22"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):t = mo.ui.table({"a": [1, 2, 3], "b": [4, 5, 6]})- return t,+ return (t,)@app.cell-def __(t):+def _(t):treturndiff --git a/marimo/_smoke_tests/appcomp/state/main.py b/marimo/_smoke_tests/appcomp/state/main.pyindex 9ef9918599..1c15e98f82 100644--- a/marimo/_smoke_tests/appcomp/state/main.py+++ b/marimo/_smoke_tests/appcomp/state/main.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from state import app- return app,+ return (app,)@app.cell-async def __(app):+async def _(app):(await app.embed()).outputreturndiff --git a/marimo/_smoke_tests/appcomp/state/state.py b/marimo/_smoke_tests/appcomp/state/state.pyindex 15aa61c561..11b7f44667 100644--- a/marimo/_smoke_tests/appcomp/state/state.py+++ b/marimo/_smoke_tests/appcomp/state/state.py@@ -1,31 +1,32 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):get_state, set_state = mo.state(False)return get_state, set_state@app.cell-def __(mo, set_state):+def _(mo, set_state):b = mo.ui.button(on_change=lambda x: set_state(True))b- return b,+ return@app.cell-def __(get_state):+def _(get_state):"button was clicked" if get_state() else "button was not clicked"returndiff --git a/marimo/_smoke_tests/arrays_and_dicts.py b/marimo/_smoke_tests/arrays_and_dicts.pyindex 7e4019c6f6..c4da3e4611 100644--- a/marimo/_smoke_tests/arrays_and_dicts.py+++ b/marimo/_smoke_tests/arrays_and_dicts.py@@ -5,20 +5,21 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):items = mo.ui.array([mo.ui.text("name", "Name"),@@ -29,23 +30,23 @@ def __(mo):mo.ui.text("memo", "Memo"),])- return items,+ return (items,)@app.cell-def __(items):+def _(items):itemsreturn@app.cell-def __(items):+def _(items):items.hstack(gap=2)return@app.cell-def __(mo):+def _(mo):dictionary = mo.ui.dictionary({"name": mo.ui.text("name", "Name"),@@ -56,17 +57,17 @@ def __(mo):"memo": mo.ui.text("memo", "Memo"),})- return dictionary,+ return (dictionary,)@app.cell-def __(dictionary):+def _(dictionary):dictionaryreturn@app.cell-def __(dictionary):+def _(dictionary):dictionary.vstack()returndiff --git a/marimo/_smoke_tests/async/background_tasks.py b/marimo/_smoke_tests/async/background_tasks.pyindex 8f6238accf..39dec45f56 100644--- a/marimo/_smoke_tests/async/background_tasks.py+++ b/marimo/_smoke_tests/async/background_tasks.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/auto_instantiate_off.py b/marimo/_smoke_tests/auto_instantiate_off.pyindex 8d61211b06..29a048be25 100644--- a/marimo/_smoke_tests/auto_instantiate_off.py+++ b/marimo/_smoke_tests/auto_instantiate_off.py@@ -1,23 +1,23 @@import marimo-__generated_with = "0.9.34"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""If you run this first, then this should run and the `import marimo` cell should run, but nothing else""")return@app.cell-def __():+def _():# If you run this first, then this should run, but not `y = x + 1`x = 2x@@ -25,11 +25,11 @@ def __():@app.cell-def __(x):+def _(x):# If you run this first, then this should run and `x = 2`y = x + 2y- return (y,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/bokeh_figure.py b/marimo/_smoke_tests/bokeh_figure.pyindex a257abddcc..68bb3bed8b 100644--- a/marimo/_smoke_tests/bokeh_figure.py+++ b/marimo/_smoke_tests/bokeh_figure.py@@ -8,14 +8,14 @@import marimo-__generated_with = "0.11.4"+__generated_with = "0.15.5"app = marimo.App()@app.celldef _():import bokeh- return (bokeh,)+ return@app.cell@@ -23,7 +23,7 @@ def _():from bokeh.plotting import figure, show, output_notebook# NOOP in marimooutput_notebook()- return figure, output_notebook, show+ return figure, show@app.celldiff --git a/marimo/_smoke_tests/buttons.py b/marimo/_smoke_tests/buttons.pyindex df5babb6bd..33d27a7065 100644--- a/marimo/_smoke_tests/buttons.py+++ b/marimo/_smoke_tests/buttons.py@@ -5,28 +5,29 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.2"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):kinds = ["neutral", "success", "warn", "danger"]mo.vstack([mo.ui.button(label=kind, kind=kind) for kind in kinds])- return kinds,+ return (kinds,)@app.cell-def __(kinds, mo):+def _(kinds, mo):mo.vstack([mo.ui.button(label=kind, kind=kind, disabled=True) for kind in kinds])returndiff --git a/marimo/_smoke_tests/carousel.py b/marimo/_smoke_tests/carousel.pyindex 8d9d4d3bf3..fbf9353912 100644--- a/marimo/_smoke_tests/carousel.py+++ b/marimo/_smoke_tests/carousel.py@@ -7,14 +7,15 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.13"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport pandas as pdimport altair as alt@@ -22,32 +23,32 @@ def __():@app.cell-def __(pd):+def _(pd):df = pd.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv")- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):table = mo.ui.table(df, label="Iris Data in a table")- return table,+ return (table,)@app.cell-def __(alt, df, mo):+def _(alt, df, mo):chart = mo.ui.altair_chart(alt.Chart(df).mark_point().encode(x="sepal_length", y="sepal_width", color="species"),label="Iris Data in chart",)- return chart,+ return (chart,)@app.cell-def __(chart, mo, table):+def _(chart, mo, table):mo.carousel([mo.md("# A Presentation on Iris Data"),diff --git a/marimo/_smoke_tests/charts/1mil_flights.py b/marimo/_smoke_tests/charts/1mil_flights.pyindex 52ff8436f8..7d39fc7c76 100644--- a/marimo/_smoke_tests/charts/1mil_flights.py+++ b/marimo/_smoke_tests/charts/1mil_flights.py@@ -8,61 +8,62 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.39"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(pd):+def _(pd):# Load some large dataall_flights = pd.read_parquet("https://vegafusion-datasets.s3.amazonaws.com/vega/flights_1m.parquet")- return all_flights,+ return (all_flights,)@app.cell-def __(mo):+def _(mo):size = mo.ui.dropdown(label="Size",options=["100", "1000", "10000", "100000", "1000000"],value="100000",)size- return size,+ return (size,)@app.cell-def __(alt, flights, mo):+def _(alt, flights, mo):scatter = mo.ui.altair_chart(alt.Chart(flights).mark_point().encode(x="delay:Q", y="distance:Q"))scatter- return scatter,+ return (scatter,)@app.cell-def __(scatter):+def _(scatter):scatter.value.head()return@app.cell-def __(all_flights, size):+def _(all_flights, size):flights = all_flights.sample(int(size.value))- return flights,+ return (flights,)@app.cell-def __(flights):+def _(flights):f"{len(flights):,} flights"return@app.cell-def __(alt, mo, pd):+def _(alt, mo, pd):# List available data transformersmo.ui.altair_chart(alt.Chart(pd.DataFrame({"a": [1]})).mark_point())mo.accordion(@@ -80,16 +81,16 @@ def __(alt, mo, pd):@app.cell-def __(alt, flights, mo):+def _(alt, flights, mo):flight_histogram = mo.ui.altair_chart(alt.Chart(flights).mark_bar().encode(alt.X("delay"), alt.Y("count()")))flight_histogram- return flight_histogram,+ return (flight_histogram,)@app.cell-def __(flight_histogram, mo):+def _(flight_histogram, mo):mo.stop(len(flight_histogram.value) == 0, None)mo.md(f"Selected **{len(flight_histogram.value):,}** flights")@@ -97,7 +98,7 @@ def __(flight_histogram, mo):@app.cell-def __(alt, flight_histogram, mo):+def _(alt, flight_histogram, mo):mo.stop(len(flight_histogram.value) == 0, None)origin_chart = mo.ui.altair_chart(@@ -111,11 +112,11 @@ def __(alt, flight_histogram, mo):.encode(alt.X("destination:O"), alt.Y("count()")))mo.hstack([origin_chart, destination_chart])- return destination_chart, origin_chart+ return@app.cell-def __(airports, alt, data, flight_histogram, mo):+def _(airports, alt, data, flight_histogram, mo):flights_airport = flight_histogram.value# flights_airport = data.flights_airport.url@@ -177,19 +178,11 @@ def __(airports, alt, data, flight_histogram, mo):mo.ui.altair_chart((background + connections + points).configure_view(stroke=None))- return (- background,- connections,- flights_airport,- lookup_data,- points,- select_city,- states,- )+ return@app.cell-def __(flight_histogram, mo):+def _(flight_histogram, mo):mo.stop(len(flight_histogram.value) == 0, None)mo.hstack(@@ -205,7 +198,7 @@ def __(flight_histogram, mo):@app.cell(disabled=True)-def __(alt, brush, flights, mo):+def _(alt, brush, flights, mo):# Run the same chart with vegafusionwith alt.data_transformers.enable("vegafusion"):million_histogram = (@@ -215,11 +208,11 @@ def __(alt, brush, flights, mo):.add_params(brush))mo.output.append(mo.ui.altair_chart(million_histogram))- return million_histogram,+ return@app.cell-def __():+def _():import altair as altimport pandas as pdfrom vega_datasets import datadiff --git a/marimo/_smoke_tests/charts/histograms.py b/marimo/_smoke_tests/charts/histograms.pyindex 3e01922b6f..3885d5a3c8 100644--- a/marimo/_smoke_tests/charts/histograms.py+++ b/marimo/_smoke_tests/charts/histograms.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="full")@@ -34,7 +34,7 @@ def _(alt, charts, mo):)_charts.append(chart)mo.hstack(_charts)- return chart, data+ return@app.cell@@ -46,14 +46,14 @@ def _(df, pl):charts[col] = hist_datacharts.keys()- return charts, col, hist_data+ return (charts,)@app.celldef _(df):res = df["Weight"].hist().to_dicts()res[0]- return (res,)+ return@app.celldiff --git a/marimo/_smoke_tests/chat/chatbot.py b/marimo/_smoke_tests/chat/chatbot.pyindex 4d1a9bdfc2..dbb9f95010 100644--- a/marimo/_smoke_tests/chat/chatbot.py+++ b/marimo/_smoke_tests/chat/chatbot.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.11.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -103,7 +103,7 @@ def _(mo):os_key = os.environ.get("OPENAI_API_KEY")input_key = mo.ui.text(label="OpenAI API key", kind="password")input_key if not os_key else None- return input_key, os, os_key+ return input_key, os_key@app.cell@@ -125,7 +125,7 @@ def _(mo, openai_key):# Create an openai clientclient = openai.Client(api_key=openai_key)- return client, ell, openai+ return client, ell@app.cell(hide_code=True)@@ -159,7 +159,7 @@ def _():from vega_datasets import datacars = data.cars()- return cars, data+ return (cars,)@app.cell@@ -227,13 +227,7 @@ def _(cars, client, ell):del as_dict["datasets"]return alt.Chart.from_dict(as_dict)return response- return (- BaseModel,- Field,- PromptsResponse,- get_sample_prompts,- my_complex_model,- )+ return get_sample_prompts, my_complex_model@app.cell@@ -243,7 +237,7 @@ def _(cars, get_sample_prompts, mo, my_complex_model):my_complex_model,prompts=prompts,)- return (prompts,)+ return@app.celldiff --git a/marimo/_smoke_tests/cli_args.py b/marimo/_smoke_tests/cli_args.pyindex d3790cd620..2c03edeacb 100644--- a/marimo/_smoke_tests/cli_args.py+++ b/marimo/_smoke_tests/cli_args.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""Re-run this with notebook with the following command line:@@ -33,7 +33,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.cli_args().to_dict()returndiff --git a/marimo/_smoke_tests/code_editor.py b/marimo/_smoke_tests/code_editor.pyindex 392142e275..9aaabc4bb0 100644--- a/marimo/_smoke_tests/code_editor.py+++ b/marimo/_smoke_tests/code_editor.py@@ -5,26 +5,27 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.76"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.ui.code_editor("print(2 + 2)", min_height=50)return@app.cell-def __(mo):+def _(mo):mo.ui.code_editor("SELECT * FROM table;", language="sql", theme="light")return@app.cell(hide_code=True)-def __(languages, mo):+def _(languages, mo):language_select = mo.ui.dropdown(languages,value="javascript",@@ -37,7 +38,7 @@ def __(languages, mo):@app.cell-def __(language_select, mo, samples, theme_select):+def _(language_select, mo, samples, theme_select):mo.ui.code_editor(samples[language_select.value],language=language_select.value,@@ -47,7 +48,7 @@ def __(language_select, mo, samples, theme_select):@app.cell-def __():+def _():languages = ["sql", "python", "javascript", "ruby", "c", "java", "go"]samples = {"sql": "SELECT * FROM table;",@@ -64,9 +65,9 @@ def __():@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/compat/ipython_display.py b/marimo/_smoke_tests/compat/ipython_display.pyindex 5c1a222c27..4105982f8c 100644--- a/marimo/_smoke_tests/compat/ipython_display.py+++ b/marimo/_smoke_tests/compat/ipython_display.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.11.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -56,7 +56,7 @@ def _():def _(HTML):html = HTML("<h1>Hello World</h1><p style='color: blue;'>This is HTML</p>")html- return (html,)+ return@app.cell@@ -64,7 +64,7 @@ def _(Image):# Using a sample image URLimage = Image(url="https://marimo.io/logo.png", width=100)image- return (image,)+ return@app.cell@@ -77,7 +77,7 @@ def _(JSON):})json_data- return (json_data,)+ return@app.cell@@ -85,14 +85,14 @@ def _(Javascript):# Not yet supportedjs = Javascript("alert('Hello from JavaScript!');")js- return (js,)+ return@app.celldef _(Latex):latex = Latex(r"\begin{align}f(x) &= x^2\\g(x) &= \frac{1}{x}\end{align}")latex- return (latex,)+ return@app.cell@@ -101,7 +101,7 @@ def _(Math):r"\frac{1}{\pi} = \frac{2\sqrt{2}}{9801} \sum_{k=0}^\infty \frac{(4k)!(1103+26390k)}{(k!)^4 396^{4k}}")math- return (math,)+ return@app.cell@@ -109,7 +109,7 @@ def _(Pretty):_data = '{"complex": [1, 2, {"nested": "structure"}]}'pretty = Pretty(_data)pretty- return (pretty,)+ return@app.cell@@ -118,7 +118,7 @@ def _(SVG):'<svg height="100" width="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>')svg- return (svg,)+ return@app.cell@@ -131,7 +131,7 @@ def _(Audio):data = np.sin(2 * np.pi * 440 * t) # 440 Hz sine waveaudio = Audio(data=data, rate=sample_rate)audio- return audio, data, np, sample_rate, t+ return@app.cell@@ -139,7 +139,7 @@ def _(Video):# Using a sample video URLvideo = Video("https://www.w3schools.com/html/mov_bbb.mp4")video- return (video,)+ return@app.cell@@ -147,7 +147,7 @@ def _(YouTubeVideo):# Example YouTube videoyt = YouTubeVideo("dQw4w9WgXcQ")yt- return (yt,)+ return@app.cell@@ -158,14 +158,14 @@ def _(Code):language="python",)code- return (code,)+ return@app.celldef _(IFrame):iframe = IFrame("https://marimo.io", width=800, height=450)iframe- return (iframe,)+ return@app.cell@@ -182,7 +182,7 @@ def _(Markdown):""")markdown- return (markdown,)+ return@app.cell(hide_code=True)@@ -227,13 +227,7 @@ def _():@app.cell-def _(- display_html,- display_jpeg,- display_png,- display_pretty,- display_svg,-):+def _(display_html, display_jpeg, display_png, display_pretty, display_svg):# Workingdisplay_pretty("hello", raw=True)display_html("<h1 style='color: blue'>Hello World</h1>", raw=True)diff --git a/marimo/_smoke_tests/data_explorer.py b/marimo/_smoke_tests/data_explorer.pyindex 4008592580..c296a50372 100644--- a/marimo/_smoke_tests/data_explorer.py+++ b/marimo/_smoke_tests/data_explorer.py@@ -9,42 +9,42 @@import marimo-__generated_with = "0.2.2"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import datareturn data, mo@app.cell-def __(data, mo):+def _(data, mo):options = data.list_datasets()dataset_dropdown = mo.ui.dropdown(options, label="Datasets", value="cars")dataset_dropdown- return dataset_dropdown, options+ return (dataset_dropdown,)@app.cell-def __(data, dataset_dropdown, mo):+def _(data, dataset_dropdown, mo):mo.stop(not dataset_dropdown.value)selected_dataset = dataset_dropdown.valuedf = data.__call__(selected_dataset)- return df, selected_dataset+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):v = mo.ui.data_explorer(df)v- return v,+ return (v,)@app.cell-def __(v):+def _(v):v.valuereturndiff --git a/marimo/_smoke_tests/dataframe.py b/marimo/_smoke_tests/dataframe.pyindex 9801a22693..c915145e9d 100644--- a/marimo/_smoke_tests/dataframe.py+++ b/marimo/_smoke_tests/dataframe.py@@ -14,7 +14,7 @@import marimo-__generated_with = "0.11.5"+__generated_with = "0.15.5"app = marimo.App(width="full")@@ -255,7 +255,7 @@ def _():"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv")dask_df- return dask_df, dd, requests+ return@app.cell@@ -269,7 +269,7 @@ def _():table_name="penguins",)ibis_data- return ibis, ibis_data+ return (ibis_data,)@app.cell@@ -319,11 +319,11 @@ def _():import altair as altcars = vega_datasets.data.cars()- return alt, cars, mo, pa, pd, pl, vega_datasets+ return cars, mo, pa, pl@app.cell-def _(cars, mo):+def _(mo):_df = mo.sql(f"""SELECT * FROM cars WHERE Cylinders > 6;diff --git a/marimo/_smoke_tests/dataframes/dicts_vs_dfs.py b/marimo/_smoke_tests/dataframes/dicts_vs_dfs.pyindex 055e71c550..3c898792b8 100644--- a/marimo/_smoke_tests/dataframes/dicts_vs_dfs.py+++ b/marimo/_smoke_tests/dataframes/dicts_vs_dfs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/datasources.py b/marimo/_smoke_tests/datasources.pyindex 5b809b7d99..9e8ffcce11 100644--- a/marimo/_smoke_tests/datasources.py+++ b/marimo/_smoke_tests/datasources.py@@ -11,12 +11,12 @@import marimo-__generated_with = "0.8.13"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import dataimport pandas as pd@@ -24,68 +24,68 @@ def __():@app.cell-def __(pd):+def _(pd):editable_table = pd.DataFrame({"a": [2, 2, 12], "b": [2, 5, 6]})- return editable_table,+ return@app.cell-def __(pd):+def _(pd):df_with_list = pd.DataFrame([{"a": [1, 2, 3]}])- return df_with_list,+ return@app.cell-def __(data, mo):+def _(data, mo):options = data.list_datasets()dropdown = mo.ui.dropdown(options)dropdown- return dropdown, options+ return (dropdown,)@app.cell-def __(data, dropdown, mo):+def _(data, dropdown, mo):mo.stop(not dropdown.value)df = data.__call__(dropdown.value)- return df,+ return (df,)@app.cell-def __(df):+def _(df):import polars as plpolars_df = pl.DataFrame(df)- return pl, polars_df+ return (polars_df,)@app.cell-def __(df):+def _(df):import pyarrow as papyarrow_df = pa.Table.from_pandas(df)- return pa, pyarrow_df+ return (pyarrow_df,)@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.table(polars_df)return@app.cell-def __(mo, pyarrow_df):+def _(mo, pyarrow_df):mo.ui.table(pyarrow_df)return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df)return@app.cell-def __(mo, polars_df):+def _(mo):_df = mo.sql(f"""SELECT * FROM polars_df@@ -95,23 +95,23 @@ def __(mo, polars_df):@app.cell-def __(mo):+def _(mo):mo.ui.table({"a": [2, 2, 12], "b": [2, 5, 6]})return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.plain(polars_df)return@app.cell-def __(pd):+def _(pd):date_range = pd.date_range(start="2023-01-01", periods=10, freq="D")date_indexed_df = pd.DataFrame({"Data": range(10)}, index=date_range)date_indexed_df- return date_indexed_df, date_range+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/dates.py b/marimo/_smoke_tests/dates.pyindex caa67ffa6a..0bedfd958b 100644--- a/marimo/_smoke_tests/dates.py+++ b/marimo/_smoke_tests/dates.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):import datetimestart_date = mo.ui.date(@@ -35,7 +35,7 @@ def __(mo):@app.cell-def __(end_date, mo, start_date):+def _(end_date, mo, start_date):mo.hstack([mo.hstack([start_date, "➡️", end_date]).left(),@@ -46,7 +46,7 @@ def __(end_date, mo, start_date):@app.cell-def __(datetime, mo):+def _(datetime, mo):start_datetime = mo.ui.datetime(label="Start datetime",start=datetime.datetime(2021, 1, 1),@@ -61,7 +61,7 @@ def __(datetime, mo):@app.cell-def __(end_datetime, mo, start_datetime):+def _(end_datetime, mo, start_datetime):mo.hstack([mo.hstack([start_datetime, "➡️", end_datetime]).left(),@@ -72,23 +72,23 @@ def __(end_datetime, mo, start_datetime):@app.cell-def __(datetime, mo):+def _(datetime, mo):date_range_input = mo.ui.date_range(label="Date_range",start=datetime.date(2021, 1, 1),stop=datetime.date(2021, 12, 31),)- return date_range_input,+ return (date_range_input,)@app.cell-def __(date_range_input, mo):+def _(date_range_input, mo):mo.hstack([date_range_input, date_range_input.value])return@app.cell-def __(mo):+def _(mo):_date = mo.ui.date(label="Input")_datetime = mo.ui.datetime(label="Input")_date_range = mo.ui.date_range(label="Input")diff --git a/marimo/_smoke_tests/debounce.py b/marimo/_smoke_tests/debounce.pyindex b0a51926b5..fe96e61bb9 100644--- a/marimo/_smoke_tests/debounce.py+++ b/marimo/_smoke_tests/debounce.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(1, 10, label="Slider")debounced_slider = mo.ui.slider(1, 10, debounce=True, label="Debounced Slider")@@ -22,7 +23,7 @@ def __(mo):@app.cell-def __(debounced_number, debounced_slider, mo, number, slider):+def _(debounced_number, debounced_slider, mo, number, slider):mo.md(f"""Controls:@@ -38,7 +39,7 @@ def __(debounced_number, debounced_slider, mo, number, slider):@app.cell-def __(debounced_number, debounced_slider, mo, number, slider):+def _(debounced_number, debounced_slider, mo, number, slider):# Valuesmo.md(f"""slider: {slider.value}@@ -53,7 +54,7 @@ def __(debounced_number, debounced_slider, mo, number, slider):@app.cell-def __(debounced_number, debounced_slider, mo, number, slider):+def _(debounced_number, debounced_slider, mo, number, slider):mo.md(f"""Controls and Values:diff --git a/marimo/_smoke_tests/debounce_input.py b/marimo/_smoke_tests/debounce_input.pyindex 08aec6b017..c2c2135c70 100644--- a/marimo/_smoke_tests/debounce_input.py+++ b/marimo/_smoke_tests/debounce_input.py@@ -1,71 +1,71 @@import marimo-__generated_with = "0.8.15"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md(r"""[Debounce mo.ui.text and mo.ui.text_area #2218](https://github.com/marimo-team/marimo/issues/2218)""")return@app.cell-def __(debounce, debounce_options, mo):+def _(debounce, debounce_options, mo):name_input = mo.ui.text(label="Enter your name for the greeting of a lifetime:", debounce=debounce)mo.vstack([debounce_options, name_input, name_input])- return name_input,+ return (name_input,)@app.cell-def __(name_input):+def _(name_input):if len(name_input.value) > 0:print(f"Hello {name_input.value}!")return@app.cell-def __(debounce, debounce_options, mo):+def _(debounce, debounce_options, mo):story_input = mo.ui.text_area(label="Now tell me a story from your childhood:", debounce=debounce)mo.vstack([debounce_options, mo.hstack([story_input, story_input])])- return story_input,+ return (story_input,)@app.cell-def __(story_input):+def _(story_input):if (len(story_input.value) > 0):print(story_input.value)return@app.cell-def __(mo):+def _(mo):debounce_options = mo.ui.dropdown(label="Choose debounce option",options=["True", "500", "1000", "False"],value="True",)- return debounce_options,+ return (debounce_options,)@app.cell-def __(debounce_options):+def _(debounce_options):debounce = debounce_options.valuedebounce = (int(debounce) if debounce != "True" and debounce != "False" else debounce)debounce = debounce == "True" if isinstance(debounce, str) else debounce- return debounce,+ return (debounce,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/df_index.py b/marimo/_smoke_tests/df_index.pyindex 715ba91c0c..dc62a0f57b 100644--- a/marimo/_smoke_tests/df_index.py+++ b/marimo/_smoke_tests/df_index.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.14.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/docs/docstrings.py b/marimo/_smoke_tests/docs/docstrings.pyindex 85c5e2edfb..26a0d7f80f 100644--- a/marimo/_smoke_tests/docs/docstrings.py+++ b/marimo/_smoke_tests/docs/docstrings.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.10.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -41,7 +41,7 @@ def _(mo):}element = mo.ui.dropdown(elements, value="button")element- return element, elements+ return (element,)@app.cell(hide_code=True)diff --git a/marimo/_smoke_tests/doctests.py b/marimo/_smoke_tests/doctests.pyindex 2449dbd084..3995e31784 100644--- a/marimo/_smoke_tests/doctests.py+++ b/marimo/_smoke_tests/doctests.py@@ -1,60 +1,56 @@import marimo-__generated_with = "0.8.17"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)+++def euclid_mcd(a: int, b: int) -> int:+ """Return the MCD between positive a, b.++ >>> euclid_mcd(42, 24)+ 6+ >>> euclid_mcd(24, 42)+ 6+ >>> euclid_mcd(42, 42)+ 42+ """+ assert a > 0+ assert b > 0+ if a < b:+ a, b = b, a+ if (a != b):+ r = a - b+ return euclid_mcd(b, r)+ return a@app.cell-def __():- def euclid_mcd(a: int, b: int) -> int:- """Return the MCD between positive a, b.-- >>> euclid_mcd(42, 24)- 6- >>> euclid_mcd(24, 42)- 6- >>> euclid_mcd(42, 42)- 42- """- assert a > 0- assert b > 0- if a < b:- a, b = b, a- if (a != b):- r = a - b- return euclid_mcd(b, r)- return a- return euclid_mcd,---def __(euclid_mcd):+def _():euclid_mcd(42, 42)return-def __():- def bad_multiply_by_2(a: int) -> int:- """Multiply a by 2 and return the result.+def bad_multiply_by_2(a: int) -> int:+ """Multiply a by 2 and return the result.- >>> bad_multiply_by_2(2)- 4- >>> bad_multiply_by_2(3)- 6- """- return a + 2- return bad_multiply_by_2,+ >>> bad_multiply_by_2(2)+ 4+ >>> bad_multiply_by_2(3)+ 6+ """+ return a + 2@app.cell-def __(bad_multiply_by_2, euclid_mcd, mo):+def _(mo):# Including these make this doctest reactiveeuclid_mcdbad_multiply_by_2@@ -62,7 +58,7 @@ def __(bad_multiply_by_2, euclid_mcd, mo):import doctestfailures, success = doctest.testmod(verbose=True)mo.md(f"Success: {success}, Failures: {failures}")- return doctest, failures, success+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/dropdowns.py b/marimo/_smoke_tests/dropdowns.pyindex 70d3bf6b61..f072b01e7a 100644--- a/marimo/_smoke_tests/dropdowns.py+++ b/marimo/_smoke_tests/dropdowns.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.23"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/editable_df.py b/marimo/_smoke_tests/editable_df.pyindex 05ab3ee5db..55437532f6 100644--- a/marimo/_smoke_tests/editable_df.py+++ b/marimo/_smoke_tests/editable_df.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import polars as plimport pandas as pdimport marimo as mo@@ -23,7 +23,7 @@ def __():@app.cell-def __(params, pd, pl):+def _(params, pd, pl):row_oriented = [dict(Model=i, **{param: 0 for param in params}) for i in range(1, 5)]@@ -34,13 +34,13 @@ def __(params, pd, pl):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Editing different inputs (dicts, lists, polars, pandas)""")return@app.cell(hide_code=True)-def __(column_oriented, mo, pandas_df, polars_df, row_oriented):+def _(column_oriented, mo, pandas_df, polars_df, row_oriented):df = mo.ui.dropdown({"polars": polars_df,@@ -56,14 +56,14 @@ def __(column_oriented, mo, pandas_df, polars_df, row_oriented):@app.cell-def __(df, mo):+def _(df, mo):edited = mo.ui.data_editor(df.value)editedreturn (edited,)@app.cell-def __(edited, flatten_edits, mo):+def _(edited, mo):mo.vstack([mo.ui.table(edited.value, selection=None),@@ -73,24 +73,22 @@ def __(edited, flatten_edits, mo):return-def __():- def flatten_edits(edits):- return [- f"{edit['rowIdx']}.{edit['columnId']} -> {edit['value']}"- for edit in edits- ]- return (flatten_edits,)+def flatten_edits(edits):+ return [+ f"{edit['rowIdx']}.{edit['columnId']} -> {edit['value']}"+ for edit in edits+ ]@app.cell-def __(mo):+def _(mo):mo.md(r"""## Editing different data types""")return@app.cell-def __(pd):+def _(pd):import datetimelarge_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."@@ -106,24 +104,24 @@ def __(pd):"none": [None for _ in range(4)],"lists": [[1, 2], [3, 4], [5, 6], [7, 8]],}- return datetime, large_text, varying_data+ return (varying_data,)@app.cell-def __(pl, varying_data):+def _(pl, varying_data):pl.DataFrame(varying_data).schemareturn@app.cell-def __(mo, pl, varying_data):+def _(mo, pl, varying_data):edited_df = mo.ui.data_editor(pl.DataFrame(varying_data))edited_dfreturn (edited_df,)@app.cell-def __(edited_df):+def _(edited_df):edited_df.valuereturndiff --git a/marimo/_smoke_tests/errors.py b/marimo/_smoke_tests/errors.pyindex 0a165e5502..c65a5df6e4 100644--- a/marimo/_smoke_tests/errors.py+++ b/marimo/_smoke_tests/errors.py@@ -1,51 +1,54 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(y):+def _(y):x = y- return x,+ return (x,)@app.cell-def __(z):+def _(z):y = z- return y,+ return (y,)@app.cell-def __(x):+def _(x):z = xc = 0- return c, z+ return (z,)@app.cell-def __(b):+def _(b):a = 0del bc = 0- return a, c+ returnapp._unparsable_cell(r"""- a =++ a =+""",- name="__"+ name="_")@app.cell-def __():+def _():a = 1b = 0c = 0- return a, b, c+ return (b,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/errors/autofix.py b/marimo/_smoke_tests/errors/autofix.pyindex 9a8e813422..8f485316a1 100644--- a/marimo/_smoke_tests/errors/autofix.py+++ b/marimo/_smoke_tests/errors/autofix.py@@ -1,26 +1,26 @@import marimo-__generated_with = "0.10.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():x = 1- return (x,)+ return@app.celldef _():x = 2x- return (x,)+ return@app.celldef _():x = 3- return (x,)+ return@app.celldiff --git a/marimo/_smoke_tests/files/cloudpath_file_browser.py b/marimo/_smoke_tests/files/cloudpath_file_browser.pyindex 0c1c76f076..cadb31f136 100644--- a/marimo/_smoke_tests/files/cloudpath_file_browser.py+++ b/marimo/_smoke_tests/files/cloudpath_file_browser.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -14,7 +14,7 @@ def _():def _(mo):file_browser = mo.ui.file_browser()file_browser- return (file_browser,)+ return@app.cell@@ -32,7 +32,7 @@ def _(BUCKET):# dispatches to S3Path based on prefixroot_dir = CloudPath(BUCKET)root_dir- return CloudPath, root_dir+ return (root_dir,)@app.celldiff --git a/marimo/_smoke_tests/forms.py b/marimo/_smoke_tests/forms.pyindex b25d571d68..0c7a14354a 100644--- a/marimo/_smoke_tests/forms.py+++ b/marimo/_smoke_tests/forms.py@@ -1,26 +1,26 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.79"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport random-return mo, random@app.cell-def __(mo):+def _(mo):mo.md("# Basic form")return@app.cell-def __(mo):+def _(mo):clear_on_submit_input = mo.ui.checkbox(True, label="Clear on submit")bordered_input = mo.ui.checkbox(False, label="Bordered")show_clear_button_input = mo.ui.checkbox(False, label="Show clear button")@@ -29,7 +29,7 @@ def __(mo):@app.cell-def __(bordered_input, clear_on_submit_input, mo, show_clear_button_input):+def _(bordered_input, clear_on_submit_input, mo, show_clear_button_input):form_1 = mo.ui.text_area(label="Form label", full_width=True, placeholder="Type...").form(@@ -44,7 +44,7 @@ def __(bordered_input, clear_on_submit_input, mo, show_clear_button_input):@app.cell-def __(form_1, mo, random):+def _(form_1, mo, random):random_number = random.randint(1, 100)mo.vstack([@@ -55,11 +55,11 @@ def __(form_1, mo, random):form_1.value,])- return (random_number,)+ return@app.cell-def __(mo):+def _(mo):mo.md("""-------@@ -70,7 +70,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):years_experience = mo.ui.slider(1, 10, value=3)fn = mo.ui.text()ln = mo.ui.text()@@ -106,11 +106,11 @@ def __(mo):)form_2- return fn, form_2, ln, validate, years_experience+ return (form_2,)@app.cell-def __(form_2, mo, random):+def _(form_2, mo, random):_random_number = random.randint(1, 100)mo.vstack([@@ -123,7 +123,7 @@ def __(form_2, mo, random):@app.cell-def __(mo):+def _(mo):mo.md("""------@@ -133,7 +133,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):dict = mo.ui.dictionary({"slider": mo.ui.slider(1, 10),@@ -152,7 +152,7 @@ def __(mo):@app.cell-def __(dict, mo):+def _(dict, mo):mo.vstack([mo.md("## Dictionary Value"),diff --git a/marimo/_smoke_tests/from_series.py b/marimo/_smoke_tests/from_series.pyindex ee601f84d7..6cb46a86d8 100644--- a/marimo/_smoke_tests/from_series.py+++ b/marimo/_smoke_tests/from_series.py@@ -6,64 +6,65 @@# "polars",# ]# ///+import marimo-__generated_with = "0.6.23"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import datareturn data, mo@app.cell-def __(data):+def _(data):import polars as plpolars_df = pl.from_pandas(data.cars())- return pl, polars_df+ return (polars_df,)@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.slider.from_series(polars_df["Cylinders"])return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.number.from_series(polars_df["Cylinders"])return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.radio.from_series(polars_df["Origin"])return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.dropdown.from_series(polars_df["Origin"])return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.multiselect.from_series(polars_df["Origin"])return@app.cell-def __(mo, polars_df):+def _(mo, polars_df):mo.ui.date.from_series(polars_df["Year"])return@app.cell-def __(data, mo):+def _(data, mo):pandas_df = data.cars()[mo.ui.slider.from_series(pandas_df["Cylinders"]),@@ -73,11 +74,11 @@ def __(data, mo):mo.ui.multiselect.from_series(pandas_df["Origin"]),mo.ui.date.from_series(pandas_df["Year"])]- return pandas_df,+ return@app.cell-def __():+def _():returndiff --git a/marimo/_smoke_tests/full_width.py b/marimo/_smoke_tests/full_width.pyindex 4c891be1a4..b070fdd459 100644--- a/marimo/_smoke_tests/full_width.py+++ b/marimo/_smoke_tests/full_width.py@@ -5,69 +5,70 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.22"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):checkbox = mo.ui.checkbox(label="Full width")checkbox.callout()- return checkbox,+ return (checkbox,)@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.text(label="Text", full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.text_area(label="Text area", full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.number(0, 10, label="Number", full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.dropdown(label="Dropdown", options=["A", "B", "C"], full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.multiselect(label="Multiselect", options=["A", "B", "C"], full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.date(label="Date", full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.ui.button(label="Button", full_width=checkbox.value)return@app.cell-def __(checkbox, mo):+def _(checkbox, mo):# Is this the behavior we want?mo.hstack([mo.ui.text(label="Input A", full_width=checkbox.value),@@ -77,7 +78,7 @@ def __(checkbox, mo):@app.cell-def __(checkbox, mo):+def _(checkbox, mo):mo.vstack([mo.ui.text(label="Input A", full_width=checkbox.value),mo.ui.text(label="Input B", full_width=checkbox.value)diff --git a/marimo/_smoke_tests/grid.py b/marimo/_smoke_tests/grid.pyindex cefbefd712..9f48a5eac6 100644--- a/marimo/_smoke_tests/grid.py+++ b/marimo/_smoke_tests/grid.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(layout_file="layouts/grid.grid.json")@app.cell-def __(mo):+def _(mo):align = mo.ui.dropdown(label="Align", options=["start", "end", "center", "stretch"])@@ -24,13 +24,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Horizontal Stack: `hstack`""")return@app.cell-def __(align, boxes, gap, justify, mo, wrap):+def _(align, boxes, gap, justify, mo, wrap):mo.hstack(boxes,align=align.value,@@ -42,13 +42,13 @@ def __(align, boxes, gap, justify, mo, wrap):@app.cell-def __(mo):+def _(mo):mo.md("""# Vertical Stack: `vstack`""")return@app.cell-def __(align, boxes, gap, mo):+def _(align, boxes, gap, mo):mo.vstack(boxes,align=align.value,@@ -58,7 +58,7 @@ def __(align, boxes, gap, mo):@app.cell-def __(mo, size):+def _(mo, size):def create_box(num):box_size = size.value + num * 10return mo.Html(@@ -67,13 +67,13 @@ def __(mo, size):boxes = [create_box(i) for i in range(1, 5)]- return boxes, create_box+ return (boxes,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/ibis_example.py b/marimo/_smoke_tests/ibis_example.pyindex 872ef3e3de..70d65bec30 100644--- a/marimo/_smoke_tests/ibis_example.py+++ b/marimo/_smoke_tests/ibis_example.py@@ -7,36 +7,36 @@import marimo-__generated_with = "0.8.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport ibisreturn ibis, mo@app.cell-def __(ibis):+def _(ibis):df = ibis.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv",table_name="penguins",)df- return df,+ return (df,)@app.cell-def __(df):+def _(df):# Print Ibis data in a pretty tabledf.to_polars()return@app.cell-def __(df):+def _(df):# Transform using the python API_res = df.group_by("species", "island").agg(count=df.count()).order_by("count")df.to_polars()@@ -44,7 +44,7 @@ def __(df):@app.cell-def __(df):+def _(df):# Transform using SQL_res = df.sql("SELECT species, island, count(*) AS count FROM penguins GROUP BY 1, 2"@@ -54,14 +54,14 @@ def __(df):@app.cell-def __(df, mo):+def _(df, mo):# Transform using the ui.dataframe GUImo.ui.dataframe(df)return@app.cell-def __(ibis):+def _(ibis):# Unnestibis.memtable({@@ -73,7 +73,7 @@ def __(ibis):@app.cell-def __(ibis):+def _(ibis):# Unpackibis.memtable({"A": [{"foo": 1, "bar": "hello"}], "B": [1]}).unpack("A"diff --git a/marimo/_smoke_tests/ibis_formatting.py b/marimo/_smoke_tests/ibis_formatting.pyindex 99ac53008e..7dd42332c6 100644--- a/marimo/_smoke_tests/ibis_formatting.py+++ b/marimo/_smoke_tests/ibis_formatting.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.14.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/icons.py b/marimo/_smoke_tests/icons.pyindex 9e32a25e72..eaae19777d 100644--- a/marimo/_smoke_tests/icons.py+++ b/marimo/_smoke_tests/icons.py@@ -8,24 +8,24 @@import marimo-__generated_with = "0.9.7"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""::lucide:alarm-clock::""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.hstack([mo.md("Color"),@@ -41,7 +41,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.hstack([mo.md("Flip"),@@ -56,7 +56,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.hstack([mo.md("Rotate"),@@ -71,7 +71,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.hstack([mo.md("In buttons"),@@ -91,7 +91,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(f"""## {mo.icon('material-symbols:edit')} Icons in markdown@@ -101,7 +101,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.tabs({f"{mo.icon('material-symbols:group')} Overview": mo.md("Tab 1"),diff --git a/marimo/_smoke_tests/import_named_cells.py b/marimo/_smoke_tests/import_named_cells.pyindex abb5cf7980..d88202ffca 100644--- a/marimo/_smoke_tests/import_named_cells.py+++ b/marimo/_smoke_tests/import_named_cells.py@@ -2,69 +2,69 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():from named_cells import display_slider, display_elementreturn display_element, display_slider@app.cell-def __(mo):+def _(mo):mo.md("""**A cell that creates and shows a slider**""")return@app.cell-def __(display_slider):+def _(display_slider):slider_output, slider_defs = display_slider.run()slider_output- return slider_defs, slider_output+ return (slider_defs,)@app.cell-def __(mo):+def _(mo):mo.md("""_Notice that set-ui-element value requests make it into the defs_""")return@app.cell-def __(slider_defs):+def _(slider_defs):slider_defsreturn@app.cell-def __(slider_defs):+def _(slider_defs):slider_defs["slider"].valuereturn@app.cell-def __(mo):+def _(mo):mo.md("""**A cell that shows a parametrizable UI element**""")return@app.cell-def __(display_element, mo):+def _(display_element, mo):text = mo.ui.text(placeholder="custom input")_o, _ = display_element.run(element=text)_o- return text,+ return (text,)@app.cell-def __(text):+def _(text):text.valuereturndiff --git a/marimo/_smoke_tests/initial_table.py b/marimo/_smoke_tests/initial_table.pyindex a831c7f1a9..a76b072565 100644--- a/marimo/_smoke_tests/initial_table.py+++ b/marimo/_smoke_tests/initial_table.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.8.8"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import pandas as pdsample_df = pd.DataFrame(@@ -29,16 +29,16 @@ def __():"City": ["New York", "Los Angeles", "Chicago"],})- return pd, sample_df+ return (sample_df,)@app.cell-def __(mo, sample_df):+def _(mo, sample_df):import timemo.output.replace(sample_df)time.sleep(5)- return time,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/inputs.py b/marimo/_smoke_tests/inputs.pyindex 4f01a348cb..1fa55d4208 100644--- a/marimo/_smoke_tests/inputs.py+++ b/marimo/_smoke_tests/inputs.py@@ -2,25 +2,25 @@import marimo-__generated_with = "0.2.8"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):disabled = mo.ui.switch(label="Disabled")mo.hstack([disabled])- return disabled,+ return (disabled,)@app.cell-def __(disabled, mo):+def _(disabled, mo):mo.vstack([mo.ui.text(label="Your name", disabled=disabled.value),@@ -36,7 +36,7 @@ def __(disabled, mo):@app.cell-def __(mo):+def _(mo):options = ["red", "green", "blue"]mo.vstack(@@ -45,31 +45,31 @@ def __(mo):mo.ui.multiselect(options, label="Multi-select"),])- return options,+ return (options,)@app.cell-def __(mo, options):+def _(mo, options):mo.ui.radio(options, label="Radio buttons")return@app.cell-def __(mo, options):+def _(mo, options):mo.ui.radio(options, label="Radio buttons", inline=True)return@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(0, 10, label="Horizontal slider")vslider = mo.ui.slider(0, 10, orientation="vertical", label="Vertical slider")mo.hstack([slider, vslider])- return slider, vslider+ return@app.cell-def __(mo):+def _(mo):_slider = mo.ui.slider(0, 100, label="Horizontal slider", show_value=True)_vslider = mo.ui.slider(0, 100, orientation="vertical", label="Vertical slider", show_value=Truediff --git a/marimo/_smoke_tests/inputs/numbers.py b/marimo/_smoke_tests/inputs/numbers.pyindex 61a1a8e2d8..2b5f4b5730 100644--- a/marimo/_smoke_tests/inputs/numbers.py+++ b/marimo/_smoke_tests/inputs/numbers.py@@ -1,58 +1,58 @@import marimo-__generated_with = "0.8.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""## Basic""")return@app.cell-def __(mo):+def _(mo):mo.ui.number()return@app.cell-def __(mo):+def _(mo):mo.ui.number(-10, 10)return@app.cell-def __(mo):+def _(mo):mo.md(r"""## Edge cases""")return@app.cell-def __(mo):+def _(mo):# Above max safe intBAD_INT = 999999999999999990v = mo.ui.number(value=BAD_INT, start=BAD_INT - 5, stop=BAD_INT + 5, full_width=True)v- return BAD_INT, v+ return (v,)@app.cell-def __(v):+def _(v):v.valuereturn@app.cell-def __(mo):+def _(mo):def on_change(new_value):print(new_value)@@ -62,12 +62,12 @@ def __(mo):@app.cell-def __(mo, on_change):+def _(mo, on_change):import numpy as np# Cannot set infinity as rangemo.ui.number(start=-np.inf, stop=np.inf, value=5, on_change=on_change)- return (np,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/inputs/sliders.py b/marimo/_smoke_tests/inputs/sliders.pyindex efb74949b9..16e4930f36 100644--- a/marimo/_smoke_tests/inputs/sliders.py+++ b/marimo/_smoke_tests/inputs/sliders.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.26"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/iplot.py b/marimo/_smoke_tests/iplot.pyindex 586b1e5ea1..432a525c84 100644--- a/marimo/_smoke_tests/iplot.py+++ b/marimo/_smoke_tests/iplot.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.14.11"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/ipython/img_mimebundle.py b/marimo/_smoke_tests/ipython/img_mimebundle.pyindex 1df78eed22..4cb06e4caa 100644--- a/marimo/_smoke_tests/ipython/img_mimebundle.py+++ b/marimo/_smoke_tests/ipython/img_mimebundle.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.15.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/ipython/progress.py b/marimo/_smoke_tests/ipython/progress.pyindex c20dde0dc8..c61bd7b1c3 100644--- a/marimo/_smoke_tests/ipython/progress.py+++ b/marimo/_smoke_tests/ipython/progress.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/issues/1033.py b/marimo/_smoke_tests/issues/1033.pyindex 5a14385cf6..5b438bd62d 100644--- a/marimo/_smoke_tests/issues/1033.py+++ b/marimo/_smoke_tests/issues/1033.py@@ -12,12 +12,12 @@import marimo-__generated_with = "0.8.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('centered_eight')az.plot_autocorr(_data)# [az.plot_autocorr(_data),@@ -26,7 +26,7 @@ def __(az):@app.cell-def __(az, np):+def _(az, np):_idata = az.from_dict(posterior={"a":np.random.normal(1, 0.5, 5000)},prior={"a":np.random.normal(0, 1, 5000)})az.plot_bf(_idata, var_name="a", ref_val=0)@@ -36,7 +36,7 @@ def __(az, np):@app.cell-def __(az, np):+def _(az, np):_data = az.load_arviz_data("regression1d")# [az.plot_bpv(_data, kind="t_stat", t_stat=lambda x:np.percentile(x, q=50, axis=-1)), type(az.plot_bpv(_data, kind="t_stat", t_stat=lambda x:np.percentile(x, q=50, axis=-1)))]az.plot_bpv(_data, kind="t_stat", t_stat=lambda x:np.percentile(x, q=50, axis=-1))@@ -44,7 +44,7 @@ def __(az, np):@app.cell-def __(az):+def _(az):_model_compare = az.compare({'Centered 8 schools': az.load_arviz_data('centered_eight'),'Non-centered 8 schools': az.load_arviz_data('non_centered_eight')})# [az.plot_compare(_model_compare), type(az.plot_compare(_model_compare))]@@ -53,7 +53,7 @@ def __(az):@app.cell-def __(az):+def _(az):_centered = az.load_arviz_data('centered_eight')_non_centered = az.load_arviz_data('non_centered_eight')# [az.plot_density([_centered, _non_centered]), type(az.plot_density([_centered, _non_centered]))]@@ -62,7 +62,7 @@ def __(az):@app.cell-def __():+def _():# az.clear_data_home()# _data = az.load_arviz_data('rugby')# [az.plot_dist_comparison(_data, var_names=["defs"], coords={"team" : ["Italy"]}), type(az.plot_dist_comparison(_data, var_names=["defs"], coords={"team" : ["Italy"]}))]@@ -70,7 +70,7 @@ def __():@app.cell-def __(az, np):+def _(az, np):_values = np.random.normal(0, 1, 500)# [az.plot_dot(_values), type(az.plot_dot(_values))]az.plot_dot(_values)@@ -78,7 +78,7 @@ def __(az, np):@app.cell-def __(az, norm, np):+def _(az, norm, np):_sample = norm(0,1).rvs(1000)_npoints = 100# [az.plot_ecdf(_sample, eval_points=np.linspace(_sample.min(), _sample.max(), _npoints)), type(az.plot_ecdf(_sample, eval_points=np.linspace(_sample.min(), _sample.max(), _npoints)))]@@ -87,7 +87,7 @@ def __(az, norm, np):@app.cell-def __(az):+def _(az):_idata1 = az.load_arviz_data("centered_eight")_idata2 = az.load_arviz_data("non_centered_eight")# [az.plot_elpd(@@ -105,7 +105,7 @@ def __(az):@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('centered_eight')# [az.plot_energy(_data), type(az.plot_energy(_data))]az.plot_energy(_data)@@ -113,7 +113,7 @@ def __(az):@app.cell-def __(az):+def _(az):_idata = az.load_arviz_data("centered_eight")_coords = {"school": ["Choate", "Lawrenceville"]}az.plot_ess(@@ -128,7 +128,7 @@ def __(az):@app.cell-def __(az):+def _(az):_non_centered_data = az.load_arviz_data('non_centered_eight')_axes = az.plot_forest(_non_centered_data,kind='forestplot',@@ -142,7 +142,7 @@ def __(az):@app.cell-def __(az, np):+def _(az, np):# time-steps random walk_x_data =np.arange(0,100)# Mean random walk@@ -152,11 +152,11 @@ def __(az, np):_y_data = np.random.normal(2 + _mu * 0.5, 0.5, size = (2, 50, 100))# [az.plot_hdi(_x_data, _y_data), type(az.plot_hdi(_x_data, _y_data))]az.plot_hdi(_x_data, _y_data)- return i,+ return@app.cell-def __(az, np):+def _(az, np):_non_centered = az.load_arviz_data('non_centered_eight')_mu_posterior = np.concatenate(_non_centered.posterior["mu"].values)_tau_posterior = np.concatenate(_non_centered.posterior["tau"].values)@@ -166,7 +166,7 @@ def __(az, np):@app.cell-def __(az):+def _(az):_radon = az.load_arviz_data("radon")_loo_radon = az.loo(_radon, pointwise=True)# [az.plot_khat(_loo_radon, show_bins=True), type(az.plot_khat(_loo_radon, show_bins=True))]@@ -175,7 +175,7 @@ def __(az):@app.cell-def __(az):+def _(az):_idata = az.load_arviz_data("radon")# [az.plot_loo_pit(idata=_idata, y="y"), type(az.plot_loo_pit(idata=_idata, y="y"))]az.plot_loo_pit(idata=_idata, y="y")@@ -183,7 +183,7 @@ def __(az):@app.cell-def __(az, np, xr):+def _(az, np, xr):_idata = az.load_arviz_data('regression1d')_x = xr.DataArray(np.linspace(0, 1, 100))_idata.posterior["y_model"] = _idata.posterior["intercept"] + _idata.posterior["slope"]*_x@@ -194,7 +194,7 @@ def __(az, np, xr):@app.cell-def __(az):+def _(az):_idata = az.load_arviz_data("centered_eight")_coords = {"school": ["Deerfield", "Lawrenceville"]}# [az.plot_mcse(@@ -209,7 +209,7 @@ def __(az):@app.cell-def __(az):+def _(az):_centered = az.load_arviz_data('centered_eight')_coords = {'school': ['Choate', 'Deerfield']}# [az.plot_pair(_centered,@@ -233,7 +233,7 @@ def __(az):@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('centered_eight')# [az.plot_parallel(_data, var_names=["mu", "tau"]), type(az.plot_parallel(_data, var_names=["mu", "tau"]))]az.plot_parallel(_data, var_names=["mu", "tau"])@@ -242,7 +242,7 @@ def __(az):@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('centered_eight')# [az.plot_posterior(_data), type(az.plot_posterior(_data))]az.plot_posterior(_data)@@ -250,7 +250,7 @@ def __(az):@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('radon')# [az.plot_ppc(_data, data_pairs={"y":"y"}), type(az.plot_ppc(_data, data_pairs={"y":"y"}))]az.plot_ppc(_data, data_pairs={"y":"y"})@@ -259,7 +259,7 @@ def __(az):@app.cell-def __(az, plt):+def _(az, plt):_data = az.load_arviz_data('centered_eight')# [az.plot_rank(_data), type(az.plot_rank(_data))]az.plot_rank(_data)@@ -268,7 +268,7 @@ def __(az, plt):@app.cell-def __(az):+def _(az):_idata = az.load_arviz_data('classification10d')# [az.plot_separation(idata=_idata, y='outcome', y_hat='outcome', figsize=(8, 1)), type(az.plot_separation(idata=_idata, y='outcome', y_hat='outcome', figsize=(8, 1)))]az.plot_separation(idata=_idata, y='outcome', y_hat='outcome', figsize=(8, 1))@@ -276,7 +276,7 @@ def __(az):@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('non_centered_eight')_coords = {'school': ['Choate', 'Lawrenceville']}# [az.plot_trace(_data, var_names=('theta'), filter_vars="like", coords=_coords), type(az.plot_trace(_data, var_names=('theta'), filter_vars="like", coords=_coords))]@@ -285,7 +285,7 @@ def __(az):@app.cell-def __(az, np):+def _(az, np):_nchains, _ndraws = (4, 500)_obs_data = {"y": 2 * np.arange(1, 9) + 3,@@ -308,18 +308,18 @@ def __(az, np):ax = az.plot_ts(idata=_idata, y="y", y_holdout="z")# [ax, type(ax)]ax- return ax,+ return@app.cell-def __(az):+def _(az):_data = az.load_arviz_data('centered_eight')az.plot_violin(_data)return@app.cell(hide_code=True)-def __():+def _():# import librariesimport marimo as moimport numpy as np@@ -327,7 +327,7 @@ def __():import matplotlib.pyplot as pltimport xarray as xrfrom scipy.stats import uniform, norm- return az, mo, norm, np, plt, uniform, xr+ return az, norm, np, plt, xrif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1055.py b/marimo/_smoke_tests/issues/1055.pyindex 9f55e35204..6d97824130 100644--- a/marimo/_smoke_tests/issues/1055.py+++ b/marimo/_smoke_tests/issues/1055.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.8"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import manim_slides- return manim_slides,+ return@app.cell-def __():+def _():print(1)returndiff --git a/marimo/_smoke_tests/issues/1064.py b/marimo/_smoke_tests/issues/1064.pyindex 69e894bb17..b0d2b6a44a 100644--- a/marimo/_smoke_tests/issues/1064.py+++ b/marimo/_smoke_tests/issues/1064.py@@ -1,43 +1,44 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.8"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moimport plotly.express as pxreturn mo, px@app.cell-def __(mo):+def _(mo):mo.md("# Issue 1064")return@app.cell-def __(px):+def _(px):plot1 = px.scatter(x=[0, 1, 4, 9, 16], y=[0, 1, 2, 3, 4])plot2 = px.scatter(x=[2, 3, 6, 11, 18], y=[2, 3, 4, 5, 6])return plot1, plot2@app.cell-def __(mo):+def _(mo):tabs = mo.ui.tabs({"💾 Tab 1": "","💾 Tab 2": "",})- return tabs,+ return (tabs,)@app.cell-def __(mo, plot1, plot2, tabs):+def _(mo, plot1, plot2, tabs):def render_tab_content():if tabs.value == "💾 Tab 1":return plot1@@ -48,7 +49,7 @@ def __(mo, plot1, plot2, tabs):mo.vstack([tabs.center(), render_tab_content()])- return render_tab_content,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1072.py b/marimo/_smoke_tests/issues/1072.pyindex f32fd198a2..b0c29a92f7 100644--- a/marimo/_smoke_tests/issues/1072.py+++ b/marimo/_smoke_tests/issues/1072.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import polars as plfrom sklearn.datasets import fetch_california_housing@@ -16,7 +17,7 @@ def __():).with_columns(Price=housing.target)df.plot.scatter(x="MedInc", y="Price")- return df, fetch_california_housing, housing, pl+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1086.py b/marimo/_smoke_tests/issues/1086.pyindex c5d260fbb2..c1758e7b43 100644--- a/marimo/_smoke_tests/issues/1086.py+++ b/marimo/_smoke_tests/issues/1086.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.10"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as np@@ -14,7 +15,7 @@ def __():# better to do plt.gca(), but discovered this translating scriptplt.show()- return np, plt+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1107.py b/marimo/_smoke_tests/issues/1107.pyindex c44505eed4..1419c93e08 100644--- a/marimo/_smoke_tests/issues/1107.py+++ b/marimo/_smoke_tests/issues/1107.py@@ -1,25 +1,26 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.12"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):v = mo.ui.number(value=0, start=-10, stop=10)v- return v,+ return (v,)@app.cell-def __(v):+def _(v):v.valuereturndiff --git a/marimo/_smoke_tests/issues/1140.py b/marimo/_smoke_tests/issues/1140.pyindex cc01e35d50..455c65bc84 100644--- a/marimo/_smoke_tests/issues/1140.py+++ b/marimo/_smoke_tests/issues/1140.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.4.5"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import pandas as pdimport numpy as npimport marimo as mo@@ -15,7 +15,7 @@ def __():@app.cell-def __(mo):+def _(mo):mo.md("""This highlights some of the differences between displaying data in different libraries: polars, pandas, pyarrow, and dictionaries.@@ -27,7 +27,7 @@ def __(mo):@app.cell-def __(np, pd):+def _(np, pd):data = {"Integer": [1, 2, 3],"Float": [1.0, 2.5, 3.5],@@ -66,11 +66,11 @@ def __(np, pd):"Set": [set(), set(["a", "b"]), set([1, 2])],"Empty Tuple": [(), (), ()],}- return data,+ return (data,)@app.cell-def __(pd):+def _(pd):df_with_date_index = pd.DataFrame({"a": [1, 2, 3],@@ -79,59 +79,59 @@ def __(pd):},index=pd.to_datetime(["2021-01-01", "2021-06-01", "2021-09-01"]),)- return df_with_date_index,+ return (df_with_date_index,)@app.cell-def __(df_with_date_index, mo):+def _(df_with_date_index, mo):mo.ui.table(df_with_date_index, label="Pandas with date index")return@app.cell-def __(df_with_date_index):+def _(df_with_date_index):df_with_date_indexreturn@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df, label="Pandas")return@app.cell-def __(data, pd):+def _(data, pd):df = pd.DataFrame(data)df- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):mo.ui.dataframe(df)return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df.to_dict(orient="records"), label="List of dictionaries")return@app.cell-def __(data_2, mo, pd):+def _(data_2, mo, pd):# Arrowimport pyarrow as paimport pyarrow.parquet as pqtable = pa.Table.from_pandas(pd.DataFrame(data_2))mo.ui.table(table, label="Pyarrow")- return pa, pq, table+ return@app.cell-def __(np, pd):+def _(np, pd):data_2 = {"Integer": [1, 2, 3],"Float": [1.0, 2.5, 3.5],@@ -165,27 +165,27 @@ def __(np, pd):# 'Empty Set': [set(), set(), set()],# 'Empty Tuple': [(), (), ()],}- return data_2,+ return (data_2,)@app.cell-def __(data_2, mo):+def _(data_2, mo):# Polarsimport polars as plpl_df = pl.DataFrame(data_2)mo.ui.table(pl_df, label="Polars")- return pl, pl_df+ return (pl_df,)@app.cell-def __(pl_df):+def _(pl_df):pl_dfreturn@app.cell-def __():+def _():returndiff --git a/marimo/_smoke_tests/issues/1161.py b/marimo/_smoke_tests/issues/1161.pyindex 7ed96bad53..861d82c398 100644--- a/marimo/_smoke_tests/issues/1161.py+++ b/marimo/_smoke_tests/issues/1161.py@@ -1,30 +1,31 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():return@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(1, 5)slider- return slider,+ return (slider,)@app.cell-def __(mo, slider):+def _(mo, slider):import plotly.express as pxx_data = [1,2,3,4,5,6][:slider.value]y_data = [1,2,3,2,3,4][:slider.value]@@ -32,11 +33,11 @@ def __(mo, slider):p = mo.ui.plotly(fig)p- return fig, p, px, x_data, y_data+ return (p,)@app.cell-def __(p):+def _(p):p.valuereturndiff --git a/marimo/_smoke_tests/issues/1165.py b/marimo/_smoke_tests/issues/1165.pyindex e4b859fd77..47d347e300 100644--- a/marimo/_smoke_tests/issues/1165.py+++ b/marimo/_smoke_tests/issues/1165.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(css):+def _(css):import anywidgetimport marimo as mo@@ -35,11 +36,11 @@ def __(css):IGVWidget()- return IGVWidget, anywidget, mo+ return@app.cell-def __():+def _():css = """.igv-navbar {display: flex;@@ -1646,7 +1647,7 @@ def __():color: #444;}"""- return css,+ return (css,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1241.py b/marimo/_smoke_tests/issues/1241.pyindex 30e824cf8d..62e3b4cd59 100644--- a/marimo/_smoke_tests/issues/1241.py+++ b/marimo/_smoke_tests/issues/1241.py@@ -1,27 +1,28 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.5"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport leafmap.foliumap as leafmapm = leafmap.Map(center=(40, -100), zoom=4)- return leafmap, m, mo+ return m, mo@app.cell-def __(m):+def _(m):m # Using our custom formatterreturn@app.cell-def __(m, mo):+def _(m, mo):mo.Html(m._repr_html_()) # Using the built-in ipython formatterreturndiff --git a/marimo/_smoke_tests/issues/1270.py b/marimo/_smoke_tests/issues/1270.pyindex deede3922e..f05a8b0230 100644--- a/marimo/_smoke_tests/issues/1270.py+++ b/marimo/_smoke_tests/issues/1270.py@@ -1,17 +1,18 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.10"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport polars as plpl.DataFrame(data=[{'num': [1], 'x': [2]}]).group_by('num').map_groups(lambda x: pl.DataFrame(data=123))- return mo, pl+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1271.py b/marimo/_smoke_tests/issues/1271.pyindex b528218348..ee41d55048 100644--- a/marimo/_smoke_tests/issues/1271.py+++ b/marimo/_smoke_tests/issues/1271.py@@ -1,34 +1,35 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.7"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):with mo.status.spinner(remove_on_exit=False):passreturn@app.cell-def __(mo):+def _(mo):counter_button = mo.ui.button(value=0, on_click=lambda value: value + 1, label="increment")counter_button- return counter_button,+ return (counter_button,)@app.cell-def __(counter_button, mo):+def _(counter_button, mo):mo.vstack([counter_button.value,mo.status.spinner(remove_on_exit=False) if counter_button.value < 3 else mo.md("Done!"),diff --git a/marimo/_smoke_tests/issues/1273.py b/marimo/_smoke_tests/issues/1273.pyindex efbae1e0ff..702d4c8e02 100644--- a/marimo/_smoke_tests/issues/1273.py+++ b/marimo/_smoke_tests/issues/1273.py@@ -1,26 +1,27 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.7"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moimport plotly.express as pxreturn mo, px@app.cell-def __(mo):+def _(mo):s = mo.ui.range_slider(start=-5, stop=5, show_value=True, label='x range')x, y = list(range(10)), [i * i for i in range(-5, 5)]return s, x, y@app.cell-def __(mo, px, s, x, y):+def _(mo, px, s, x, y):# takes affect when using the slidermo.vstack([s,@@ -30,12 +31,12 @@ def __(mo, px, s, x, y):@app.cell-def __(mo, px, s, x, y):+def _(mo, px, s, x, y):# takes affect when using the slider# also is zoom/range is persisted across app view, but reset when the slider changes the rangeplot = mo.ui.plotly(px.scatter(x=x, y=y, range_x=s.value, title=f'range_x: {s.value}'))plot- return plot,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1274.py b/marimo/_smoke_tests/issues/1274.pyindex 8b8d5b0839..fcb9be2ad0 100644--- a/marimo/_smoke_tests/issues/1274.py+++ b/marimo/_smoke_tests/issues/1274.py@@ -1,21 +1,20 @@# Copyright 2024 Marimo. All rights reserved.-import marimo-__generated_with = "0.4.7"+__generated_with = "0.15.5"app = marimo.App()@app.cell-async def __():+async def _():import asyncioprint("hello")await asyncio.sleep(1)print("world")await asyncio.sleep(1)print("last one")- return asyncio,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1279.py b/marimo/_smoke_tests/issues/1279.pyindex 35f2976cb7..7e34794bc1 100644--- a/marimo/_smoke_tests/issues/1279.py+++ b/marimo/_smoke_tests/issues/1279.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.7"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import altair as altimport polars as plalt.data_transformers.enable("marimo_csv")@@ -28,7 +29,7 @@ def __():).mark_bar())- return alt, counts, pl+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1291.py b/marimo/_smoke_tests/issues/1291.pyindex 931ec7d3fd..3875790e7a 100644--- a/marimo/_smoke_tests/issues/1291.py+++ b/marimo/_smoke_tests/issues/1291.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.9"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport altair as altimport polars as pl@@ -46,7 +47,7 @@ def __():chart2])- return alt, chart1, chart2, counts, mo, pl+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1311.py b/marimo/_smoke_tests/issues/1311.pyindex f0076281a8..13d141d5c6 100644--- a/marimo/_smoke_tests/issues/1311.py+++ b/marimo/_smoke_tests/issues/1311.py@@ -1,33 +1,34 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pd@app.cell-def __(pd):+def _(pd):all_flights = pd.read_parquet("https://vegafusion-datasets.s3.amazonaws.com/vega/flights_1m.parquet")- return all_flights,+ return (all_flights,)@app.cell-def __(all_flights, mo):+def _(all_flights, mo):mo.ui.table(all_flights)return@app.cell-def __(all_flights, mo):+def _(all_flights, mo):mo.ui.table(all_flights[0:10])returndiff --git a/marimo/_smoke_tests/issues/1312.py b/marimo/_smoke_tests/issues/1312.pyindex 91ac04c172..4a1a86e8fe 100644--- a/marimo/_smoke_tests/issues/1312.py+++ b/marimo/_smoke_tests/issues/1312.py@@ -1,26 +1,27 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(pd):+def _(pd):df = pd.DataFrame({"a": [1, 2, 3], "b": [1, 2, 3], "c": [1, 2, 3]})renamed = df.rename({"b": "a"}, axis=1)renamed- return df, renamed+ return (renamed,)@app.cell-def __(mo, renamed):+def _(mo, renamed):mo.ui.table(renamed)return@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pddiff --git a/marimo/_smoke_tests/issues/1319.py b/marimo/_smoke_tests/issues/1319.pyindex bd438e2663..3027aab9f8 100644--- a/marimo/_smoke_tests/issues/1319.py+++ b/marimo/_smoke_tests/issues/1319.py@@ -1,24 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.4.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import pandas as pd- return pd,+ return (pd,)@app.cell-def __():+def _():import random@@ -27,25 +28,25 @@ def __():"".join(random.choices("abcdefghikjlmnopqrstuvwxyz", k=8)),"".join(random.choices("abcdefghikjlmnopqrstuvwxyz", k=8)),] + [random.randint(1000, 100000) for i in range(columns - 2)]- return random, row+ return (row,)@app.cell-def __(pd, row):+def _(pd, row):df = pd.DataFrame([row(3) for _ in range(10)])- return df,+ return (df,)@app.cell-def __():+def _():return@app.cell-def __(df, mo):+def _(df, mo):uidf = mo.ui.dataframe(df)uidf- return uidf,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1351.py b/marimo/_smoke_tests/issues/1351.pyindex b89f9cc718..33edbbd182 100644--- a/marimo/_smoke_tests/issues/1351.py+++ b/marimo/_smoke_tests/issues/1351.py@@ -2,20 +2,20 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):themes = ["dark_minimal", "light_minimal", "contrast", "night_sky", "caliber"]selected_theme = mo.ui.radio(themes, label="Theme", value="dark_minimal")selected_theme- return selected_theme, themes+ return (selected_theme,)@app.cell-def __(selected_theme):+def _(selected_theme):import polars as plimport holoviews as hvimport hvplot.polars@@ -23,21 +23,21 @@ def __(selected_theme):hv.extension("bokeh")hvplot.extension("bokeh")hv.renderer("bokeh").theme = selected_theme.value- return hv, hvplot, pl+ return (pl,)@app.cell-def __(pl):+def _(pl):df = pl.DataFrame({"a": range(1, 10), "b": range(1, 10)})df.plot.line(x="a",y="b",)- return df,+ return@app.cell-def __(selected_theme):+def _(selected_theme):from bokeh.plotting import curdoc, figurex = [1, 2, 3, 4, 5]@@ -49,13 +49,13 @@ def __(selected_theme):p.line(x, y)p- return curdoc, figure, p, x, y+ return@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1362.py b/marimo/_smoke_tests/issues/1362.pyindex 84b5e3f909..cdbf20ccab 100644--- a/marimo/_smoke_tests/issues/1362.py+++ b/marimo/_smoke_tests/issues/1362.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.5.2"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():"""hello, this is a cellhello, this is a cell@@ -75,11 +76,11 @@ def __():"""qwerty = 10- return qwerty,+ return (qwerty,)@app.cell-def __(qwerty):+def _(qwerty):"""hello, this is a cellhello, this is a cell@@ -148,11 +149,11 @@ def __(qwerty):"""a = f"{qwerty} 10"- return a,+ return (a,)@app.cell-def __(a):+def _(a):areturndiff --git a/marimo/_smoke_tests/issues/1510.py b/marimo/_smoke_tests/issues/1510.pyindex b44e97593c..ec61da7a3d 100644--- a/marimo/_smoke_tests/issues/1510.py+++ b/marimo/_smoke_tests/issues/1510.py@@ -1,20 +1,21 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import matplotlib.pyplot as pltplt.plot([1, 2])plt.legend(["asdf"], bbox_to_anchor=(1.2, 0.5))- return plt,+ return (plt,)@app.cell-def __(plt):+def _(plt):plt.plot([1, 2])plt.legend(["asdf"], bbox_to_anchor=(1.2, 0.5))plt.show()@@ -22,11 +23,11 @@ def __(plt):@app.cell-def __():+def _():import matplotlibbackend = matplotlib.get_backend()backend- return backend, matplotlib+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1530.py b/marimo/_smoke_tests/issues/1530.pyindex 2895921aa6..15fda74b00 100644--- a/marimo/_smoke_tests/issues/1530.py+++ b/marimo/_smoke_tests/issues/1530.py@@ -1,19 +1,20 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.13"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pd@app.cell-def __(pd):+def _(pd):df = pd.DataFrame({"col$special": [1, 2, 3],@@ -30,31 +31,31 @@ def __(pd):})df- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df)return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.dataframe(df)return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.data_explorer(df)return@app.cell-def __():+def _():import altair as alt- return alt,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1545.py b/marimo/_smoke_tests/issues/1545.pyindex 2f1e108cc6..7b2ff2e43c 100644--- a/marimo/_smoke_tests/issues/1545.py+++ b/marimo/_smoke_tests/issues/1545.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.14"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import altair as altimport marimo as moimport pandas as pd@@ -14,7 +15,7 @@ def __():@app.cell-def __(pd):+def _(pd):df = pd.DataFrame(data={"annotation": ["w", "x", "y", "a", "b", "c", "d", "e", "f", "g"],@@ -26,11 +27,11 @@ def __(pd):},index=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],)- return df,+ return (df,)@app.cell-def __(alt, df, pd):+def _(alt, df, pd):scatter = alt.Chart(df).mark_point().encode(x="x", y="y", tooltip="annotation")y_line = (alt.Chart(pd.DataFrame({"var1": [0, 0], "var2": [0, 40]}))@@ -41,7 +42,7 @@ def __(alt, df, pd):@app.cell-def __(alt, mo, scatter, y_line):+def _(alt, mo, scatter, y_line):layer_plot = mo.ui.altair_chart(alt.layer(scatter, y_line).configure_axis(grid=False)@@ -49,23 +50,23 @@ def __(alt, mo, scatter, y_line):)layer_plot- return layer_plot,+ return (layer_plot,)@app.cell-def __(layer_plot):+def _(layer_plot):layer_plot.selectionsreturn@app.cell-def __(layer_plot):+def _(layer_plot):print(layer_plot.value)return@app.cell-def __(df, layer_plot):+def _(df, layer_plot):print(layer_plot.apply_selection(df))# should return a table of selected points based on the scatter plotreturndiff --git a/marimo/_smoke_tests/issues/1586.py b/marimo/_smoke_tests/issues/1586.pyindex 80104def45..706858bfb8 100644--- a/marimo/_smoke_tests/issues/1586.py+++ b/marimo/_smoke_tests/issues/1586.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import timeimport ibis@@ -26,7 +27,7 @@ def __():# print(df.__dataframe__().num_rows())end = time.time()print(f"Time to read from datatable: {(end - start) * 1000}ms")- return df, end, get_table_manager_or_none, ibis, manager, start, time+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1602.py b/marimo/_smoke_tests/issues/1602.pyindex bd344abb15..9bfc242188 100644--- a/marimo/_smoke_tests/issues/1602.py+++ b/marimo/_smoke_tests/issues/1602.py@@ -1,26 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")-def __():- class Boom:- def __getattr__(self, _):- return ...- return Boom,[email protected]_definition+class Boom:+ def __getattr__(self, _):+ return ...@app.cell-def __(Boom):+def _():b = Boom()- return b,+ return (b,)@app.cell-def __(b):+def _(b):callable(b.__dataframe__)returndiff --git a/marimo/_smoke_tests/issues/1654-virtualize-multiselect.py b/marimo/_smoke_tests/issues/1654-virtualize-multiselect.pyindex d8d1d6fce2..4c5fe7f265 100644--- a/marimo/_smoke_tests/issues/1654-virtualize-multiselect.py+++ b/marimo/_smoke_tests/issues/1654-virtualize-multiselect.py@@ -2,25 +2,25 @@import marimo-__generated_with = "0.8.20"+__generated_with = "0.15.5"app = marimo.App(app_title="1654 - Virtualize Multiselect")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):fuzzy_match_test = ["foo bar", "bar foo", "foob", "foobar", "barfoo"]mo.ui.multiselect(fuzzy_match_test, label="Fuzzy match test")- return (fuzzy_match_test,)+ return@app.cell-def __(mo):+def _(mo):(mo.ui.multiselect([], label="Empty"),mo.ui.multiselect(["1", "2"], label="2 items"),@@ -29,50 +29,50 @@ def __(mo):@app.cell-def __(mo, xs_list):+def _(mo, xs_list):v = mo.ui.multiselect(xs_list, label="Extra small list with 10 items")vreturn (v,)@app.cell-def __(v):+def _(v):print(v.value)return@app.cell-def __(mo, sm_list):+def _(mo, sm_list):mo.ui.multiselect(sm_list, label="Small list with 100 items")return@app.cell-def __(md_list, mo):+def _(md_list, mo):mo.ui.multiselect(md_list, label="Medium list with 500 items")return@app.cell-def __(lg_list, mo):+def _(lg_list, mo):mo.ui.multiselect(lg_list, label="Large list with 1K items")return@app.cell-def __(mo, xl_list):+def _(mo, xl_list):mo.ui.multiselect(xl_list, label="XL list with 10K items")return@app.cell-def __(mo, xxl_list):+def _(mo, xxl_list):mo.ui.multiselect(xxl_list, label="XXL list with 100K items")return@app.cell-def __(mo, xxxl_list):+def _(mo, xxxl_list):try:mo.ui.multiselect(xxxl_list, label="XXXL list with 200K items")except ValueError as e:@@ -81,7 +81,7 @@ def __(mo, xxxl_list):@app.cell-def __():+def _():RANGE = 10000xs_list = [f"Row {i}" for i in range(RANGE // 1000)]sm_list = [f"Row {i}" for i in range(RANGE // 100)]@@ -90,16 +90,7 @@ def __():xl_list = [f"Row {i}" for i in range(RANGE)]xxl_list = [f"Row {i}" for i in range(RANGE * 10)]xxxl_list = [f"Row {i}" for i in range(RANGE * 20)]- return (- RANGE,- lg_list,- md_list,- sm_list,- xl_list,- xs_list,- xxl_list,- xxxl_list,- )+ return lg_list, md_list, sm_list, xl_list, xs_list, xxl_list, xxxl_listif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1684.py b/marimo/_smoke_tests/issues/1684.pyindex 75da36e645..f9cc4ac535 100644--- a/marimo/_smoke_tests/issues/1684.py+++ b/marimo/_smoke_tests/issues/1684.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md(r"""$$@@ -21,9 +22,9 @@ def __(mo):@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1689.py b/marimo/_smoke_tests/issues/1689.pyindex cd9352cc4e..799dc4c413 100644--- a/marimo/_smoke_tests/issues/1689.py+++ b/marimo/_smoke_tests/issues/1689.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.23"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport pandas as pd@@ -16,11 +17,11 @@ def __():df_with_index = pd.DataFrame(data, index=[0, 1, 2])df_with_named_index = pd.DataFrame(data)df_with_named_index.index.names = ["idx"]- return data, df, df_with_index, df_with_named_index, mo, pd+ return df, df_with_index, df_with_named_index, mo, pd@app.cell-def __(pd):+def _(pd):_data = pd.DataFrame({"Animal": ["Falcon", "Falcon", "Parrot", "Parrot"],@@ -28,11 +29,11 @@ def __(pd):})agg_df = _data.groupby(["Animal"]).mean()- return agg_df,+ return (agg_df,)@app.cell-def __(df, df_with_index, df_with_named_index):+def _(df, df_with_index, df_with_named_index):[df.index,df_with_index.index,@@ -42,25 +43,25 @@ def __(df, df_with_index, df_with_named_index):@app.cell-def __(agg_df, mo):+def _(agg_df, mo):mo.ui.table(agg_df)return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df)return@app.cell-def __(df_with_index, mo):+def _(df_with_index, mo):mo.ui.table(df_with_index)return@app.cell-def __(df_with_named_index, mo):+def _(df_with_named_index, mo):mo.ui.table(df_with_named_index)returndiff --git a/marimo/_smoke_tests/issues/1706.py b/marimo/_smoke_tests/issues/1706.pyindex d025789e00..2defe2092d 100644--- a/marimo/_smoke_tests/issues/1706.py+++ b/marimo/_smoke_tests/issues/1706.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.25"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport numpy as np@@ -15,17 +16,17 @@ def __():{"a": [np.zeros(5) for i in range(5)]}, schema={"a": pl.Array(pl.Float64, 5)})df- return df, mo, np, pl+ return df, mo@app.cell-def __(df, mo):+def _(df, mo):mo.plain(df)return@app.cell-def __(df):+def _(df):df.get_columns()[0].dtypereturndiff --git a/marimo/_smoke_tests/issues/1710.py b/marimo/_smoke_tests/issues/1710.pyindex cb65bbaedc..96ba45ff45 100644--- a/marimo/_smoke_tests/issues/1710.py+++ b/marimo/_smoke_tests/issues/1710.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.25"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport osimport keras@@ -15,7 +16,7 @@ def __():model.add(keras.layers.Dense(2, activation='relu'))model.add(keras.layers.Dense(1, activation='sigmoid'))keras.utils.plot_model(model)- return keras, mo, model, os+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1711.py b/marimo/_smoke_tests/issues/1711.pyindex 27b87d28d3..908bdb6269 100644--- a/marimo/_smoke_tests/issues/1711.py+++ b/marimo/_smoke_tests/issues/1711.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import polars as plimport numpy as np@@ -20,11 +20,11 @@ def __():is_elementwise=True,),)- return d, np, pl, res+ return (res,)@app.cell-def __(res):+def _(res):resreturndiff --git a/marimo/_smoke_tests/issues/1816.py b/marimo/_smoke_tests/issues/1816.pyindex 9545e806a1..f267246279 100644--- a/marimo/_smoke_tests/issues/1816.py+++ b/marimo/_smoke_tests/issues/1816.py@@ -1,26 +1,27 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):dict1={"hello": mo.ui.text(label="world")}dict2=mo.ui.dictionary({k: v.form() for k, v in dict1.items()})dict2- return dict1, dict2+ return (dict2,)@app.cell-def __(dict2):+def _(dict2):dict2.valuereturndiff --git a/marimo/_smoke_tests/issues/1851.py b/marimo/_smoke_tests/issues/1851.pyindex d3d569784d..a0882e6568 100644--- a/marimo/_smoke_tests/issues/1851.py+++ b/marimo/_smoke_tests/issues/1851.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():raise ValueError("".join([str(i) for i in range(1000)]))returndiff --git a/marimo/_smoke_tests/issues/1927.py b/marimo/_smoke_tests/issues/1927.pyindex 92736d815a..f98aece091 100644--- a/marimo/_smoke_tests/issues/1927.py+++ b/marimo/_smoke_tests/issues/1927.py@@ -1,17 +1,18 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():breaker = []for i in range(5):breaker.append(breaker)breaker- return breaker, i+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/1933.py b/marimo/_smoke_tests/issues/1933.pyindex 58366ffc92..616426f19c 100644--- a/marimo/_smoke_tests/issues/1933.py+++ b/marimo/_smoke_tests/issues/1933.py@@ -1,39 +1,40 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():from vega_datasets import data- return data,+ return (data,)@app.cell-def __(data, mo):+def _(data, mo):t = mo.ui.table(data.cars())- return t,+ return (t,)@app.cell-def __(mo, t):+def _(mo, t):dictionary = mo.ui.dictionary({"cars": t})id(dictionary["cars"]), dictionary- return dictionary,+ return (dictionary,)@app.cell-def __(dictionary):+def _(dictionary):dictionary.value["cars"]returndiff --git a/marimo/_smoke_tests/issues/2000-explode-columns.py b/marimo/_smoke_tests/issues/2000-explode-columns.pyindex 42cb1eedc3..56573526a1 100644--- a/marimo/_smoke_tests/issues/2000-explode-columns.py+++ b/marimo/_smoke_tests/issues/2000-explode-columns.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport pandas as pdimport polars as pl@@ -15,7 +15,7 @@ def __():@app.cell-def __():+def _():list_data = [['meow1', 'meow2'], ['meow1', 'meow2', 'meow3'], ['meow'], ['a', 'b', 'c'], ['meow']]json_data = [{'acol': 'acol1', 'bcol': 'bcol1'},@@ -28,7 +28,7 @@ def __():@app.cell-def __(json_data, list_data, pd, pl):+def _(json_data, list_data, pd, pl):df = pd.DataFrame()df['list_data'] = list_datadf['json_data'] = json_data@@ -42,39 +42,39 @@ def __(json_data, list_data, pd, pl):@app.cell-def __(mo):+def _(mo):mo.md("""### Transformations performed manually with pandas:""")return@app.cell-def __(df, pd):+def _(df, pd):df3 = df.copy(deep=True)df3 = df.join(pd.DataFrame(df.pop('json_data').values.tolist()))df3.explode('list_data')- return df3,+ return@app.cell-def __(mo):+def _(mo):mo.md("""### Transformations on pandas dataframe using `mo.ui.dataframe`:""")return@app.cell-def __(df2, mo):+def _(df2, mo):mo.ui.dataframe(df2[['list_data', 'json_data']])return@app.cell-def __(mo):+def _(mo):mo.md(r"""### Transformations on polars dataframe using `mo.ui.dataframe`:""")return@app.cell-def __(df4, mo):+def _(df4, mo):mo.ui.dataframe(df4[['list_data', 'json_data']])returndiff --git a/marimo/_smoke_tests/issues/2005.py b/marimo/_smoke_tests/issues/2005.pyindex 562d8a4d51..2d4b817fc4 100644--- a/marimo/_smoke_tests/issues/2005.py+++ b/marimo/_smoke_tests/issues/2005.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport altair as alt@@ -30,11 +31,11 @@ def __():.mark_point(color="red"))chart- return alt, chart, mo, pl, test_data+ return chart, mo@app.cell-def __(chart, mo):+def _(chart, mo):mo.ui.altair_chart(chart)returndiff --git a/marimo/_smoke_tests/issues/2019-sql-refs.py b/marimo/_smoke_tests/issues/2019-sql-refs.pyindex 9c9a739b70..f3b21ebbad 100644--- a/marimo/_smoke_tests/issues/2019-sql-refs.py+++ b/marimo/_smoke_tests/issues/2019-sql-refs.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo, my_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM my_table@@ -16,7 +16,7 @@ def __(mo, my_table):@app.cell-def __(mo, my_view):+def _(mo):_df = mo.sql(f"""SELECT * FROM my_view@@ -27,7 +27,7 @@ def __(mo, my_view):@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPlACE TABLE my_table (a text);@@ -35,11 +35,11 @@ def __(mo):""")[mo.refs(), mo.defs()]- return my_table,+ return@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE VIEW my_view AS (SELECT * FROM my_table WHERE a LIKE 'f%o')@@ -50,10 +50,10 @@ def __(mo):@app.cell(hide_code=True)-def __():+def _():import marimo as moimport pandas as pd- return mo, pd+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2070-latex-slides.py b/marimo/_smoke_tests/issues/2070-latex-slides.pyindex d1a8629f0e..711738f7ce 100644--- a/marimo/_smoke_tests/issues/2070-latex-slides.py+++ b/marimo/_smoke_tests/issues/2070-latex-slides.py@@ -1,7 +1,8 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App(width="medium",layout_file="layouts/2070-latex-slides.slides.json",@@ -9,7 +10,7 @@ app = marimo.App(@app.cell-def __():+def _():import marimo as momo.md("""@@ -26,22 +27,22 @@ def __():em que $R^2_j$ é o $R^2$ da regressão da variável explicativa $j$ nas outras variáveis""")- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""# 2""")return@app.cell-def __():+def _():return@app.cell-def __(mo):+def _(mo):mo.md("""# 3""")returndiff --git a/marimo/_smoke_tests/issues/2137-realtime-markdown.py b/marimo/_smoke_tests/issues/2137-realtime-markdown.pyindex 702938e429..cf262073ca 100644--- a/marimo/_smoke_tests/issues/2137-realtime-markdown.py+++ b/marimo/_smoke_tests/issues/2137-realtime-markdown.py@@ -1,24 +1,24 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport timereturn mo, time@app.cell-def __(time):+def _(time):time.sleep(10)return@app.cell-def __(mo):+def _(mo):mo.md(r"""### Realtime Markdown Editingdiff --git a/marimo/_smoke_tests/issues/2146-admonitions.py b/marimo/_smoke_tests/issues/2146-admonitions.pyindex 045eccd4a0..4255f07ec2 100644--- a/marimo/_smoke_tests/issues/2146-admonitions.py+++ b/marimo/_smoke_tests/issues/2146-admonitions.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.8.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""Importa recordar as seguintes regras de diferenciação de matrizes:@@ -27,7 +27,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""!!! tip ""@@ -47,7 +47,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.accordion({"Tip": mo.md(r"""diff --git a/marimo/_smoke_tests/issues/2173-accordion.py b/marimo/_smoke_tests/issues/2173-accordion.pyindex 2eca0b5b40..5f948fd581 100644--- a/marimo/_smoke_tests/issues/2173-accordion.py+++ b/marimo/_smoke_tests/issues/2173-accordion.py@@ -7,12 +7,12 @@import marimo-__generated_with = "0.8.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.accordion({"""**e)** Diria que o trabalho, a educação e a idade explicam muita da variação no sono? Que outros fatores poderiam afetar o tempo passado a dormir? Estarão esses fatores provavelmente correlacionados com o trabalho?""": """@@ -24,9 +24,9 @@ def __(mo):@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2211-pandas-formatting.py b/marimo/_smoke_tests/issues/2211-pandas-formatting.pyindex 6c49d04b69..b44f651e16 100644--- a/marimo/_smoke_tests/issues/2211-pandas-formatting.py+++ b/marimo/_smoke_tests/issues/2211-pandas-formatting.py@@ -7,12 +7,12 @@import marimo-__generated_with = "0.8.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pandas as pd# Need to set these settings to test if they get us in@@ -42,7 +42,7 @@ def __():# Convert 'date_column' to datetimedf["date_column"] = pd.to_datetime(df["date_column"])df.dtypes- return df, pd, test_data+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2216-accordions.py b/marimo/_smoke_tests/issues/2216-accordions.pyindex 3ad8624e9c..8cbd2a3eb2 100644--- a/marimo/_smoke_tests/issues/2216-accordions.py+++ b/marimo/_smoke_tests/issues/2216-accordions.py@@ -7,18 +7,18 @@import marimo-__generated_with = "0.8.13"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.accordion({"""**e)** Would you say that work, education, and age explain much of the variation in sleep? What other factors could affect the time spent sleeping? Are these factors likely to be correlated with work?""": """@@ -35,7 +35,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.accordion({r"""**a)** Estimate the coefficients of the regression of $Y$ on $X_1$, as well as the standard error of the regression and $R^2$. What do you think of the estimate of $\beta_1$?""": mo.md(@@ -50,13 +50,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""**b)** If the expected value of $X$ is the average of its two values mentioned in the previous part, what do you think the expected value of $Y$ will be? Confirm your answer using the law of iterated expectations.""")return@app.cell-def __(mo):+def _(mo):mo.accordion({"""**b)** If the expected value of $X$ is the average of its two values mentioned in the previous part, what do you think the expected value of $Y$ will be? Confirm your answer using the law of iterated expectations.""": mo.md("""diff --git a/marimo/_smoke_tests/issues/2315.py b/marimo/_smoke_tests/issues/2315.pyindex 9a226c4f47..5fb0c2e2fd 100644--- a/marimo/_smoke_tests/issues/2315.py+++ b/marimo/_smoke_tests/issues/2315.py@@ -8,12 +8,12 @@import marimo-__generated_with = "0.8.15"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import polars as plimport altair as alt@@ -28,11 +28,11 @@ def __():})df1- return alt, df1, pl+ return (pl,)@app.cell-def __(pl):+def _(pl):df2 = pl.DataFrame({"i.a": [0.0, 0.0, 0.2, 0.2],@@ -42,7 +42,7 @@ def __(pl):})df2- return df2,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2327_table_staleness.py b/marimo/_smoke_tests/issues/2327_table_staleness.pyindex 6224d93c38..c981726a01 100644--- a/marimo/_smoke_tests/issues/2327_table_staleness.py+++ b/marimo/_smoke_tests/issues/2327_table_staleness.py@@ -1,32 +1,30 @@--import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport datetimereturn datetime, mo@app.cell-def __():+def _():initial_data = [{"x": 1, "y": -1}]- return initial_data,+ return (initial_data,)@app.cell-def __(initial_data, mo):+def _(initial_data, mo):get_data, set_data = mo.state(initial_data)return get_data, set_data@app.cell-def __(datetime, get_data, mo, set_data):+def _(datetime, get_data, mo, set_data):_data = get_data()print("Creating new table list", datetime.datetime.utcnow())def on_change_wrapper(i, k):@@ -38,17 +36,17 @@ def __(datetime, get_data, mo, set_data):return on_changetable_list = [{k: mo.ui.number(value=v, start=-100, stop=100, on_change=on_change_wrapper(i, k)) for k, v in d.items()} for i, d in enumerate(_data)]- return on_change_wrapper, table_list+ return (table_list,)@app.cell-def __(mo, table_list):+def _(mo, table_list):table = mo.ui.table(table_list)- return table,+ return (table,)@app.cell-def __(get_data, mo, set_data):+def _(get_data, mo, set_data):def on_click(*value):rows = get_data()rows.append({"x": 0, "y": 0})@@ -57,23 +55,23 @@ def __(get_data, mo, set_data):add_row = mo.ui.button(label="add row", on_click=on_click)- return add_row, on_click+ return (add_row,)@app.cell-def __(add_row, mo, table):+def _(add_row, mo, table):mo.vstack([table, add_row])return@app.cell-def __(get_data):+def _(get_data):get_data()return@app.cell-def __(table_list):+def _(table_list):table_list[0]["x"].valuereturndiff --git a/marimo/_smoke_tests/issues/2357-table-ui-elements.py b/marimo/_smoke_tests/issues/2357-table-ui-elements.pyindex ffa335db68..315210e99f 100644--- a/marimo/_smoke_tests/issues/2357-table-ui-elements.py+++ b/marimo/_smoke_tests/issues/2357-table-ui-elements.py@@ -1,25 +1,23 @@--import marimo-__generated_with = "0.8.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):data = [{"x": 1, "y": "a", "c": mo.ui.button(label="hello")}, {"x": 2, "y": "b", "c": mo.ui.button(label="world")}]return (data,)@app.cell-def __(data, mo):+def _(data, mo):mo.ui.table(data)returndiff --git a/marimo/_smoke_tests/issues/2366-anywidget-binary.py b/marimo/_smoke_tests/issues/2366-anywidget-binary.pyindex 631c1b732e..d336658c7e 100644--- a/marimo/_smoke_tests/issues/2366-anywidget-binary.py+++ b/marimo/_smoke_tests/issues/2366-anywidget-binary.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.17"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import anywidgetimport traitlets@@ -30,7 +30,7 @@ def __():"dtype": str(arr.dtype),})- return Widget, anywidget, arr, np, traitlets+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2403_table_ui_staleness.py b/marimo/_smoke_tests/issues/2403_table_ui_staleness.pyindex 2ef4e2fcda..5b628690b8 100644--- a/marimo/_smoke_tests/issues/2403_table_ui_staleness.py+++ b/marimo/_smoke_tests/issues/2403_table_ui_staleness.py@@ -1,26 +1,24 @@--import marimo-__generated_with = "0.8.20"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __():+def _():keys_1 = [f"123_{x}" for x in range(20)]keys_2 = [f"abc_{x}" for x in range(20)]return keys_1, keys_2@app.cell-def __(mo):+def _(mo):# Toggling this switch should change the keys in the tables and the initial value in the text inputsswitch = mo.ui.switch()switch@@ -37,7 +35,7 @@ def button(keys_1, keys_2, switch):def display(keys, mo):table = mo.ui.table({str(k): mo.ui.text(value=k) for k in keys})table- return (table,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2457-plotly-section.py b/marimo/_smoke_tests/issues/2457-plotly-section.pyindex a348b6812e..4082d1fd51 100644--- a/marimo/_smoke_tests/issues/2457-plotly-section.py+++ b/marimo/_smoke_tests/issues/2457-plotly-section.py@@ -1,13 +1,11 @@--import marimo-__generated_with = "0.8.22"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport plotly.express as px@@ -17,32 +15,32 @@ def __():@app.cell-def __(df):+def _(df):dfreturn@app.cell-def __(df, mo, px):+def _(df, mo, px):_fig = px.treemap(df, path=[px.Constant("all"), 'day', 'time', 'sex'], values='total_bill')plot = mo.ui.plotly(_fig)return (plot,)@app.cell-def __(mo, plot):+def _(mo, plot):mo.vstack([plot], align="stretch")return@app.cell-def __(plot):+def _(plot):plot.valuereturn@app.cell-def __(mo, px):+def _(mo, px):_data = dict(character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],@@ -60,7 +58,7 @@ def __(mo, px):@app.cell-def __(sunburst):+def _(sunburst):sunburst.valuereturndiff --git a/marimo/_smoke_tests/issues/2506_anywidget_buffer_paths.py b/marimo/_smoke_tests/issues/2506_anywidget_buffer_paths.pyindex 88e661be5c..c6dd34a108 100644--- a/marimo/_smoke_tests/issues/2506_anywidget_buffer_paths.py+++ b/marimo/_smoke_tests/issues/2506_anywidget_buffer_paths.py@@ -1,18 +1,18 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():# binary data is a png image of a small purple squareCONTENT = b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x14\x00\x00\x00\x14\x08\x02\x00\x00\x00\x02\xeb\x8aZ\x00\x00\x00\tpHYs\x00\x00.#\x00\x00.#\x01x\xa5?v\x00\x00\x00\x1dIDAT8\xcbc\xac\x11\xa9g \x1701P\x00F5\x8fj\x1e\xd5<\xaa\x99r\xcd\x00m\xba\x017\xd3\x00\xdf\xcb\x00\x00\x00\x00IEND\xaeB`\x82"return (CONTENT,)@app.cell-def __(CONTENT):+def _(CONTENT):import anywidgetimport traitlets@@ -36,25 +36,25 @@ def __(CONTENT):# binary data is a png image of a small purple squareBytesWidget(value=CONTENT)- return BytesWidget, anywidget, traitlets+ return anywidget, traitlets@app.cell-def __(CONTENT, mo):+def _(CONTENT, mo):# Not lossymo.image(CONTENT.decode("latin1").encode("latin1"))return@app.cell-def __(CONTENT, mo):+def _(CONTENT, mo):# Is lossymo.image(CONTENT.decode("utf-8", errors="replace").encode("utf-8"))return@app.cell-def __(CONTENT, anywidget, traitlets):+def _(CONTENT, anywidget, traitlets):import numpy as npfrom pathlib import Path@@ -77,11 +77,11 @@ def __(CONTENT, anywidget, traitlets):# raises a TraitErrorBytesWritesWidget(value=CONTENT)- return BytesWritesWidget, Path, np+ return@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/marimo/_smoke_tests/issues/2526-plotly-refresh-on-data-change.py b/marimo/_smoke_tests/issues/2526-plotly-refresh-on-data-change.pyindex 728c2e163e..36da61ec7c 100644--- a/marimo/_smoke_tests/issues/2526-plotly-refresh-on-data-change.py+++ b/marimo/_smoke_tests/issues/2526-plotly-refresh-on-data-change.py@@ -1,21 +1,20 @@-#uvx --with plotly --with pandas --with 'marimo==0.9' marimo edit plotly_marimo.pyimport marimo-__generated_with = "0.9.1"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):a = mo.ui.checkbox(label="toggle to change data")areturn (a,)@app.cell-def __(a, np, px):+def _(a, np, px):x = np.array([1, 2, 3, 4]) if a.value else np.arange(3, 20)y = np.sin(x / 5)px.scatter(x=x, y=y)@@ -23,25 +22,25 @@ def __(a, np, px):@app.cell-def __(a):+def _(a):areturn@app.cell-def __(mo, px, x, y):+def _(mo, px, x, y):plot = mo.ui.plotly(px.scatter(x=x, y=y)); plotreturn (plot,)@app.cell-def __(plot):+def _(plot):plot.valuereturn@app.cell-def __():+def _():import plotly.express as pximport marimo as moimport numpy as npdiff --git a/marimo/_smoke_tests/issues/2550-search-polars.py b/marimo/_smoke_tests/issues/2550-search-polars.pyindex e13373ef81..67c3a8dc9b 100644--- a/marimo/_smoke_tests/issues/2550-search-polars.py+++ b/marimo/_smoke_tests/issues/2550-search-polars.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport pandas@@ -20,17 +20,17 @@ def __():"F": [[12, 34], [], []],})- return data, mo, pandas, pl+ return (data,)@app.cell-def __(data):+def _(data):data.to_pandas()return@app.cell-def __(data):+def _(data):datareturndiff --git a/marimo/_smoke_tests/issues/2648_file_browser_reset.py b/marimo/_smoke_tests/issues/2648_file_browser_reset.pyindex 9ddecbd639..ace6fbc20b 100644--- a/marimo/_smoke_tests/issues/2648_file_browser_reset.py+++ b/marimo/_smoke_tests/issues/2648_file_browser_reset.py@@ -1,44 +1,44 @@import marimo-__generated_with = "0.9.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):source = mo.ui.text()sourcereturn (source,)@app.cell-def __(mo, source):+def _(mo, source):mo.ui.file_browser(initial_path=source.value)return@app.cell-def __(mo):+def _(mo):from vega_datasets import datadf = data.cars()columns = df.columns.tolist()slider = mo.ui.slider(0, len(columns), label="frozen columns")slider- return columns, data, df, slider+ return columns, df, slider@app.cell-def __(columns, df, mo, slider):+def _(columns, df, mo, slider):frozen = columns[: slider.value]mo.ui.table(df, freeze_columns_left=frozen)- return (frozen,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2702-altair-deserialization.py b/marimo/_smoke_tests/issues/2702-altair-deserialization.pyindex 09356e2530..214fca4cbf 100644--- a/marimo/_smoke_tests/issues/2702-altair-deserialization.py+++ b/marimo/_smoke_tests/issues/2702-altair-deserialization.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from datetime import dateimport marimo as moimport polars as pl@@ -18,32 +18,32 @@ def __():"stock": ["a", "a", "a", "b", "b", "b"],})- return alt, date, df, mo, pl+ return alt, df, mo@app.cell-def __(alt, df):+def _(alt, df):alt.data_transformers.enable("marimo_csv")df.plot.line(x="date", y="price", color="stock")return@app.cell-def __(alt, df):+def _(alt, df):alt.data_transformers.enable("marimo_json")df.plot.line(x="date", y="price", color="stock")return@app.cell-def __(alt, df):+def _(alt, df):alt.data_transformers.enable("default")df.plot.line(x="date", y="price", color="stock")return@app.cell-def __(df, mo):+def _(df, mo):mo.ui.altair_chart(df.plot.line(x="date", y="price", color="stock"))returndiff --git a/marimo/_smoke_tests/issues/2871_timezones.py b/marimo/_smoke_tests/issues/2871_timezones.pyindex bb884b92fd..a666f373e9 100644--- a/marimo/_smoke_tests/issues/2871_timezones.py+++ b/marimo/_smoke_tests/issues/2871_timezones.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -13,7 +13,7 @@ def _():# It should appear as 2010-10-07T13:15:00.000pl.DataFrame({"timestamp": [d], "date": [d.date()]})- return d, date, datetime, pl+ return d, date, pl@app.cell@@ -38,7 +38,7 @@ def _(date, pl):})alt.Chart(data).mark_line().encode(x="Date:T", y="Value:Q").interactive()- return alt, data+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/2991-df-columns.py b/marimo/_smoke_tests/issues/2991-df-columns.pyindex 45c9d33742..8e0dcae83b 100644--- a/marimo/_smoke_tests/issues/2991-df-columns.py+++ b/marimo/_smoke_tests/issues/2991-df-columns.py@@ -1,4 +1,3 @@-# /// script# requires-python = ">=3.10"# dependencies = [@@ -10,12 +9,12 @@import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pandas as pdimport marimo as moimport numpy as np@@ -23,19 +22,19 @@ def __():@app.cell-def __(mo):+def _(mo):mo.md(r"""## Lots of columns""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md("""Set cols to 10000 to crash the frontend. Number of rows appears to have no effect.""")return@app.cell-def __(mo):+def _(mo):rows = mo.ui.number(start=1, value=10, label="rows")columns = mo.ui.number(start=1, value=50, label="cols")@@ -44,25 +43,25 @@ def __(mo):@app.cell-def __(columns, np, rows):+def _(columns, np, rows):data = np.zeros((rows.value, columns.value))return (data,)@app.cell-def __(data, pd):+def _(data, pd):df = pd.DataFrame(data, columns=[str(i) for i in range(1, data.shape[1] + 1)])return (df,)@app.cell-def __(df):+def _(df):dfreturn@app.cell-def __(mo):+def _(mo):mo.md(r"""## 20k rows, 40 columns@@ -74,18 +73,18 @@ def __(mo):@app.cell-def __(np, pd):+def _(np, pd):_data = np.random.rand(20000, 40)column_names = [f"col{i}" for i in range(40)]large_df = pd.DataFrame({col: _data[:, i] for i, col in enumerate(column_names)})large_df- return column_names, large_df+ return@app.cell-def __():+def _():# mo.ui.table(df, max_columns=None)returndiff --git a/marimo/_smoke_tests/issues/3107-dataframe-perf.py b/marimo/_smoke_tests/issues/3107-dataframe-perf.pyindex ceefe17b08..adaed2d414 100644--- a/marimo/_smoke_tests/issues/3107-dataframe-perf.py+++ b/marimo/_smoke_tests/issues/3107-dataframe-perf.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.33"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import polars as plimport numpy as npfrom typing import Tuple@@ -65,20 +65,20 @@ def __():unique_groups = df["group"].unique().to_list()return df- return Tuple, create_test_dataframe, mo, np, pl+ return create_test_dataframe, pl@app.cell-def __(create_test_dataframe):+def _(create_test_dataframe):num_rows = 10df = create_test_dataframe(num_rows)- return df, num_rows+ return (df,)@app.cell-def __(df, pl):+def _(df, pl):x = df.filter(pl.col("group") == "group2")- return (x,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/3141_update_completion.py b/marimo/_smoke_tests/issues/3141_update_completion.pyindex 41ce3d6d80..b1154397a6 100644--- a/marimo/_smoke_tests/issues/3141_update_completion.py+++ b/marimo/_smoke_tests/issues/3141_update_completion.py@@ -1,18 +1,18 @@import marimo-__generated_with = "0.9.34"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mofrom time import timereturn mo, time@app.cell-def __(mo):+def _(mo):d = mo.ui.dictionary({"run_button1": mo.ui.run_button(label="run button 1"),@@ -23,19 +23,19 @@ def __(mo):@app.cell-def __(d):+def _(d):dreturn@app.cell-def __(d, time):+def _(d, time):d.value, time()return@app.cell-def __(d, time):+def _(d, time):_t = time()for name, button in d.items():if button.value:@@ -43,18 +43,18 @@ def __(d, time):for n, b in d.items():print(button.value, n)d.value- return b, button, n, name+ return@app.cell-def __(mo):+def _(mo):run_button = mo.ui.run_button(label="single run button")run_buttonreturn (run_button,)@app.cell-def __(run_button, time):+def _(run_button, time):if run_button.value:print("Clicked run button at time ", time())returndiff --git a/marimo/_smoke_tests/issues/3142-table-in-accordion.py b/marimo/_smoke_tests/issues/3142-table-in-accordion.pyindex 07b292e79e..a31afc6bad 100644--- a/marimo/_smoke_tests/issues/3142-table-in-accordion.py+++ b/marimo/_smoke_tests/issues/3142-table-in-accordion.py@@ -1,35 +1,33 @@-import marimo-__generated_with = "0.9.34"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):table=mo.ui.table([{"col1": "hello"},{"col1": "world"}], selection="single")return (table,)@app.cell-def __(mo, table):+def _(mo, table):if table.value:val = table.value[0]["col1"]else:val = ""text=mo.ui.text(label="Select from table", value=val)-- return text, val+ return (text,)@app.cell-def __(mo, table, text):+def _(mo, table, text):mo.accordion({"fold down": mo.vstack([table, text])})returndiff --git a/marimo/_smoke_tests/issues/3187_kernel_dies.py b/marimo/_smoke_tests/issues/3187_kernel_dies.pyindex ed9252e851..cf4d220db3 100644--- a/marimo/_smoke_tests/issues/3187_kernel_dies.py+++ b/marimo/_smoke_tests/issues/3187_kernel_dies.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.4"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/issues/3564_altair_timezone.py b/marimo/_smoke_tests/issues/3564_altair_timezone.pyindex 59b64eb38e..1bf9ddba94 100644--- a/marimo/_smoke_tests/issues/3564_altair_timezone.py+++ b/marimo/_smoke_tests/issues/3564_altair_timezone.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/issues/3962-anywidget-partial-state-2.py b/marimo/_smoke_tests/issues/3962-anywidget-partial-state-2.pyindex ec69849ed6..e327b53572 100644--- a/marimo/_smoke_tests/issues/3962-anywidget-partial-state-2.py+++ b/marimo/_smoke_tests/issues/3962-anywidget-partial-state-2.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/issues/3962-anywidget-partial-state.py b/marimo/_smoke_tests/issues/3962-anywidget-partial-state.pyindex 3e45e6fa8d..ec37d64fb0 100644--- a/marimo/_smoke_tests/issues/3962-anywidget-partial-state.py+++ b/marimo/_smoke_tests/issues/3962-anywidget-partial-state.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -51,7 +51,7 @@ def _(Circle, SVG):def _(HoverWidget, mo, my_svg):w = mo.ui.anywidget(HoverWidget(svg=my_svg.as_str(), selected_id=""))[w]- return (w,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/4515_ui_id_collision.py b/marimo/_smoke_tests/issues/4515_ui_id_collision.pyindex bdc8446171..bd9087cf3e 100644--- a/marimo/_smoke_tests/issues/4515_ui_id_collision.py+++ b/marimo/_smoke_tests/issues/4515_ui_id_collision.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.9-dev12"+__generated_with = "0.15.5"app = marimo.App()@@ -21,7 +21,7 @@ def _():return slider._clone()._mime_()has_mime()- return has_mime, mo, slider+ return (slider,)@app.celldiff --git a/marimo/_smoke_tests/issues/4544_flex.py b/marimo/_smoke_tests/issues/4544_flex.pyindex 4249488d9f..fa0d5cef70 100644--- a/marimo/_smoke_tests/issues/4544_flex.py+++ b/marimo/_smoke_tests/issues/4544_flex.py@@ -1,10 +1,9 @@--import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")+@app.celldef _():import marimo as modiff --git a/marimo/_smoke_tests/issues/4548_md_max_width.py b/marimo/_smoke_tests/issues/4548_md_max_width.pyindex 8e0a26d30d..1991cbb446 100644--- a/marimo/_smoke_tests/issues/4548_md_max_width.py+++ b/marimo/_smoke_tests/issues/4548_md_max_width.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/issues/4579_mathjax_plotly.py b/marimo/_smoke_tests/issues/4579_mathjax_plotly.pyindex f15394ad74..dba10d4f47 100644--- a/marimo/_smoke_tests/issues/4579_mathjax_plotly.py+++ b/marimo/_smoke_tests/issues/4579_mathjax_plotly.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.13.0"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/issues/4624_markdown_max_width.py b/marimo/_smoke_tests/issues/4624_markdown_max_width.pyindex 3b5662541e..97292e3ec5 100644--- a/marimo/_smoke_tests/issues/4624_markdown_max_width.py+++ b/marimo/_smoke_tests/issues/4624_markdown_max_width.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.13.0"+__generated_with = "0.15.5"app = marimo.App(width="full")diff --git a/marimo/_smoke_tests/issues/4744-fixed-loading-indicator.py b/marimo/_smoke_tests/issues/4744-fixed-loading-indicator.pyindex fad7a8d693..8f4e3e68a8 100644--- a/marimo/_smoke_tests/issues/4744-fixed-loading-indicator.py+++ b/marimo/_smoke_tests/issues/4744-fixed-loading-indicator.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/issues/4746_altair_hstacks.py b/marimo/_smoke_tests/issues/4746_altair_hstacks.pyindex 0f15138e54..b1d24ddbb5 100644--- a/marimo/_smoke_tests/issues/4746_altair_hstacks.py+++ b/marimo/_smoke_tests/issues/4746_altair_hstacks.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.13.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/issues/4970-unique-transform.py b/marimo/_smoke_tests/issues/4970-unique-transform.pyindex 36136c6887..f9b767c9a7 100644--- a/marimo/_smoke_tests/issues/4970-unique-transform.py+++ b/marimo/_smoke_tests/issues/4970-unique-transform.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="columns")diff --git a/marimo/_smoke_tests/issues/643.py b/marimo/_smoke_tests/issues/643.pyindex e14e584ae6..d1fc346ef8 100644--- a/marimo/_smoke_tests/issues/643.py+++ b/marimo/_smoke_tests/issues/643.py@@ -1,51 +1,52 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.13"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):get_v, set_v = mo.state(True)get_v2, set_v2 = mo.state(True)return get_v, get_v2, set_v, set_v2@app.cell-def __(get_v, get_v2):+def _(get_v, get_v2):[get_v(), get_v2()]return@app.cell-def __(get_v, mo, set_v):+def _(get_v, mo, set_v):x = mo.ui.checkbox(get_v(), on_change=set_v)x- return x,+ return@app.cell-def __(get_v, mo, set_v):+def _(get_v, mo, set_v):y = mo.ui.checkbox(get_v(), on_change=set_v)y- return y,+ return@app.cell-def __(get_v2, mo, set_v2):+def _(get_v2, mo, set_v2):mo.ui.checkbox(get_v2(), on_change=set_v2)return@app.cell-def __(get_v2, mo, set_v2):+def _(get_v2, mo, set_v2):mo.ui.checkbox(get_v2(), on_change=set_v2)returndiff --git a/marimo/_smoke_tests/issues/846.py b/marimo/_smoke_tests/issues/846.pyindex 843ca34038..229b0ec476 100644--- a/marimo/_smoke_tests/issues/846.py+++ b/marimo/_smoke_tests/issues/846.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.4.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("This notebook covers a couple different cases for rendering plotly under different configs and with different renderers.")@@ -15,7 +15,7 @@ def __(mo):@app.cell-def __():+def _():import marimo as moimport plotly.io as pio@@ -26,19 +26,19 @@ def __():@app.cell-def __(pio):+def _(pio):pio.renderers.defaultreturn@app.cell-def __(pio):+def _(pio):pio.renderers[pio.renderers.default].configreturn@app.cell-def __(mo, pio):+def _(mo, pio):keys = list(pio.renderers.keys())@@ -53,51 +53,51 @@ def __(mo, pio):{"name": key, "config": get_config(pio.renderers[key])} for key in keys]mo.ui.table(printed_configs)- return get_config, keys, printed_configs+ return@app.cell-def __(pio):+def _(pio):pio.renderersreturn@app.cell-def __():+def _():import plotly.express as pxx_data = [1, 2, 3, 4, 5, 6]y_data = [1, 2, 3, 2, 3, 4]fig = px.scatter(x=x_data, y=y_data)- return fig, px, x_data, y_data+ return (fig,)@app.cell-def __(fig):+def _(fig):fig # Uses the default renderer "notebook"return@app.cell-def __(fig, mo):+def _(fig, mo):mo.ui.plotly(fig) # Uses the default renderer "notebook"return@app.cell-def __(fig, mo):+def _(fig, mo):mo.ui.plotly(fig, config={}) # Uses the empty configreturn@app.cell-def __(fig, mo):+def _(fig, mo):mo.ui.plotly(fig, config={"staticPlot": True}) # Uses the passed configreturn@app.cell-def __(fig, mo):+def _(fig, mo):mo.ui.plotly(fig, renderer_name="browser") # Uses a pre-defined renderererreturndiff --git a/marimo/_smoke_tests/issues/852.py b/marimo/_smoke_tests/issues/852.pyindex 87c70ba141..7d6174fe9d 100644--- a/marimo/_smoke_tests/issues/852.py+++ b/marimo/_smoke_tests/issues/852.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.9"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Bug 852@@ -18,24 +19,24 @@ def __(mo):@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pd@app.cell-def __(pd):+def _(pd):df = pd.DataFrame({"data": [912312851340981241284, None, "abc"]})df- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):table = mo.ui.table(df)table- return table,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/877.py b/marimo/_smoke_tests/issues/877.pyindex 188c182504..28fe5a59c0 100644--- a/marimo/_smoke_tests/issues/877.py+++ b/marimo/_smoke_tests/issues/877.py@@ -1,16 +1,17 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.12"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import altair as altalt.data_transformers.enable("marimo_csv")- return alt,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/881.py b/marimo/_smoke_tests/issues/881.pyindex 99fa708eb4..23622bbe3c 100644--- a/marimo/_smoke_tests/issues/881.py+++ b/marimo/_smoke_tests/issues/881.py@@ -1,17 +1,18 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.12"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import pandas as pdimport marimo as modf = pd.DataFrame({"data": [2.0]})mo.ui.table(df)- return df, mo, pd+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/924.py b/marimo/_smoke_tests/issues/924.pyindex 933834f678..0f3a78768e 100644--- a/marimo/_smoke_tests/issues/924.py+++ b/marimo/_smoke_tests/issues/924.py@@ -1,25 +1,26 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.2"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(mo):+def _(mo):mo.md("""# Scrollbar issue with iframed altairThere should be no vertical scrollbar within the iframed container.-+""")return@app.cell-def __():+def _():import micropipimport altair as alt@@ -44,7 +45,7 @@ def __():.properties(width=1820, height=780))graph- return N, alt, df, graph, micropip, mo, np, pd, x, y+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/issues/970-freeze-columns.py b/marimo/_smoke_tests/issues/970-freeze-columns.pyindex 871a6ccff3..fd2acaf27f 100644--- a/marimo/_smoke_tests/issues/970-freeze-columns.py+++ b/marimo/_smoke_tests/issues/970-freeze-columns.py@@ -1,29 +1,30 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(happiness_index, mo, pd):+def _(happiness_index, mo, pd):df = pd.read_csv(happiness_index)mo.ui.table(df,freeze_columns_left=["Country name", "Ladder score"],freeze_columns_right=["Standard error of ladder score"])- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df)return@app.cell-def __():+def _():import marimo as moimport pandas as pdhappiness_index = 'https://raw.githubusercontent.com/MainakRepositor/Datasets/master/World%20Happiness%20Data/2020.csv'diff --git a/marimo/_smoke_tests/issues/altair_bug.py b/marimo/_smoke_tests/issues/altair_bug.pyindex 60c2fffc58..8bf48668bf 100644--- a/marimo/_smoke_tests/issues/altair_bug.py+++ b/marimo/_smoke_tests/issues/altair_bug.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.1"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport altair as altfrom vega_datasets import data@@ -14,7 +15,7 @@ def __():@app.cell-def __(alt, data, mo):+def _(alt, data, mo):source = data.seattle_weather()bar = (@@ -54,29 +55,29 @@ def __(alt, data, mo):# Bug: chart_selection does not work when not false# This is due to month(date) being an aggregatation that we cannot back out.chart = mo.ui.altair_chart(_chart, chart_selection=False)- return bar, chart, source, text_max, text_min+ return (chart,)@app.cell-def __(chart):+def _(chart):chartreturn@app.cell-def __(chart):+def _(chart):chart.selectionsreturn@app.cell-def __(chart):+def _(chart):chart.valuereturn@app.cell-def __(chart):+def _(chart):chart.dataframereturndiff --git a/marimo/_smoke_tests/issues/df-conversion.py b/marimo/_smoke_tests/issues/df-conversion.pyindex edd4117873..a69573714e 100644--- a/marimo/_smoke_tests/issues/df-conversion.py+++ b/marimo/_smoke_tests/issues/df-conversion.py@@ -1,22 +1,19 @@-from __future__ import annotations-import marimo-__generated_with = "0.8.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pandas as pdimport marimo as mo-return mo, pd@app.cell-def __():+def _():data = [{"block_number": 8021365,@@ -28,13 +25,13 @@ def __():@app.cell-def __(data, mo, pd):+def _(data, mo, pd):mo.ui.table(pd.DataFrame(data))return@app.cell-def __(data, mo, pd):+def _(data, mo, pd):mo.ui.dataframe(pd.DataFrame(data))returndiff --git a/marimo/_smoke_tests/issues/key_with_period.py b/marimo/_smoke_tests/issues/key_with_period.pyindex 6f54d4edad..a58be703ff 100644--- a/marimo/_smoke_tests/issues/key_with_period.py+++ b/marimo/_smoke_tests/issues/key_with_period.py@@ -1,37 +1,38 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pd@app.cell-def __():+def _():json_list = [{"key.with.period": "value"} for _ in range(10)]- return json_list,+ return (json_list,)@app.cell-def __(json_list, mo):+def _(json_list, mo):mo.ui.table(json_list)return@app.cell-def __(json_list, mo, pd):+def _(json_list, mo, pd):mo.ui.data_explorer(pd.DataFrame(json_list))return@app.cell-def __(json_list, mo, pd):+def _(json_list, mo, pd):mo.ui.dataframe(pd.DataFrame(json_list))returndiff --git a/marimo/_smoke_tests/latex/global_defs.py b/marimo/_smoke_tests/latex/global_defs.pyindex 84743cd993..130b487d79 100644--- a/marimo/_smoke_tests/latex/global_defs.py+++ b/marimo/_smoke_tests/latex/global_defs.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/latex/latex.py b/marimo/_smoke_tests/latex/latex.pyindex 53d1a22d60..247af9f8bd 100644--- a/marimo/_smoke_tests/latex/latex.py+++ b/marimo/_smoke_tests/latex/latex.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.1"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""# Incrementing functions@@ -23,7 +24,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""\begin{align}diff --git a/marimo/_smoke_tests/layout.py b/marimo/_smoke_tests/layout.pyindex bb6dfba6c3..bea81ac6d1 100644--- a/marimo/_smoke_tests/layout.py+++ b/marimo/_smoke_tests/layout.py@@ -2,12 +2,12 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):align = mo.ui.dropdown(label="Align", options=["start", "end", "center", "stretch"])@@ -24,13 +24,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Horizontal Stack: `hstack`""")return@app.cell-def __(align, boxes, gap, justify, mo, wrap):+def _(align, boxes, gap, justify, mo, wrap):mo.hstack(boxes,align=align.value,@@ -42,13 +42,13 @@ def __(align, boxes, gap, justify, mo, wrap):@app.cell-def __(mo):+def _(mo):mo.md("""# Vertical Stack: `vstack`""")return@app.cell-def __(align, boxes, gap, mo):+def _(align, boxes, gap, mo):mo.vstack(boxes,align=align.value,@@ -58,7 +58,7 @@ def __(align, boxes, gap, mo):@app.cell-def __(mo, size):+def _(mo, size):def create_box(num):box_size = size.value + num * 10return mo.Html(@@ -67,13 +67,13 @@ def __(mo, size):boxes = [create_box(i) for i in range(1, 5)]- return boxes, create_box+ return (boxes,)@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/lazy.py b/marimo/_smoke_tests/lazy.pyindex d41d9f8bf2..9bda6507f5 100644--- a/marimo/_smoke_tests/lazy.py+++ b/marimo/_smoke_tests/lazy.py@@ -2,18 +2,18 @@import marimo-__generated_with = "0.5.2"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(0, 10)- return slider,+ return (slider,)@app.cell-def __(generate_number, mo, slider, table):+def _(generate_number, mo, slider, table):tabs = mo.ui.tabs({"First": [slider, slider.value],@@ -22,11 +22,11 @@ def __(generate_number, mo, slider, table):})tabs- return tabs,+ return@app.cell-def __(generate_number, mo, slider, table):+def _(generate_number, mo, slider, table):auto_lazy_tabs = mo.ui.tabs({"First": [slider, slider.value],@@ -36,29 +36,29 @@ def __(generate_number, mo, slider, table):lazy=True,)auto_lazy_tabs- return auto_lazy_tabs,+ return@app.cell-def __(generate_number, mo):+def _(generate_number, mo):mo.accordion({"Open me": mo.lazy(generate_number, show_loading_indicator=True)})return@app.cell-def __(generate_number, mo):+def _(generate_number, mo):mo.accordion({"Open me": generate_number}, lazy=True)return@app.cell-def __(generate_number_async, mo):+def _(generate_number_async, mo):mo.accordion({"Lazy async function": mo.lazy(generate_number_async, show_loading_indicator=True)})return@app.cell-def __(random):+def _(random):import asyncioasync def generate_number_async():print("Loading...")@@ -66,22 +66,22 @@ def __(random):print("Loaded!")num = random.randint(0, 100)return num- return asyncio, generate_number_async+ return (generate_number_async,)@app.cell-def __(random, time):+def _(random, time):def generate_number():print("Loading...")time.sleep(1)print("Loaded!")num = random.randint(0, 100)return num- return generate_number,+ return (generate_number,)@app.cell-def __():+def _():import marimo as moimport pandas as pdimport random@@ -90,7 +90,7 @@ def __():cars = vega_datasets.data.cars()table = mo.ui.table(cars)- return cars, mo, pd, random, table, time, vega_datasets+ return mo, random, table, timeif __name__ == "__main__":diff --git a/marimo/_smoke_tests/lens_test.py b/marimo/_smoke_tests/lens_test.pyindex fa4e9f0c8c..4627c28e35 100644--- a/marimo/_smoke_tests/lens_test.py+++ b/marimo/_smoke_tests/lens_test.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.85"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):from functools import partialdata = []@@ -46,17 +47,17 @@ def __(mo):})# x- return append, data, dict_template, partial, x+ return data, dict_template, x@app.cell-def __(mo, x):+def _(mo, x):mo.ui.table([{"data": "foo", "button": btn} for btn in x.values()])return@app.cell-def __(data, x):+def _(data, x):# x.value counts how many times each button has been clicked# data is a log of button clicksx.value, data@@ -64,7 +65,7 @@ def __(data, x):@app.cell-def __(dict_template, mo):+def _(dict_template, mo):composite = mo.ui.array([mo.ui.slider(1, 10),@@ -72,52 +73,50 @@ def __(dict_template, mo):mo.ui.dictionary(dict_template),])- return composite,+ return (composite,)@app.cell-def __():+def _():10return@app.cell-def __(composite):+def _(composite):composite[0], composite[1], composite[2]return@app.cell-def __(composite, mo):+def _(composite, mo):mo.accordion({"Push a button": composite[2]["0"]})return@app.cell-def __(composite):+def _(composite):composite.valuereturn-def __():- def change_printer(v):- print("changed ", v)- return change_printer,+def change_printer(v):+ print("changed ", v)@app.cell-def __(checkboxes):+def _(checkboxes):[_item for _item in checkboxes]return@app.cell-def __(change_printer, mo):+def _(mo):checkboxes = mo.ui.array([mo.ui.checkbox(False, on_change=change_printer) for i in range(5)])- return checkboxes,+ return (checkboxes,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/logs.py b/marimo/_smoke_tests/logs.pyindex 97e464a302..21163451ca 100644--- a/marimo/_smoke_tests/logs.py+++ b/marimo/_smoke_tests/logs.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/lsp/ruff_errors.py b/marimo/_smoke_tests/lsp/ruff_errors.pyindex be3370e1b1..23aed1c8fd 100644--- a/marimo/_smoke_tests/lsp/ruff_errors.py+++ b/marimo/_smoke_tests/lsp/ruff_errors.py@@ -1,13 +1,13 @@import marimo-__generated_with = "0.11.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.celldef _():import marimo as mo- return (mo,)+ return@app.cell@@ -23,92 +23,94 @@ def _():app._unparsable_cell(r"""- # fmt: off- import os- import sys- from typing import List, Dict- import random- # undefined variable- result = undefined_var + 10+ # fmt: off+ import os+ import sys+ from typing import List, Dict+ import random++ # undefined variable+ result = undefined_var + 10- # unused import- import json+ # unused import+ import json- # unused variable- unused_variable = 42+ # unused variable+ unused_variable = 42- # missing type hints- def add_numbers(a, b):- return a + b+ # missing type hints+ def add_numbers(a, b):+ return a + b- # undefined name- print(nonexistent_variable)+ # undefined name+ print(nonexistent_variable)- # too many blank lines+ # too many blank lines- # missing docstring- class MyClass:- def __init__(self):- self.value = 10+ # missing docstring+ class MyClass:+ def __init__(self):+ self.value = 10- # unused method parameter- def process_data(data, unused_param):- return data * 2+ # unused method parameter+ def process_data(data, unused_param):+ return data * 2- # variable shadowing- def shadow_test():- x = 5- for x in range(3):- print(x)+ # variable shadowing+ def shadow_test():+ x = 5+ for x in range(3):+ print(x)- # mutable default argument- def risky_function(items=[]):- items.append(1)- return items+ # mutable default argument+ def risky_function(items=[]):+ items.append(1)+ return items- # star imports- from os import *+ # star imports+ from os import *- # too many arguments- def too_many_args(a,b,c,d,e,f,g,h,i,j,k):- return a+b+ # too many arguments+ def too_many_args(a,b,c,d,e,f,g,h,i,j,k):+ return a+b- # bare except- try:- risky_operation()- except:- pass+ # bare except+ try:+ risky_operation()+ except:+ pass- # redefining built-in- list = []- str = \"hello\"- def print():- pass+ # redefining built-in+ list = []+ str = \\"hello\\"+ def print():+ pass- # missing final newline+ # missing final newline- # line too long- very_long_variable_name = \"This is an extremely long line that exceeds the recommended maximum line length and should trigger a linting warning\"+ # line too long+ very_long_variable_name = \\"This is an extremely long line that exceeds the recommended maximum line length and should trigger a linting warning\\"- # multiple statements on one line- x = 5; y = 10; z = 15+ # multiple statements on one line+ x = 5; y = 10; z = 15- # complex boolean expression- if x == True and y == False and z == True and zz == False:- pass+ # complex boolean expression+ if x == True and y == False and z == True and zz == False:+ pass- # wrong variable name style- camelCaseVariable = 123+ # wrong variable name style+ camelCaseVariable = 123- # undefined name in type annotation- def process_items(items: InvalidType) -> None:- pass+ # undefined name in type annotation+ def process_items(items: InvalidType) -> None:+ pass- # fmt: on+ # fmt: on+""",name="_")diff --git a/marimo/_smoke_tests/markdown/codeblocks.py b/marimo/_smoke_tests/markdown/codeblocks.pyindex feddc53c50..959f26fbae 100644--- a/marimo/_smoke_tests/markdown/codeblocks.py+++ b/marimo/_smoke_tests/markdown/codeblocks.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/markdown/highlight.py b/marimo/_smoke_tests/markdown/highlight.pyindex c9739b5528..c4f1483ec4 100644--- a/marimo/_smoke_tests/markdown/highlight.py+++ b/marimo/_smoke_tests/markdown/highlight.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/markdown/latex_highlighting.py b/marimo/_smoke_tests/markdown/latex_highlighting.pyindex 81c8a2c5a1..4f7068b110 100644--- a/marimo/_smoke_tests/markdown/latex_highlighting.py+++ b/marimo/_smoke_tests/markdown/latex_highlighting.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.31"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/markdown/markdown_pymdownx.py b/marimo/_smoke_tests/markdown/markdown_pymdownx.pyindex 261c9b4b64..71b8a63151 100644--- a/marimo/_smoke_tests/markdown/markdown_pymdownx.py+++ b/marimo/_smoke_tests/markdown/markdown_pymdownx.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/markdown/markdown_quotes.py b/marimo/_smoke_tests/markdown/markdown_quotes.pyindex 4a2e280c02..244000d4c0 100644--- a/marimo/_smoke_tests/markdown/markdown_quotes.py+++ b/marimo/_smoke_tests/markdown/markdown_quotes.py@@ -1,24 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.9"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md("""Markdown""")return@app.cell-def __(mo):+def _(mo):mo.md(r"""Markdown with an escaped \"""quote\"""!!""")return@app.cell-def __(mo):+def _(mo):mo.md("""Markdown with a trailing "quote"@@ -28,7 +29,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(""""Markdown" with a leading quote@@ -38,27 +39,27 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""Markdown with a trailing 'single quote'""")return@app.cell-def __(mo):+def _(mo):mo.md("""'Markdown' with a leading single quote""")return@app.cell-def __(mo):+def _(mo):mo.md("""Markdown with an triple-single '''quote'''!!""")return@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/markdown/markdown_size.py b/marimo/_smoke_tests/markdown/markdown_size.pyindex 6a1dd928b2..9cbda76514 100644--- a/marimo/_smoke_tests/markdown/markdown_size.py+++ b/marimo/_smoke_tests/markdown/markdown_size.py@@ -1,20 +1,21 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from vega_datasets import datacars = data.cars()- return cars, data+ return (cars,)@app.cell-def __(mo):+def _(mo):size = mo.ui.slider(steps=[0, 1, 2, 3],value=1,@@ -25,13 +26,13 @@ def __(mo):@app.cell-def __(mo, size, sizes):+def _(mo, size, sizes):mo.md(f"{size} **{sizes[size.value]}**")return@app.cell-def __(cars, mo):+def _(cars, mo):mo.md(f"""# kitchen sink@@ -94,7 +95,7 @@ def __(cars, mo):@app.cell-def __():+def _():{"string": "hello","int": 10,@@ -104,9 +105,9 @@ def __():@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/markdown/sane_lists.py b/marimo/_smoke_tests/markdown/sane_lists.pyindex 7d2cfe61ca..a6c72071cf 100644--- a/marimo/_smoke_tests/markdown/sane_lists.py+++ b/marimo/_smoke_tests/markdown/sane_lists.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.md("""2. hey@@ -17,7 +17,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""1. hey@@ -29,7 +29,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""1. hey@@ -41,7 +41,7 @@ def __(mo):@app.cell-def __():+def _():import marimo as moreturn (mo,)diff --git a/marimo/_smoke_tests/md.py b/marimo/_smoke_tests/md.pyindex 318953cca7..7e36278ae8 100644--- a/marimo/_smoke_tests/md.py+++ b/marimo/_smoke_tests/md.py@@ -8,24 +8,24 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""# Tables""")return@app.cell-def __(mo):+def _(mo):mo.md("""First Header | Second Header@@ -38,7 +38,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""| Tables | Are | Cool |@@ -52,13 +52,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Footnotes""")return@app.cell-def __(mo):+def _(mo):mo.md("""Here's a short footnote,[^1] and here's a longer one.[^longnote]@@ -78,13 +78,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# External links""")return@app.cell-def __(mo):+def _(mo):mo.md("""This is [an example](http://example.com/ "Title") inline link.diff --git a/marimo/_smoke_tests/media.py b/marimo/_smoke_tests/media.pyindex d1d5045726..a0451d3adb 100644--- a/marimo/_smoke_tests/media.py+++ b/marimo/_smoke_tests/media.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.33"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport requestsfrom io import BytesIO@@ -15,14 +16,14 @@ def __():@app.cell-def __(mo):+def _(mo):mic = mo.ui.microphone(label="What is your name?")mic- return mic,+ return (mic,)@app.cell-def __(mic, mo):+def _(mic, mo):mo.hstack([mo.audio(mic.value), mo.download(data=mic.value, mimetype="audio/x-wav")])@@ -30,7 +31,7 @@ def __(mic, mo):@app.cell-def __(mo):+def _(mo):# Note, chrome does not support cross-origin download, so this wont auto download until we proxy the download through the backend_src = "https://samplelib.com/lib/preview/mp3/sample-3s.mp3"mo.hstack(@@ -43,7 +44,7 @@ def __(mo):@app.cell-def __(BytesIO, base64, mo, requests):+def _(BytesIO, base64, mo, requests):_src = ("https://images.pexels.com/photos/86596/owl-bird-eyes-eagle-owl-86596.jpeg")@@ -72,11 +73,11 @@ def __(BytesIO, base64, mo, requests):),])- return base64str, image_data+ return@app.cell-def __(mo):+def _(mo):import oswith open(os.path.realpath("docs/_static/array.png"), "rb") as f:@@ -87,11 +88,11 @@ def __(mo):)mo.hstack([_image, _download])- return f, os+ return@app.cell-def __(mo):+def _(mo):mo.video(src="https://v3.cdnpk.net/videvo_files/video/free/2013-08/large_watermarked/hd0992_preview.mp4",rounded=True,@@ -100,7 +101,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.video(src="https://v3.cdnpk.net/videvo_files/video/free/2013-08/large_watermarked/hd0992_preview.mp4",rounded=True,diff --git a/marimo/_smoke_tests/mimes.py b/marimo/_smoke_tests/mimes.pyindex f8d6bd1115..5a61b11f8c 100644--- a/marimo/_smoke_tests/mimes.py+++ b/marimo/_smoke_tests/mimes.py@@ -10,18 +10,18 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return@app.cell-def __():+def _():class HTMLMime:def _mime_(self):return (@@ -31,11 +31,11 @@ def __():HTMLMime()- return HTMLMime,+ return (HTMLMime,)@app.cell-def __():+def _():class SvgMime:def _mime_(self):return (@@ -45,11 +45,11 @@ def __():SvgMime()- return SvgMime,+ return (SvgMime,)@app.cell-def __():+def _():class JSONMime:def _mime_(self):return (@@ -59,11 +59,11 @@ def __():JSONMime()- return JSONMime,+ return (JSONMime,)@app.cell-def __():+def _():class PngMime:def _mime_(self):import matplotlib.pyplot as plt@@ -86,11 +86,11 @@ def __():PngMime()- return PngMime,+ return@app.cell-def __():+def _():class CSVMime:def _mime_(self):return (@@ -100,11 +100,11 @@ def __():CSVMime()- return CSVMime,+ return (CSVMime,)@app.cell-def __():+def _():class TextMarkdownMime:def _mime_(self):return (@@ -114,11 +114,11 @@ def __():TextMarkdownMime()- return TextMarkdownMime,+ return (TextMarkdownMime,)@app.cell-def __():+def _():import altair as altimport pandas as pd@@ -137,11 +137,11 @@ def __():VegaLiteMime()- return VegaLiteMime, alt, pd+ return (VegaLiteMime,)@app.cell-def __():+def _():class UnknownMime:def _mime_(self):return (@@ -151,11 +151,11 @@ def __():UnknownMime()- return UnknownMime,+ return (UnknownMime,)@app.cell-def __(+def _(CSVMime,HTMLMime,JSONMime,@@ -186,11 +186,11 @@ def __(TextMarkdownMime(),UnknownMime(),)- return ReprMimeBundle,+ return (ReprMimeBundle,)@app.cell-def __(HTMLMime, ReprMimeBundle):+def _(HTMLMime, ReprMimeBundle):ReprMimeBundle(HTMLMime())returndiff --git a/marimo/_smoke_tests/mpl/basic_image.py b/marimo/_smoke_tests/mpl/basic_image.pyindex 1af363f4b0..dca86d1732 100644--- a/marimo/_smoke_tests/mpl/basic_image.py+++ b/marimo/_smoke_tests/mpl/basic_image.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return (mo,)+ return@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as np@@ -24,7 +24,7 @@ def __():plt.ylabel("sin(x)")plt.gca()- return np, plt, x, y+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/named_cells.py b/marimo/_smoke_tests/named_cells.pyindex 895c2b4875..9c105cdfcc 100644--- a/marimo/_smoke_tests/named_cells.py+++ b/marimo/_smoke_tests/named_cells.py@@ -1,27 +1,28 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.2.8"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.celldef display_slider(mo):slider = mo.ui.slider(1, 10)mo.md(f"Here is a slider: {slider}")- return slider,+ return@app.cell-def __(mo):+def _(mo):element = mo.ui.checkbox(False)- return element,+ return (element,)@app.celldiff --git a/marimo/_smoke_tests/nav_menus.py b/marimo/_smoke_tests/nav_menus.pyindex d3053ef16f..d2d6dc1b7b 100644--- a/marimo/_smoke_tests/nav_menus.py+++ b/marimo/_smoke_tests/nav_menus.py@@ -2,18 +2,18 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Horizontal""")return@app.cell-def __(mo):+def _(mo):mo.nav_menu({"#overview": "Overview",@@ -25,13 +25,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""-----""")return@app.cell-def __(mo):+def _(mo):mo.nav_menu({"#overview": "Overview",@@ -57,13 +57,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""# Vertical""")return@app.cell-def __(mo):+def _(mo):mo.nav_menu({"#overview": "Overview",@@ -76,13 +76,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""-----""")return@app.cell-def __(mo):+def _(mo):mo.nav_menu({"#overview": "Overview",@@ -109,9 +109,9 @@ def __(mo):@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/nb_dir.py b/marimo/_smoke_tests/nb_dir.pyindex db603bbdb6..7e3940d35d 100644--- a/marimo/_smoke_tests/nb_dir.py+++ b/marimo/_smoke_tests/nb_dir.py@@ -1,23 +1,23 @@import marimo-__generated_with = "0.8.22"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(__file__):+def _():print("__file__", __file__)return@app.cell-def __(mo):+def _(mo):print("mo.notebook_dir()", mo.notebook_dir())returndiff --git a/marimo/_smoke_tests/no_mutating.py b/marimo/_smoke_tests/no_mutating.pyindex a378005aed..6d57e1f57c 100644--- a/marimo/_smoke_tests/no_mutating.py+++ b/marimo/_smoke_tests/no_mutating.py@@ -1,36 +1,37 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):text = mo.ui.text(on_change=print)- return text,+ return (text,)@app.cell-def __(text):+def _(text):text.on_changereturn@app.cell-def __(text):+def _(text):text.value = ""return@app.cell-def __(text):+def _(text):text.on_change = ""returndiff --git a/marimo/_smoke_tests/outline.py b/marimo/_smoke_tests/outline.pyindex ec3249c56e..25e1450527 100644--- a/marimo/_smoke_tests/outline.py+++ b/marimo/_smoke_tests/outline.py@@ -2,55 +2,54 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo-return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("# Heading 1")return@app.cell-def __(mo):+def _(mo):mo.carousel([mo.md("# Carousel Heading")])return@app.cell-def __(mo):+def _(mo):mo.md("# Heading 2 \n\n Headings between carousel and tabs are detected")return@app.cell-def __(mo):+def _(mo):mo.ui.tabs({"Tab 1": mo.md("# Tabs Heading")})return@app.cell-def __(mo):+def _(mo):mo.md("# Heading 3 \n\n Headings between tabs and accordion are detected")return@app.cell-def __(mo):+def _(mo):mo.accordion({"Accordion 1": mo.md("# Accordion Heading")})return@app.cell-def __(mo):+def _(mo):mo.md("# Heading 4")returndiff --git a/marimo/_smoke_tests/output.py b/marimo/_smoke_tests/output.pyindex 000ccd5e5c..007b8f228d 100644--- a/marimo/_smoke_tests/output.py+++ b/marimo/_smoke_tests/output.py@@ -2,24 +2,24 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import time- return time,+ return (time,)@app.cell-def __(mo, time):+def _(mo, time):def loop_replace():for i in range(5):mo.output.replace(mo.md(f"Loading {i}/5"))@@ -33,53 +33,53 @@ def __(mo, time):@app.cell-def __(mo):+def _(mo):mo.md("""### Replace""")return@app.cell-def __(loop_replace, mo):+def _(loop_replace, mo):loop_replace()mo.md("Done!")return@app.cell-def __(loop_replace, mo):+def _(loop_replace, mo):loop_replace()mo.output.replace(mo.md(f"Done"))return@app.cell-def __(mo):+def _(mo):mo.md("""### Append""")return@app.cell-def __(loop_append, mo):+def _(loop_append, mo):loop_append()mo.md("Done!")return@app.cell-def __(loop_append, mo):+def _(loop_append, mo):loop_append()mo.output.append(mo.md("Done!"))return@app.cell-def __(mo):+def _(mo):mo.md("""### Clear""")return@app.cell-def __(loop_append, mo):+def _(loop_append, mo):loop_append()mo.output.append(mo.md("Done!"))mo.output.clear()@@ -87,7 +87,7 @@ def __(loop_append, mo):@app.cell-def __(loop_append, mo):+def _(loop_append, mo):loop_append()mo.output.append(mo.md("Done!"))mo.output.replace(None)@@ -95,20 +95,20 @@ def __(loop_append, mo):@app.cell-def __(mo):+def _(mo):mo.md("""### Sleep (stale)""")return@app.cell-def __(time):+def _(time):time.sleep(2)"hello"return@app.cell-def __(mo):+def _(mo):mo.output.append(mo.md("To be replaced."))mo.output.replace_at_index(mo.md("Replaced at index"), 0)returndiff --git a/marimo/_smoke_tests/packages/is_in_uv.py b/marimo/_smoke_tests/packages/is_in_uv.pyindex 15d28de7f1..f5ed94d692 100644--- a/marimo/_smoke_tests/packages/is_in_uv.py+++ b/marimo/_smoke_tests/packages/is_in_uv.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/pdb_test.py b/marimo/_smoke_tests/pdb_test.pyindex 6b1d45c82e..c0d49e78c5 100644--- a/marimo/_smoke_tests/pdb_test.py+++ b/marimo/_smoke_tests/pdb_test.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.15.2"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_smoke_tests/pdf.py b/marimo/_smoke_tests/pdf.pyindex 066125a993..2db0d1ce9c 100644--- a/marimo/_smoke_tests/pdf.py+++ b/marimo/_smoke_tests/pdf.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.21"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __():+def _():import marimo as moimport requestsimport io@@ -14,20 +15,20 @@ def __():@app.cell-def __(mo):+def _(mo):mo.md("# PDFs")return@app.cell-def __(mo):+def _(mo):page = mo.ui.number(1, 10, label="Starting page number")page- return page,+ return (page,)@app.cell-def __(mo, page):+def _(mo, page):mo.pdf(src="https://arxiv.org/pdf/2104.00282.pdf",initial_page=page.value,@@ -38,7 +39,7 @@ def __(mo, page):@app.cell-def __(io, mo, page, requests):+def _(io, mo, page, requests):downloaded = requests.get("https://arxiv.org/pdf/2104.00282.pdf")# This is still performant as it does not pass the full PDF to the frontend,# and instead creates a VirtualFile@@ -49,11 +50,11 @@ def __(io, mo, page, requests):height="60vh",)- return downloaded, pdf+ return (pdf,)@app.cell-def __(pdf):+def _(pdf):returndiff --git a/marimo/_smoke_tests/plain.py b/marimo/_smoke_tests/plain.pyindex 2a781dcaa7..5eb0d23e47 100644--- a/marimo/_smoke_tests/plain.py+++ b/marimo/_smoke_tests/plain.py@@ -7,14 +7,15 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.6.23"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import dataimport polars as pl@@ -22,32 +23,32 @@ def __():@app.cell-def __(data, pl):+def _(data, pl):df = pl.from_pandas(data.cars())df- return df,+ return (df,)@app.cell-def __(df, mo):+def _(df, mo):mo.ui.table(df)return@app.cell-def __(df, mo):+def _(df, mo):mo.plain(df)return@app.cell-def __(df, mo):+def _(df, mo):mo.hstack(["hstack", mo.vstack(["vstack", df])])return@app.cell-def __(df, mo):+def _(df, mo):mo.hstack(["hstack", mo.vstack(["vstack", mo.plain(df)])])returndiff --git a/marimo/_smoke_tests/plotly/_plotly_resampler.py b/marimo/_smoke_tests/plotly/_plotly_resampler.pyindex e23365b997..04af3bf032 100644--- a/marimo/_smoke_tests/plotly/_plotly_resampler.py+++ b/marimo/_smoke_tests/plotly/_plotly_resampler.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.11.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -46,7 +46,7 @@ def _():)fig- return df, fig, ipywidgets, n_points, np, pd, px, register_plotly_resampler+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.py b/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.pyindex 169714e49f..b43ae3ac02 100644--- a/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.py+++ b/marimo/_smoke_tests/plotly/_plotly_resampler_0_11.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.11.19"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -48,7 +48,7 @@ def _():)fig- return anywidget, df, fig, n_points, np, pd, px, register_plotly_resampler+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/plotly/fig_show_run_as_script.py b/marimo/_smoke_tests/plotly/fig_show_run_as_script.pyindex cca6654a6c..c8c72d129b 100644--- a/marimo/_smoke_tests/plotly/fig_show_run_as_script.py+++ b/marimo/_smoke_tests/plotly/fig_show_run_as_script.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App(width="full")@@ -9,7 +9,7 @@ def _():import plotly.express as pxfig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])fig.show()- return fig, px+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/polars/timezones.py b/marimo/_smoke_tests/polars/timezones.pyindex 62b830df5c..a12959b637 100644--- a/marimo/_smoke_tests/polars/timezones.py+++ b/marimo/_smoke_tests/polars/timezones.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -19,7 +19,7 @@ def _():tz_america=pl.col("no_tz").dt.replace_time_zone("America/New_York"),tz_asia=pl.col("no_tz").dt.replace_time_zone("Asia/Tokyo"),)- return datetime, df, pl, pytz+ return (df,)@app.celldiff --git a/marimo/_smoke_tests/primitives/_decimal.py b/marimo/_smoke_tests/primitives/_decimal.pyindex 5f93309ad7..8f1b4a191c 100644--- a/marimo/_smoke_tests/primitives/_decimal.py+++ b/marimo/_smoke_tests/primitives/_decimal.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/pyg_walker.py b/marimo/_smoke_tests/pyg_walker.pyindex 869e239e53..3bdac7d4be 100644--- a/marimo/_smoke_tests/pyg_walker.py+++ b/marimo/_smoke_tests/pyg_walker.py@@ -10,12 +10,12 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pandas as pdimport pygwalker as pyg@@ -24,18 +24,18 @@ def __():@app.cell-def __(pd):+def _(pd):df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv")- return df,+ return (df,)@app.cell-def __(df, mo, pyg):+def _(df, mo, pyg):walker = pyg.walk(df, kernel_computation=True)mo.Html(walker.to_html())- return walker,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/pygwalker_test.py b/marimo/_smoke_tests/pygwalker_test.pyindex 36c5174622..cc3b747110 100644--- a/marimo/_smoke_tests/pygwalker_test.py+++ b/marimo/_smoke_tests/pygwalker_test.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pygwalkerfrom vega_datasets import data@@ -13,10 +13,10 @@ def __():@app.cell-def __(data, pygwalker):+def _(data, pygwalker):df = data.iris()pygwalker.walk(df)- return (df,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/quak-demo.py b/marimo/_smoke_tests/quak-demo.pyindex b93f8a2198..13c8df8ef9 100644--- a/marimo/_smoke_tests/quak-demo.py+++ b/marimo/_smoke_tests/quak-demo.py@@ -11,35 +11,35 @@import marimo-__generated_with = "0.8.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport quakfrom vega_datasets import data- return data, mo, pl, quak+ return data, mo, quak@app.cell-def __(data):+def _(data):df = data.cars()- return df,+ return (df,)@app.cell-def __(df, mo, quak):+def _(df, mo, quak):qwidget = quak.Widget(df)w = mo.ui.anywidget(qwidget)w- return qwidget, w+ return@app.cell-def __():+def _():# w.valuereturndiff --git a/marimo/_smoke_tests/query_params.py b/marimo/_smoke_tests/query_params.pyindex 0ce38cf383..aae73576f8 100644--- a/marimo/_smoke_tests/query_params.py+++ b/marimo/_smoke_tests/query_params.py@@ -8,49 +8,49 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):query_params = mo.query_params()- return query_params,+ return (query_params,)@app.cell-def __(mo, query_params):+def _(mo, query_params):# In another cellsearch = mo.ui.text(value=query_params["search"] or "",on_change=lambda v: query_params.set("search", v),)search- return search,+ return@app.cell-def __(mo):+def _(mo):toggle = mo.ui.switch(label="Toggle me")toggle- return toggle,+ return (toggle,)@app.cell-def __(query_params, toggle):+def _(query_params, toggle):# change the value of a query param, and watch the next cell run automaticallyquery_params["has_run"] = toggle.valuereturn@app.cell-def __(mo):+def _(mo):new_value = mo.ui.text(label="Text to add")- return new_value,+ return (new_value,)@app.cell-def __(mo, new_value, query_params):+def _(mo, new_value, query_params):append_button = mo.ui.button(label="Add to query param",on_click=lambda _: query_params.append("list", new_value.value),@@ -60,30 +60,30 @@ def __(mo, new_value, query_params):on_click=lambda _: query_params.set("list", new_value.value),)mo.hstack([new_value, append_button, replace_button])- return append_button, replace_button+ return@app.cell-def __(mo, query_params):+def _(mo, query_params):items = [{"key": key, "value": str(value)}for key, value in query_params.to_dict().items()]mo.ui.table(items, selection=None, label="Query params")- return items,+ return@app.cell-def __(mo):+def _(mo):mo.md("""You can also initialized with query params. Open this URL [/?foo=1&bar=2&bar=3&baz=4](/?foo=1&bar=2&bar=3&baz=4) and restart the kernel""")return@app.cell-def __():+def _():import marimo as moimport random- return mo, random+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/raise_error_on_output.py b/marimo/_smoke_tests/raise_error_on_output.pyindex 5bc09475be..2903caf11c 100644--- a/marimo/_smoke_tests/raise_error_on_output.py+++ b/marimo/_smoke_tests/raise_error_on_output.py@@ -1,26 +1,25 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.0"+__generated_with = "0.15.5"app = marimo.App()-def __():- class Mischief:- def _mime_(self):- raise ValueError("error!")- return Mischief,[email protected]_definition+class Mischief:+ def _mime_(self):+ raise ValueError("error!")@app.cell-def __(Mischief):+def _():mischief = Mischief()- return mischief,+ return (mischief,)@app.cell-def __(mischief):+def _(mischief):mischiefreturndiff --git a/marimo/_smoke_tests/raise_exception_on_change.py b/marimo/_smoke_tests/raise_exception_on_change.pyindex 66e5dfe8c3..64930d9712 100644--- a/marimo/_smoke_tests/raise_exception_on_change.py+++ b/marimo/_smoke_tests/raise_exception_on_change.py@@ -1,28 +1,27 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.5"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)-def __():- def error(v):- raise ValueError(str(v))- return error,+def error(v):+ raise ValueError(str(v))@app.cell-def __(error, mo):+def _(mo):s = mo.ui.slider(1, 10, on_change=lambda v: error(v))s- return s,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/reactive_pytest.py b/marimo/_smoke_tests/reactive_pytest.pyindex be26f83f23..3d19c5923d 100644--- a/marimo/_smoke_tests/reactive_pytest.py+++ b/marimo/_smoke_tests/reactive_pytest.py@@ -9,46 +9,42 @@import marimo-__generated_with = "0.11.10"+__generated_with = "0.15.5"app = marimo.App()-def _():- def inc(x):- return x + 1- return (inc,)+def inc(x):+ return x + 1@app.cell-def test_answer(inc):+def test_answer():assert inc(3) == 5, "This test fails"return@app.cell-def test_sanity(inc):+def test_sanity():assert inc(3) == 4, "This test passes"return@app.cell-def _(inc, pytest):+def _(pytest):@pytest.mark.parametrize("x, y", [(3, 4), (4, 5)])def test_parameterized(x, y):assert inc(x) == y, "These tests should pass."- return (test_parameterized,)+ return-def _():- def cross_cell_fail():- assert False- return (cross_cell_fail,)+def cross_cell_fail():+ assert False@app.cell-def _(cross_cell_fail, inc, pytest):+def _(pytest):@pytest.mark.parametrize("x, y", [(3, 4), (4, 5)])def test_parameterized_collected(x, y):assert inc(x) == y, "These tests should pass."@@ -71,13 +67,7 @@ def _(cross_cell_fail, inc, pytest):class TestChild():def test_inner(self):assert True- return (- TestParent,- test_normal_regular,- test_parameterized_collected,- test_parameterized_collected2,- test_transitive_uri,- )+ return@app.cell@@ -89,14 +79,14 @@ def _():a = 2b = 5assert a + a == b- return test_orwell, test_sanity+ return@app.celldef imports():import pytestimport marimo as mo- return mo, pytest+ return (pytest,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/refresh.py b/marimo/_smoke_tests/refresh.pyindex dae7f10138..19a2383ebd 100644--- a/marimo/_smoke_tests/refresh.py+++ b/marimo/_smoke_tests/refresh.py@@ -2,41 +2,41 @@import marimo-__generated_with = "0.2.8"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport randomreturn mo, random@app.cell-def __(mo):+def _(mo):reset_button = mo.ui.button(label="Reset")reset_button- return reset_button,+ return (reset_button,)@app.cell-def __(mo, random, reset_button):+def _(mo, random, reset_button):reset_buttonmy_pick = random.randint(0, 10)mo.accordion({"My pick": my_pick})- return my_pick,+ return (my_pick,)@app.cell-def __(mo):+def _(mo):refresh = mo.ui.refresh(options=["1s", "10s", "1m", "100ms"])mo.md(f"Choose an interval to guess {refresh}")- return refresh,+ return (refresh,)@app.cell-def __(mo, my_pick, random, refresh):+def _(mo, my_pick, random, refresh):refreshguess = random.randint(0, 10)mo.stop(@@ -47,7 +47,7 @@ def __(mo, my_pick, random, refresh):mo.md(f"Not correct, your guess was {random.randint(0, 10)}").callout(kind="warn")- return guess,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/requests.py b/marimo/_smoke_tests/requests.pyindex 0632de88d0..56174c8802 100644--- a/marimo/_smoke_tests/requests.py+++ b/marimo/_smoke_tests/requests.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -22,7 +22,7 @@ def _(mo, refresh):refreshuser = mo.app_meta().request.user[user]- return (user,)+ return@app.celldiff --git a/marimo/_smoke_tests/routes.py b/marimo/_smoke_tests/routes.pyindex a6673a7fbf..0cf9485dd8 100644--- a/marimo/_smoke_tests/routes.py+++ b/marimo/_smoke_tests/routes.py@@ -8,18 +8,18 @@import marimo-__generated_with = "0.5.2"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.sidebar([mo.md("# marimo"),@@ -37,7 +37,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):def render_home():return mo.md("""<p align="center">@@ -60,11 +60,11 @@ def __(mo):</p>""")- return render_home,+ return (render_home,)@app.cell-def __(mo):+def _(mo):def render_about():return mo.md("""@@ -99,17 +99,17 @@ def __(mo):""")- return render_about,+ return (render_about,)@app.cell-def __(mo):+def _(mo):slider = mo.ui.slider(0, 100, value=20)- return slider,+ return (slider,)@app.cell-def __(mo, slider):+def _(mo, slider):def render_sales():import altair as altimport pandas as pd@@ -138,11 +138,11 @@ def __(mo, slider):{mo.as_html(mo.ui.altair_chart(chart))}""")- return render_sales,+ return (render_sales,)@app.cell-def __(mo, render_about, render_home, render_sales):+def _(mo, render_about, render_home, render_sales):mo.routes({"#/home": render_home,diff --git a/marimo/_smoke_tests/run_button.py b/marimo/_smoke_tests/run_button.pyindex ca9e90d0d6..257f253afa 100644--- a/marimo/_smoke_tests/run_button.py+++ b/marimo/_smoke_tests/run_button.py@@ -8,26 +8,26 @@import marimo-__generated_with = "0.6.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):b = mo.ui.run_button()b- return b,+ return (b,)@app.cell-def __(mo):+def _(mo):s = mo.ui.slider(1, 10)s- return s,+ return (s,)@app.cell-def __(b, mo, s):+def _(b, mo, s):mo.stop(not b.value, "Click `run` to submit the slider's value")s.value@@ -35,18 +35,18 @@ def __(b, mo, s):@app.cell-def __(b, mo):+def _(b, mo):mo.stop(not b.value)import randomrandom.randint(0, 1000)- return random,+ return@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/sandbox/git_source.py b/marimo/_smoke_tests/sandbox/git_source.pyindex 81a9c68075..d4804447ef 100644--- a/marimo/_smoke_tests/sandbox/git_source.py+++ b/marimo/_smoke_tests/sandbox/git_source.py@@ -11,21 +11,21 @@import marimo-__generated_with = "0.9.3"+__generated_with = "0.15.5"app = marimo.App()@app.celldef foo():import marimo as mo- return (mo,)+ return@app.cell-def __():+def _():import python_gcodehelp(python_gcode)- return (python_gcode,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/scale.py b/marimo/_smoke_tests/scale.pyindex d9f533a458..ac53121bb2 100644--- a/marimo/_smoke_tests/scale.py+++ b/marimo/_smoke_tests/scale.py@@ -8,25 +8,25 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# Scale""")return@app.cell-def __(mo):+def _(mo):s = mo.ui.slider(1, 10)s- return s,+ return (s,)@app.cell-def __(mo, s):+def _(mo, s):sliders_as_md = mo.md(f"""{s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} {s} """)sliders_as_tree = (s,) * 10 + (mo.ui.slider(1, 10),) + (s,) * 10@@ -56,11 +56,11 @@ def __(mo, s):"As Flat Tree": sliders_as_tree,"As Nested Tree": sliders_as_nested_tree,})- return sliders_as_md, sliders_as_nested_tree, sliders_as_tree+ return@app.cell-def __(mo):+def _(mo):b = mo.ui.button()button_as_md = mo.md(@@ -75,17 +75,17 @@ def __(mo):"As Tree": button_as_tree,})- return b, button_as_md, button_as_tree+ return@app.cell-def __(s):+def _(s):[s, s.value]return@app.cell-def __(mo):+def _(mo):t = mo.ui.text()distinct = mo.ui.array(@@ -129,16 +129,16 @@ def __(mo):)mo.hstack([same, distinct])- return distinct, same, t+ return@app.cell-def __():+def _():return@app.cell-def __(mo):+def _(mo):mo.md("""---@@ -176,9 +176,9 @@ def __(mo):@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/scripting.py b/marimo/_smoke_tests/scripting.pyindex e35518ab06..874d219e3d 100644--- a/marimo/_smoke_tests/scripting.py+++ b/marimo/_smoke_tests/scripting.py@@ -8,24 +8,24 @@import marimo-__generated_with = "0.8.14"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""hello""")return@app.cell-def __(mo):+def _(mo):mo.Html("<script>console.log(document.querySelectorAll('p')[0].textContent)</script>")returndiff --git a/marimo/_smoke_tests/scripts/logging_in_scripts.py b/marimo/_smoke_tests/scripts/logging_in_scripts.pyindex 080eb741a5..a08572299e 100644--- a/marimo/_smoke_tests/scripts/logging_in_scripts.py+++ b/marimo/_smoke_tests/scripts/logging_in_scripts.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/series_formatting.py b/marimo/_smoke_tests/series_formatting.pyindex 3e42836766..9177bb821f 100644--- a/marimo/_smoke_tests/series_formatting.py+++ b/marimo/_smoke_tests/series_formatting.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.10.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -33,7 +33,7 @@ def _(num_range, pd):# Pandas Series with namepd_named = pd.Series(list(range(num_range.value)), name="numbers")pd_named- return (pd_named,)+ return@app.cell@@ -41,7 +41,7 @@ def _(num_range, pd):# Pandas Series without namepd_unnamed = pd.Series(list(range(num_range.value)))pd_unnamed- return (pd_unnamed,)+ return@app.cell@@ -49,7 +49,7 @@ def _(num_range, pl):# Polars Series with namepl_named = pl.Series("numbers", list(range(num_range.value)))pl_named- return (pl_named,)+ return@app.cell@@ -57,7 +57,7 @@ def _(num_range, pl):# Polars Series without namepl_unnamed = pl.Series(list(range(num_range.value)))pl_unnamed- return (pl_unnamed,)+ return@app.cell@@ -65,7 +65,7 @@ def _(num_range, pl):# Polars Series with empty string namepl_empty_name = pl.Series("", list(range(num_range.value)))pl_empty_name- return (pl_empty_name,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/sidebar.py b/marimo/_smoke_tests/sidebar.pyindex 9d9f3ec093..0e968b8ed3 100644--- a/marimo/_smoke_tests/sidebar.py+++ b/marimo/_smoke_tests/sidebar.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.10.17"+__generated_with = "0.15.5"app = marimo.App(width="full")diff --git a/marimo/_smoke_tests/slides.py b/marimo/_smoke_tests/slides.pyindex 15c1db0a2b..e05ea057ff 100644--- a/marimo/_smoke_tests/slides.py+++ b/marimo/_smoke_tests/slides.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.11.31"+__generated_with = "0.15.5"app = marimo.App(layout_file="layouts/slides.slides.json")@@ -47,7 +47,7 @@ def _(pd):def _(df, mo):table = mo.ui.table(df, label="Wide Iris Data in a table")table- return (table,)+ return@app.cell@@ -59,7 +59,7 @@ def _(alt, df, mo):label="Iris Data in chart",)chart- return (chart,)+ return@app.celldiff --git a/marimo/_smoke_tests/sql.py b/marimo/_smoke_tests/sql.pyindex c2319d7595..6872153c7b 100644--- a/marimo/_smoke_tests/sql.py+++ b/marimo/_smoke_tests/sql.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.11.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -36,11 +36,11 @@ def _(data, mo):cars = data.cars()cylinders = mo.ui.slider.from_series(cars["Cylinders"])cylinders- return cars, cylinders+ return (cylinders,)@app.cell-def _(cars, cylinders, mo):+def _(cylinders, mo):df = mo.sql(f"""SELECT "Name", "Miles_per_Gallon", "Cylinders", "Horsepower"@@ -72,11 +72,11 @@ def _(mo):@app.celldef _(data):airports = data.airports()- return (airports,)+ return@app.cell-def _(airports, mo):+def _(mo):less_airports = mo.sql(f"""select * from airports limit 2@@ -163,7 +163,7 @@ def _(duckdb, job_title, sheet):@app.cell-def _(cars, mo):+def _(mo):grouped_cars_by_origin = mo.sql(f"""SELECT "Origin", COUNT(*) AS "Count"@@ -172,7 +172,7 @@ def _(cars, mo):LIMIT 100""")- return (grouped_cars_by_origin,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/sql/dbapi_sqlite.py b/marimo/_smoke_tests/sql/dbapi_sqlite.pyindex b3741781cc..aeb295e918 100644--- a/marimo/_smoke_tests/sql/dbapi_sqlite.py+++ b/marimo/_smoke_tests/sql/dbapi_sqlite.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -35,9 +35,8 @@ def _(sqlite3):return (conn,)-@app.cell-def _(conn, mo, test):+def _(conn, mo):_df = mo.sql(f"""select * FROM testdiff --git a/marimo/_smoke_tests/sql/duckdb_engine.py b/marimo/_smoke_tests/sql/duckdb_engine.pyindex 9a170734d7..9aa611cb78 100644--- a/marimo/_smoke_tests/sql/duckdb_engine.py+++ b/marimo/_smoke_tests/sql/duckdb_engine.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -16,7 +16,7 @@ def _():connection_one = duckdb.connect("one.db")connection_two = duckdb.connect("two.db")- return connection_one, connection_two, duckdb+ return connection_one, connection_two@app.cell@@ -28,7 +28,7 @@ def _(connection_one, mo):""",engine=connection_one)- return (numbers,)+ return@app.cell@@ -40,7 +40,7 @@ def _(connection_two, mo):""",engine=connection_two)- return (other_numbers,)+ return@app.celldiff --git a/marimo/_smoke_tests/sql/duckdb_tokenize.py b/marimo/_smoke_tests/sql/duckdb_tokenize.pyindex 29141b6a8d..569b3aa5e6 100644--- a/marimo/_smoke_tests/sql/duckdb_tokenize.py+++ b/marimo/_smoke_tests/sql/duckdb_tokenize.py@@ -6,14 +6,15 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport duckdbimport re@@ -21,7 +22,7 @@ def __():@app.cell-def __(mo):+def _(mo):default_code = """CREATE TABLE-- This is a comment@@ -31,26 +32,26 @@ def __(mo):"""code = mo.ui.code_editor(language="sql", value=default_code.strip())code- return code, default_code+ return (code,)@app.cell-def __(code, duckdb):+def _(code, duckdb):statements = duckdb.extract_statements(code.value)print("Number of statements: " + str(len(statements)))print(duckdb.tokenize(code.value))- return statements,+ return@app.cell-def __(code, find_created_tables):+def _(code, find_created_tables):find_created_tables(code.value)return@app.cell-def __(re):+def _(re):def find_created_tables(sql_statement: str) -> list[str]:"""Find the tables created in a SQL statement.@@ -130,7 +131,7 @@ def __(re):i += 1return created_tables- return find_created_tables,+ return (find_created_tables,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/sql/ibis_backend.py b/marimo/_smoke_tests/sql/ibis_backend.pyindex 078cf23e40..c40aedbe57 100644--- a/marimo/_smoke_tests/sql/ibis_backend.py+++ b/marimo/_smoke_tests/sql/ibis_backend.py@@ -15,7 +15,7 @@import marimo-__generated_with = "0.13.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -58,7 +58,7 @@ def _(ibis, pa):@app.cell-def _(con, mo, my_data, my_db):+def _(con, mo):_df = mo.sql(f"""SELECT * FROM my_db.my_data@@ -111,7 +111,7 @@ def _(data, pyspark_conn):@app.cell-def _(mo, my_data, pyspark_conn):+def _(mo, pyspark_conn):_df = mo.sql(f"""SELECT * FROM my_datadiff --git a/marimo/_smoke_tests/sql/ibis_backend_catalog.py b/marimo/_smoke_tests/sql/ibis_backend_catalog.pyindex 877e6244e3..1e086eca3f 100644--- a/marimo/_smoke_tests/sql/ibis_backend_catalog.py+++ b/marimo/_smoke_tests/sql/ibis_backend_catalog.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.14.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/sql/iceberg_catalog.py b/marimo/_smoke_tests/sql/iceberg_catalog.pyindex a7249c7902..ff329fbb33 100644--- a/marimo/_smoke_tests/sql/iceberg_catalog.py+++ b/marimo/_smoke_tests/sql/iceberg_catalog.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.13.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/sql/limits.py b/marimo/_smoke_tests/sql/limits.pyindex 0ad1565e65..db211a72d9 100644--- a/marimo/_smoke_tests/sql/limits.py+++ b/marimo/_smoke_tests/sql/limits.py@@ -5,26 +5,27 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md(r"""## Small table""")return@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE small_table AS SELECT * FROM range(1000)@@ -34,7 +35,7 @@ def __(mo):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table;@@ -44,7 +45,7 @@ def __(mo, small_table):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table LIMIT 10;@@ -54,7 +55,7 @@ def __(mo, small_table):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table LIMIT 1000;@@ -64,7 +65,7 @@ def __(mo, small_table):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table LIMIT 300;@@ -74,7 +75,7 @@ def __(mo, small_table):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table LIMIT 301;@@ -84,7 +85,7 @@ def __(mo, small_table):@app.cell-def __(mo, small_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM small_table LIMIT 1100;@@ -94,13 +95,13 @@ def __(mo, small_table):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Large table""")return@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE large_table AS SELECT * FROM range(30_000);@@ -110,7 +111,7 @@ def __(mo):@app.cell-def __(large_table, mo):+def _(mo):_df = mo.sql(f"""SELECT * FROM large_table;@@ -120,7 +121,7 @@ def __(large_table, mo):@app.cell-def __(large_table, mo):+def _(mo):_df = mo.sql(f"""SELECT * FROM large_table LIMIT 25_000;@@ -130,7 +131,7 @@ def __(large_table, mo):@app.cell-def __(large_table, mo):+def _(mo):_df = mo.sql(f"""SELECT * FROM large_table LIMIT 20_000;diff --git a/marimo/_smoke_tests/sql/local_db_deps.py b/marimo/_smoke_tests/sql/local_db_deps.pyindex 4fad5fba35..6ca7b7a899 100644--- a/marimo/_smoke_tests/sql/local_db_deps.py+++ b/marimo/_smoke_tests/sql/local_db_deps.py@@ -1,27 +1,27 @@import marimo-__generated_with = "0.9.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""ATTACH 'my_db.db' as my_db;""")- return (my_db,)+ return@app.cell-def __(mo):+def _(mo):_df = mo.sql(f"""CREATE OR REPLACE TABLE my_db.my_table as (SELECT 42);@@ -31,7 +31,7 @@ def __(mo):@app.cell-def __(mo, my_db, my_table):+def _(mo):_df = mo.sql(f"""SELECT * FROM my_db.main.my_table LIMIT 100diff --git a/marimo/_smoke_tests/sql/polars_sql.py b/marimo/_smoke_tests/sql/polars_sql.pyindex ca32c7a5e5..726ea4f630 100644--- a/marimo/_smoke_tests/sql/polars_sql.py+++ b/marimo/_smoke_tests/sql/polars_sql.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.10.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -22,7 +22,7 @@ def _():import connectorxuri = os.environ.get("DATABASE_URL")- return connectorx, os, pl, pyarrow, uri+ return pl, uri@app.cell@@ -32,7 +32,7 @@ def _(mo, pl, uri):df = pl.read_database_uri(query=query, uri=uri)df- return df, query+ return@app.celldiff --git a/marimo/_smoke_tests/sql/redshift_example.py b/marimo/_smoke_tests/sql/redshift_example.pyindex 6db90dc869..134abe2312 100644--- a/marimo/_smoke_tests/sql/redshift_example.py+++ b/marimo/_smoke_tests/sql/redshift_example.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.13.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/sql/sql_alchemy.py b/marimo/_smoke_tests/sql/sql_alchemy.pyindex 1eba51eaf0..a74e77d831 100644--- a/marimo/_smoke_tests/sql/sql_alchemy.py+++ b/marimo/_smoke_tests/sql/sql_alchemy.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.16"+__generated_with = "0.15.5"app = marimo.App()@@ -44,7 +44,7 @@ def _(Mapped, declarative_base, mapped_column, sa):# Create tablesBase.metadata.create_all(engine)- return Base, User, engine+ return User, engine@app.cell@@ -59,7 +59,7 @@ def _(Session, User, engine):]_session.add_all(users)_session.commit()- return (users,)+ return@app.cell(hide_code=True)@@ -92,7 +92,7 @@ def _(Session, User, engine, mo, pl):),])- return all_users, df+ return@app.cell(hide_code=True)@@ -113,7 +113,7 @@ def _(Session, User, engine, mo):mo.ui.table([{"Name": u.name, "Age": u.age} for u in young_users], selection=None)- return (young_users,)+ return@app.cell(hide_code=True)@@ -139,7 +139,7 @@ def _(Session, User, engine, sa):("Youngest", age_stats.min_age),("Oldest", age_stats.max_age),]- return (age_stats,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/sql/sql_alchemy_engine.py b/marimo/_smoke_tests/sql/sql_alchemy_engine.pyindex 0f329d4050..4a640f27b9 100644--- a/marimo/_smoke_tests/sql/sql_alchemy_engine.py+++ b/marimo/_smoke_tests/sql/sql_alchemy_engine.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -19,7 +19,7 @@ def _(mo):@app.celldef _():from sqlalchemy import text, create_engine- return create_engine, text+ return (create_engine,)@app.cell(hide_code=True)@@ -29,7 +29,7 @@ def _(mo):@app.cell-def _(create_engine, mo, products):+def _(create_engine, mo):# Create an in-memory SQLite databasesqlite = create_engine("sqlite:///:memory:")@@ -59,11 +59,11 @@ def _(create_engine, mo, products):""",engine=sqlite,)- return products, sqlite+ return (sqlite,)@app.cell-def _(mo, products, sqlite):+def _(mo, sqlite):products_df = mo.sql(f"""SELECT name, price, category@@ -105,7 +105,7 @@ def _(mo):@app.cell-def _(mo, products, sqlite):+def _(mo, sqlite):_df = mo.sql(f"""-- Category summary@@ -135,7 +135,7 @@ def _(mo):@app.cell-def _(mo, price_threshold, products, sqlite):+def _(mo, price_threshold, sqlite):mo.sql(f"""SELECT name, price, category@@ -165,7 +165,7 @@ def _(mo):value=os.getenv("POSTGRES_URL") or "",)psql_url- return os, psql_url+ return (psql_url,)@app.cell@@ -180,7 +180,7 @@ def _(create_engine, mo, psql_url):@app.cell-def _(information_schema, mo, my_postgres, tables):+def _(mo, my_postgres):_df = mo.sql(f"""SELECT table_namediff --git a/marimo/_smoke_tests/sql/sqlmodel_engine.py b/marimo/_smoke_tests/sql/sqlmodel_engine.pyindex 275d5dca94..fe1d50597a 100644--- a/marimo/_smoke_tests/sql/sqlmodel_engine.py+++ b/marimo/_smoke_tests/sql/sqlmodel_engine.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.11.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -21,7 +21,7 @@ app = marimo.App(width="medium")def _():import altair as altimport marimo as mo- return alt, mo+ return (mo,)@app.cell(hide_code=True)@@ -33,7 +33,7 @@ def _(mo):@app.celldef _():from sqlmodel import text, create_engine- return create_engine, text+ return (create_engine,)@app.cell(hide_code=True)@@ -43,7 +43,7 @@ def _(mo):@app.cell-def _(create_engine, mo, products):+def _(create_engine, mo):# Create an in-memory SQLite databasesqlite = create_engine("sqlite:///:memory:")@@ -73,11 +73,11 @@ def _(create_engine, mo, products):""",engine=sqlite,)- return products, sqlite+ return (sqlite,)@app.cell-def _(mo, products, sqlite):+def _(mo, sqlite):products_df = mo.sql(f"""SELECT name, price, category@@ -119,7 +119,7 @@ def _(mo):@app.cell-def _(mo, products, sqlite):+def _(mo, sqlite):_df = mo.sql(f"""-- Category summary@@ -149,7 +149,7 @@ def _(mo):@app.cell-def _(mo, price_threshold, products, sqlite):+def _(mo, price_threshold, sqlite):_df = mo.sql(f"""SELECT name, price, category@@ -179,7 +179,7 @@ def _(mo):value=os.getenv("POSTGRES_URL") or "",)psql_url- return os, psql_url+ return (psql_url,)@app.cell@@ -192,11 +192,11 @@ def _(create_engine, mo, psql_url):# Create a PostgreSQL databasemy_postgres = create_engine(normalized_url)- return my_postgres, normalized_url+ return (my_postgres,)@app.cell-def _(information_schema, mo, my_postgres, tables):+def _(mo, my_postgres):_df = mo.sql(f"""SELECT table_name@@ -220,7 +220,7 @@ def _(connection, mo):@app.cell-def _(mo, products, sqlite):+def _(mo, sqlite):_df = mo.sql(f"""SELECT * FROM products LIMIT 100@@ -238,11 +238,11 @@ def _(mo):FROM 'hf://datasets/julien040/hacker-news-posts/story.parquet' LIMIT 500""")- return (foo,)+ return@app.cell-def _(foo, mo):+def _(mo):_df = mo.sql(f"""SELECT "id" FROM memory.main.foo LIMIT 100diff --git a/marimo/_smoke_tests/state.py b/marimo/_smoke_tests/state.pyindex 7fdb7d62cb..16675cb113 100644--- a/marimo/_smoke_tests/state.py+++ b/marimo/_smoke_tests/state.py@@ -5,82 +5,83 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.4"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import math- return math,+ return (math,)@app.cell-def __():+def _():import random- return random,+ return@app.cell-def __():+def _():import time- return time,+ return@app.cell-def __(mo):+def _(mo):get_state, set_state = mo.state(0)return get_state, set_state@app.cell-def __(get_state, set_state):+def _(get_state, set_state):# No self-loops: shouldn't be a cycleset_state(get_state())return@app.cell-def __(get_state):+def _(get_state):get_state()return@app.cell-def __(mo, set_state):+def _(mo, set_state):_on_click = lambda _: set_state(lambda v: v + 1)button = mo.ui.button(value=0, on_click=_on_click)button- return button,+ return@app.cell-def __(mo):+def _(mo):# tie two number components togetherget_angle, set_angle = mo.state(0)return get_angle, set_angle@app.cell-def __(get_angle, mo, set_angle):+def _(get_angle, mo, set_angle):degrees = mo.ui.number(0, 360, step=1, value=get_angle(), on_change=set_angle, label="degrees")- return degrees,+ return (degrees,)@app.cell-def __(get_angle, math, mo, set_angle):+def _(get_angle, math, mo, set_angle):radians = mo.ui.number(0,2*math.pi,@@ -89,11 +90,11 @@ def __(get_angle, math, mo, set_angle):on_change=lambda v: set_angle(v * 180 / math.pi),label="radians")- return radians,+ return (radians,)@app.cell-def __(degrees, radians):+def _(degrees, radians):degrees, radiansreturndiff --git a/marimo/_smoke_tests/stats.py b/marimo/_smoke_tests/stats.pyindex 49f788a73d..c10885fd7a 100644--- a/marimo/_smoke_tests/stats.py+++ b/marimo/_smoke_tests/stats.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.29"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):_stats = [mo.stat("$100", label="Revenue", caption="+ 10%", direction="increase"),mo.stat(@@ -26,7 +27,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):_stats = [mo.stat("$100",diff --git a/marimo/_smoke_tests/status.py b/marimo/_smoke_tests/status.pyindex 78fcee5501..6acde7788d 100644--- a/marimo/_smoke_tests/status.py+++ b/marimo/_smoke_tests/status.py@@ -8,41 +8,41 @@import marimo-__generated_with = "0.8.11"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport timereturn mo, time@app.cell-def __(mo):+def _(mo):sleep_time_radio = mo.ui.radio([".01", ".1", "1"], label="Sleep time", value=".01")sleep_time_radio- return sleep_time_radio,+ return (sleep_time_radio,)@app.cell-def __(sleep_time_radio):+def _(sleep_time_radio):sleep_time = float(sleep_time_radio.value)- return sleep_time,+ return (sleep_time,)@app.cell-def __(mo):+def _(mo):disabled_switch = mo.ui.switch(label="Disable progress bar")disabled_switch- return disabled_switch,+ return (disabled_switch,)@app.cell-def __(disabled_switch, mo, sleep_time, time):+def _(disabled_switch, mo, sleep_time, time):for _ in mo.status.progress_bar(range(10),title="Loading",@@ -54,7 +54,7 @@ def __(disabled_switch, mo, sleep_time, time):@app.cell-def __(disabled_switch, mo, sleep_time, time):+def _(disabled_switch, mo, sleep_time, time):for _ in mo.status.progress_bar(range(10),title="Loading",@@ -68,7 +68,7 @@ def __(disabled_switch, mo, sleep_time, time):@app.cell-def __(disabled_switch, mo, sleep_time, time):+def _(disabled_switch, mo, sleep_time, time):with mo.status.progress_bar(title="Loading",subtitle="Please wait",@@ -78,11 +78,11 @@ def __(disabled_switch, mo, sleep_time, time):for _ in range(10):time.sleep(sleep_time)bar.update()- return bar,+ return@app.cell-def __(mo, sleep_time, time):+def _(mo, sleep_time, time):with mo.status.spinner(title="Loading...", remove_on_exit=True) as _spinner:time.sleep(0.1)_spinner.update("Almost done")@@ -91,7 +91,7 @@ def __(mo, sleep_time, time):@app.cell-def __(mo, sleep_time, time):+def _(mo, sleep_time, time):with mo.status.spinner(title="Loading...", remove_on_exit=True) as _spinner:time.sleep(sleep_time)_spinner.update("Almost done")@@ -101,14 +101,14 @@ def __(mo, sleep_time, time):@app.cell-def __(disabled_switch, mo, sleep_time, time):+def _(disabled_switch, mo, sleep_time, time):# Fast updates should be debounced for performancefor i in mo.status.progress_bar(range(1000),disabled=disabled_switch.value,):time.sleep(sleep_time / 10)- return i,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/stdin.py b/marimo/_smoke_tests/stdin.pyindex 89a9ebdf3c..2ceb4751e6 100644--- a/marimo/_smoke_tests/stdin.py+++ b/marimo/_smoke_tests/stdin.py@@ -5,38 +5,39 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.77"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():value = input("what is your name?")- return value,+ return (value,)@app.cell-def __(mo, value):+def _(mo, value):mo.md(f"## 👋 Hi {value}")return@app.cell-def __():+def _():print('hi')return@app.cell-def __():+def _():print('there')returndiff --git a/marimo/_smoke_tests/stop.py b/marimo/_smoke_tests/stop.pyindex bf42ce462c..2c322b275e 100644--- a/marimo/_smoke_tests/stop.py+++ b/marimo/_smoke_tests/stop.py@@ -5,28 +5,29 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.1"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moimport time- return mo, time+ return (mo,)@app.cell-def __(mo):+def _(mo):secret = mo.ui.text(label="Type a valid password: ")secret- return secret,+ return (secret,)@app.cell-def __(mo, secret):+def _(mo, secret):# Validation 1# This cell just depends on the secretmo.stop(@@ -34,11 +35,11 @@ def __(mo, secret):)success_1 = True- return success_1,+ return (success_1,)@app.cell-def __(mo, secret):+def _(mo, secret):# Validation 2# This cell just depends on the secretmo.stop(@@ -46,11 +47,11 @@ def __(mo, secret):)success_2 = True- return success_2,+ return (success_2,)@app.cell-def __(mo, secret, success_1):+def _(mo, secret, success_1):# Validation 3# This cell depends on the secret and first validationmo.stop(@@ -59,11 +60,11 @@ def __(mo, secret, success_1):)success_3 = True- return success_3,+ return (success_3,)@app.cell-def __(mo, success_1, success_2, success_3):+def _(mo, success_1, success_2, success_3):# This depends on all the validations, and not the secret_success = success_1 and success_2 and success_3mo.stop(not _success)diff --git a/marimo/_smoke_tests/structures.py b/marimo/_smoke_tests/structures.pyindex 69cf11af57..d5d12df6b1 100644--- a/marimo/_smoke_tests/structures.py+++ b/marimo/_smoke_tests/structures.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.12.4"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -31,7 +31,7 @@ def _(mo, x):"time": datetime.time(1, 2, 3),}]- return (datetime,)+ return@app.cell@@ -48,7 +48,7 @@ def _():random_data[f"key_{i}"].extend(random.sample(range(100), 5))random_data- return defaultdict, format_structure, i, random, random_data+ return@app.cell@@ -59,7 +59,7 @@ def _():CustomList(1)- return (CustomList,)+ return@app.celldiff --git a/marimo/_smoke_tests/table_urls.py b/marimo/_smoke_tests/table_urls.pyindex 67786a9151..9f03b82bc4 100644--- a/marimo/_smoke_tests/table_urls.py+++ b/marimo/_smoke_tests/table_urls.py@@ -5,20 +5,21 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.ui.table([{diff --git a/marimo/_smoke_tests/tables/big_ints.py b/marimo/_smoke_tests/tables/big_ints.pyindex 26a70b9dd6..038d4d680d 100644--- a/marimo/_smoke_tests/tables/big_ints.py+++ b/marimo/_smoke_tests/tables/big_ints.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.7"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/booleans.py b/marimo/_smoke_tests/tables/booleans.pyindex bb4eaa3c6a..31cee8b167 100644--- a/marimo/_smoke_tests/tables/booleans.py+++ b/marimo/_smoke_tests/tables/booleans.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.11.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/columnar_tables.py b/marimo/_smoke_tests/tables/columnar_tables.pyindex 8df0562581..6a3d6a36ae 100644--- a/marimo/_smoke_tests/tables/columnar_tables.py+++ b/marimo/_smoke_tests/tables/columnar_tables.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/complex_types.py b/marimo/_smoke_tests/tables/complex_types.pyindex 978d6b5a10..4aaba830e1 100644--- a/marimo/_smoke_tests/tables/complex_types.py+++ b/marimo/_smoke_tests/tables/complex_types.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.14.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/dictionary_table.py b/marimo/_smoke_tests/tables/dictionary_table.pyindex f304fb8da5..5fc09d2718 100644--- a/marimo/_smoke_tests/tables/dictionary_table.py+++ b/marimo/_smoke_tests/tables/dictionary_table.py@@ -5,28 +5,29 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.8.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import osimport marimo as moreturn mo, os@app.cell-def __(mo, os):+def _(mo, os):v = mo.ui.table(dict(os.environ))v- return v,+ return (v,)@app.cell-def __(mo):+def _(mo):mo.ui.table({"a": 1,@@ -40,7 +41,7 @@ def __(mo):@app.cell-def __(v):+def _(v):v.valuereturndiff --git a/marimo/_smoke_tests/tables/ibis_example.py b/marimo/_smoke_tests/tables/ibis_example.pyindex a27962a590..6f54d1f5fc 100644--- a/marimo/_smoke_tests/tables/ibis_example.py+++ b/marimo/_smoke_tests/tables/ibis_example.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.9.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moreturn (mo,)@app.cell-def __(mo):+def _(mo):import ibismemtable = ibis.memtable(@@ -26,23 +26,23 @@ def __(mo):)table = mo.ui.table(memtable, page_size=5)- return ibis, memtable, table+ return (table,)@app.cell-def __(table):+def _(table):tablereturn@app.cell-def __(mo, table):+def _(mo, table):mo.ui.table(table.value)return@app.cell-def __(table):+def _(table):table.valuereturndiff --git a/marimo/_smoke_tests/tables/ibis_interactive.py b/marimo/_smoke_tests/tables/ibis_interactive.pyindex 964fba4f97..1dbb3f7379 100644--- a/marimo/_smoke_tests/tables/ibis_interactive.py+++ b/marimo/_smoke_tests/tables/ibis_interactive.py@@ -1,45 +1,45 @@import marimo-__generated_with = "0.8.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport numpy as np- return mo, np, pl+ return (mo,)@app.cell-def __(mo):+def _(mo):interactive = mo.ui.checkbox(label="Interactive", value=False)interactive- return interactive,+ return (interactive,)@app.cell-def __(interactive):+def _(interactive):import ibisibis.options.interactive = interactive.valuef"interactive: {ibis.options.interactive}"- return ibis,+ return (ibis,)@app.cell-def __(execution_timer, ibis):+def _(execution_timer, ibis):# This should be 200-300ms (lazy)with execution_timer("ibis.read_parquet"):ibis_table = ibis.read_parquet("s3://gbif-open-data-us-east-1/occurrence/2023-04-01/occurrence.parquet/000000",)- return ibis_table,+ return (ibis_table,)@app.cell-def __(execution_timer, ibis_table):+def _(execution_timer, ibis_table):# Takes a while, loads data into memory when `ibis.options.interactive = True`with execution_timer("ibis_table"):print(ibis_table)@@ -47,22 +47,22 @@ def __(execution_timer, ibis_table):@app.cell-def __(ibis_table):+def _(ibis_table):# Takes a while, loads data into memory when `ibis.options.interactive = True`ibis_tablereturn@app.cell-def __(execution_timer, ibis_table):+def _(execution_timer, ibis_table):# This should be fast (lazy)with execution_timer("t.head(10)"):ibis_head = ibis_table.head(10)- return ibis_head,+ return@app.cell(hide_code=True)-def __():+def _():import time@@ -85,7 +85,7 @@ def __():print(f"\033[91m[SLOW]\033[0m {self.name} time: {duration} seconds")- return execution_timer, time+ return (execution_timer,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/tables/images.py b/marimo/_smoke_tests/tables/images.pyindex 3931588a38..14b963ce2a 100644--- a/marimo/_smoke_tests/tables/images.py+++ b/marimo/_smoke_tests/tables/images.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.30"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -33,7 +33,7 @@ def _():)df- return Image, df, io, load_image, pd, pl, requests+ return Image, df, io, requests@app.celldiff --git a/marimo/_smoke_tests/tables/lazy.py b/marimo/_smoke_tests/tables/lazy.pyindex 217664e62a..212d760ad0 100644--- a/marimo/_smoke_tests/tables/lazy.py+++ b/marimo/_smoke_tests/tables/lazy.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport polars as plimport numpy as np@@ -13,13 +13,13 @@ def __():@app.cell-def __(mo):+def _(mo):mo.md(r"""# Lazy polars""")return@app.cell-def __(execution_timer, np, pl):+def _(execution_timer, np, pl):lazy_df = pl.LazyFrame({"A": np.random.randint(0, 100, size=100000000),@@ -29,40 +29,40 @@ def __(execution_timer, np, pl):with execution_timer("print(lazy_df)"):print(lazy_df)lazy_df- return lazy_df,+ return (lazy_df,)@app.cell-def __(lazy_df):+def _(lazy_df):polars_df = lazy_df.collect()polars_df- return polars_df,+ return (polars_df,)@app.cell-def __(mo):+def _(mo):mo.md(r"""# Lazy ibis""")return@app.cell-def __():+def _():import ibis- return ibis,+ return (ibis,)@app.cell-def __(execution_timer, ibis):+def _(execution_timer, ibis):# This should be 200-300ms (lazy)with execution_timer("ibis.read_parquet"):ibis_table = ibis.read_parquet("s3://gbif-open-data-us-east-1/occurrence/2023-04-01/occurrence.parquet/000000",)- return ibis_table,+ return (ibis_table,)@app.cell-def __(execution_timer, ibis, ibis_table, mo):+def _(execution_timer, ibis, ibis_table, mo):# This should be slow, needs to load to printibis.options.interactive = Falsewith execution_timer("as_html, interactive = False"):@@ -71,7 +71,7 @@ def __(execution_timer, ibis, ibis_table, mo):@app.cell-def __(execution_timer, ibis, ibis_table, mo):+def _(execution_timer, ibis, ibis_table, mo):# This should be slow, needs to load to printibis.options.interactive = Truewith execution_timer("as_html, interactive = True"):@@ -81,7 +81,7 @@ def __(execution_timer, ibis, ibis_table, mo):@app.cell-def __(execution_timer, ibis_table):+def _(execution_timer, ibis_table):# This should be fast (lazy)with execution_timer("t.head(10)"):_private_var = ibis_table.head(10)@@ -93,11 +93,11 @@ def __(execution_timer, ibis_table):# This should be ~300-500mswith execution_timer("t.count().execute()"):count = ibis_table.count().execute()- return count, ibis_head+ return@app.cell-def __(execution_timer, ibis):+def _(execution_timer, ibis):def time_things(data):# This should be fastwith execution_timer("type"):@@ -127,25 +127,25 @@ def __(execution_timer, ibis):with execution_timer("to_sql"):if "ibis" in str(type(tm)).lower():ibis.to_sql(tm.take(100, 0).take(10, 0).data.count())- return time_things,+ return (time_things,)@app.cell-def __(ibis_table, time_things):+def _(ibis_table, time_things):# Ibistime_things(ibis_table)return@app.cell-def __(polars_df, time_things):+def _(polars_df, time_things):# Polarstime_things(polars_df)return@app.cell-def __(execution_timer, ibis_table, mo):+def _(execution_timer, ibis_table, mo):# This takes a while (runs a count(*) with no limit)with execution_timer("mo.ui.dataframe"):_df_viewer = mo.ui.dataframe(ibis_table)@@ -154,7 +154,7 @@ def __(execution_timer, ibis_table, mo):@app.cell-def __(execution_timer, ibis_table, mo):+def _(execution_timer, ibis_table, mo):# This takes a while (runs a count(*) with no limit)with execution_timer("mo.ui.dataframe(limit=10)"):_df_viewer = mo.ui.dataframe(ibis_table, limit=10)@@ -163,7 +163,7 @@ def __(execution_timer, ibis_table, mo):@app.cell(hide_code=True)-def __():+def _():import time@@ -186,7 +186,7 @@ def __():print(f"\033[91m[SLOW]\033[0m {self.name} time: {duration} seconds")- return execution_timer, time+ return (execution_timer,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/tables/lazy_polars.py b/marimo/_smoke_tests/tables/lazy_polars.pyindex 5f80ee7ef8..bf5f6e2f62 100644--- a/marimo/_smoke_tests/tables/lazy_polars.py+++ b/marimo/_smoke_tests/tables/lazy_polars.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.5"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/pandas_multi_idx.py b/marimo/_smoke_tests/tables/pandas_multi_idx.pyindex 397cfdd217..5216114aab 100644--- a/marimo/_smoke_tests/tables/pandas_multi_idx.py+++ b/marimo/_smoke_tests/tables/pandas_multi_idx.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.12"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/pandas_nan.py b/marimo/_smoke_tests/tables/pandas_nan.pyindex 1d98bcefd1..19b340ac22 100644--- a/marimo/_smoke_tests/tables/pandas_nan.py+++ b/marimo/_smoke_tests/tables/pandas_nan.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.8.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport pandas as pdimport numpy as np@@ -22,7 +22,7 @@ def __():# This shouldn't print a runtime warningdf = pd.DataFrame({"a": [1,2,3], "b": [np.nan, np.nan, np.nan]})df- return df, mo, np, pd+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/tables/polars_duration.py b/marimo/_smoke_tests/tables/polars_duration.pyindex 43d5cd7fb9..0b960931b3 100644--- a/marimo/_smoke_tests/tables/polars_duration.py+++ b/marimo/_smoke_tests/tables/polars_duration.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.20"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/rich_elements.py b/marimo/_smoke_tests/tables/rich_elements.pyindex 86bead80bf..5a833c65c1 100644--- a/marimo/_smoke_tests/tables/rich_elements.py+++ b/marimo/_smoke_tests/tables/rich_elements.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.13.15"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/selection.py b/marimo/_smoke_tests/tables/selection.pyindex 98f58b7459..a5e88ca8b8 100644--- a/marimo/_smoke_tests/tables/selection.py+++ b/marimo/_smoke_tests/tables/selection.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.11.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/tables/server_pagination.py b/marimo/_smoke_tests/tables/server_pagination.pyindex be32abf907..94b4876f97 100644--- a/marimo/_smoke_tests/tables/server_pagination.py+++ b/marimo/_smoke_tests/tables/server_pagination.py@@ -9,83 +9,83 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import datareturn data, mo@app.cell-def __(data):+def _(data):cars = data.cars()- return cars,+ return (cars,)@app.cell-def __(cars, mo):+def _(cars, mo):# Default cars (406)default = mo.ui.table(cars)default- return default,+ return (default,)@app.cell-def __(default):+def _(default):default._value_frontendreturn@app.cell-def __(cars, mo):+def _(cars, mo):# JSONmo.ui.table(cars.to_dict(orient="records"))return@app.cell-def __(cars, mo):+def _(cars, mo):# No paginationmo.ui.table(cars[0:20], pagination=False)return@app.cell-def __(cars, mo):+def _(cars, mo):# Trimmed, no paginationmo.ui.table(cars[0:9])return@app.cell-def __(cars, mo):+def _(cars, mo):# 21k cars, above DEFAULT_SUMMARY_CHARTS_ROW_LIMIT_more_cars = cars.sample(n=21_000, replace=True)more_cars = mo.ui.table(_more_cars)more_cars- return more_cars,+ return (more_cars,)@app.cell-def __(more_cars):+def _(more_cars):more_cars.valuereturn@app.cell-def __(cars):+def _(cars):# 1m cars, above DEFAULT_SUMMARY_STATS_ROW_LIMITone_mil_cars = cars.sample(1_000_000 + 1, replace=True)# mo.ui.table(one_mil_cars)- return one_mil_cars,+ return@app.cell-def __(cars, mo):+def _(cars, mo):mo.ui.dataframe(cars)returndiff --git a/marimo/_smoke_tests/tables/subseconds.py b/marimo/_smoke_tests/tables/subseconds.pyindex 0a41c1bebf..16339ded28 100644--- a/marimo/_smoke_tests/tables/subseconds.py+++ b/marimo/_smoke_tests/tables/subseconds.py@@ -1,13 +1,11 @@--import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import datetimeimport marimo as mo@@ -16,13 +14,13 @@ def __():@app.cell-def __(mo):+def _(mo):mo.md(r"""## Datetime""")return@app.cell-def __(datetime, pd):+def _(datetime, pd):_start = datetime.datetime(2024, 11, 27, 16)_slice = datetime.timedelta(days=1)pd.DataFrame(@@ -34,13 +32,13 @@ def __(datetime, pd):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Seconds""")return@app.cell-def __(datetime, pd):+def _(datetime, pd):_start = datetime.datetime(2024, 11, 27, 16, 17, 7)_slice = datetime.timedelta(seconds=1)pd.DataFrame(@@ -52,13 +50,13 @@ def __(datetime, pd):@app.cell-def __(mo):+def _(mo):mo.md(r"""## Milliseconds""")return@app.cell-def __(datetime, pd):+def _(datetime, pd):_start = datetime.datetime(2024, 11, 27, 16, 17, 7, 742951)_slice = datetime.timedelta(microseconds=123456)test_df = pd.DataFrame(@@ -70,24 +68,24 @@ def __(datetime, pd):@app.cell-def __(mo, test_df):+def _(mo, test_df):# Nanoseconds are still missing, because JavaScript (browsers) don't support nanoseconds.mo.hstack([mo.plain(test_df), test_df])return@app.cell-def __(mo):+def _(mo):mo.md(r"""## Nanoseconds""")return@app.cell-def __(test_df):+def _(test_df):nano_df = test_df.copy()nano_df["timestamp"] = nano_df["timestamp"].astype(str)nano_df- return (nano_df,)+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/theming/altair_theme.py b/marimo/_smoke_tests/theming/altair_theme.pyindex 29d540731b..181c966ca2 100644--- a/marimo/_smoke_tests/theming/altair_theme.py+++ b/marimo/_smoke_tests/theming/altair_theme.py@@ -8,21 +8,21 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport altair as altalt.themes- return alt, mo+ return@app.cell-def __():+def _():returndiff --git a/marimo/_smoke_tests/theming/apply_theme.py b/marimo/_smoke_tests/theming/apply_theme.pyindex 294c1381ec..af5397a378 100644--- a/marimo/_smoke_tests/theming/apply_theme.py+++ b/marimo/_smoke_tests/theming/apply_theme.py@@ -13,42 +13,43 @@# "numpy",# ]# ///+import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __(mo):+def _(mo):mo.app_meta().themereturn@app.cell-def __(mo):+def _(mo):mo.md(r"""# Seaborn""")return@app.cell-def __(df, plt):+def _(df, plt):import seaborn as snsplt.figure(figsize=(10, 6))sns.lineplot(x="x", y="y", data=df)plt.title("Seaborn: Sine Wave")- return (sns,)+ return@app.cell-def __(mo):+def _(mo):mo.md(r"""# Matplotlib""")return@app.cell-def __(x, y):+def _(x, y):import matplotlib.pyplot as pltplt.figure(figsize=(10, 6))@@ -58,29 +59,29 @@ def __(x, y):@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Holoviews""")return@app.cell-def __(df):+def _(df):import holoviews as hvhv.extension("bokeh")curve = hv.Curve(df, "x", "y")hv.render(curve.opts(title="Holoviews: Sine Wave", width=800, height=400))- return curve, hv+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Bokeh""")return@app.cell-def __(x, y):+def _(x, y):# Bokehfrom bokeh.plotting import figure, show@@ -93,17 +94,17 @@ def __(x, y):)p.line(x, y, line_width=2)p- return figure, p, show+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Altair""")return@app.cell(hide_code=True)-def __(mo):+def _(mo):import altair as altfrom vega_datasets import data@@ -119,26 +120,26 @@ def __(mo):chart = mo.ui.altair_chart(chart)chart- return alt, chart, data+ return@app.cell(hide_code=True)-def __(mo):+def _(mo):mo.md(r"""# Plotly""")return@app.cell(hide_code=True)-def __(df):+def _(df):# Plotlyimport plotly.express as pxpx.line(df, x="x", y="y", title="Plotly: Sine Wave")- return (px,)+ return@app.cell-def __(np, pd):+def _(np, pd):# Sample datax = np.linspace(0, 10, 100)y = np.sin(x)@@ -147,17 +148,15 @@ def __(np, pd):@app.cell-def __():+def _():import marimo as mo-return (mo,)@app.cell-def __():+def _():import numpy as npimport pandas as pd-return np, pddiff --git a/marimo/_smoke_tests/theming/bokeh_theme.py b/marimo/_smoke_tests/theming/bokeh_theme.pyindex aa2f7f6cf5..9aa06a2096 100644--- a/marimo/_smoke_tests/theming/bokeh_theme.py+++ b/marimo/_smoke_tests/theming/bokeh_theme.py@@ -4,21 +4,22 @@# "bokeh",# ]# ///+import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from bokeh.plotting import figure, showfrom bokeh.io import curdoc- return curdoc, figure, show+ return curdoc, figure@app.cell-def __(curdoc, figure):+def _(curdoc, figure):fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']counts = [5, 3, 4, 2, 4, 6]@@ -32,11 +33,11 @@ def __(curdoc, figure):p.xgrid.grid_line_color = Nonep.y_range.start = 0p- return counts, fruits, p+ return counts, fruits@app.cell-def __(counts, curdoc, figure, fruits):+def _(counts, curdoc, figure, fruits):curdoc().theme = "light_minimal"p3 = figure(x_range=fruits, height=350, title="Fruit Counts",@@ -47,11 +48,11 @@ def __(counts, curdoc, figure, fruits):p3.xgrid.grid_line_color = Nonep3.y_range.start = 0p3- return p3,+ return@app.cell-def __(counts, curdoc, figure, fruits):+def _(counts, curdoc, figure, fruits):curdoc().theme = "dark_minimal"p2 = figure(x_range=fruits, height=350, title="Fruit Counts",@@ -62,7 +63,7 @@ def __(counts, curdoc, figure, fruits):p2.xgrid.grid_line_color = Nonep2.y_range.start = 0p2- return p2,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/theming/custom_css.py b/marimo/_smoke_tests/theming/custom_css.pyindex 71cd5a7e6d..8d140fb69d 100644--- a/marimo/_smoke_tests/theming/custom_css.py+++ b/marimo/_smoke_tests/theming/custom_css.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="medium", css_file="custom.css")diff --git a/marimo/_smoke_tests/theming/custom_head.py b/marimo/_smoke_tests/theming/custom_head.pyindex b0581b4a69..f5a088347d 100644--- a/marimo/_smoke_tests/theming/custom_head.py+++ b/marimo/_smoke_tests/theming/custom_head.py@@ -8,25 +8,25 @@import marimo-__generated_with = "0.9.21"+__generated_with = "0.15.5"app = marimo.App(width="medium", html_head_file="head.html")@app.cell-def __():+def _():import marimo as mofrom vega_datasets import datareturn data, mo@app.cell-def __(data):+def _(data):data.cars()return@app.cell-def __(mo):+def _(mo):mo.callout(mo.md("""## Callout@@ -38,7 +38,7 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md(r"""# headingdiff --git a/marimo/_smoke_tests/theming/matplotlib_theme.py b/marimo/_smoke_tests/theming/matplotlib_theme.pyindex 937b4824c6..b9621c408c 100644--- a/marimo/_smoke_tests/theming/matplotlib_theme.py+++ b/marimo/_smoke_tests/theming/matplotlib_theme.py@@ -9,41 +9,40 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import matplotlib.pyplot as pltimport numpy as npimport marimo as mo-return mo, np, plt@app.cell-def __(mo, plt):+def _(mo, plt):mo.ui.table(plt.style.available, selection=None, page_size=2)return@app.cell-def __(create_plot, plt):+def _(create_plot, plt):plt.style.use('default')create_plot().gca()return@app.cell-def __(create_plot, plt):+def _(create_plot, plt):plt.style.use('dark_background')create_plot().gca()return@app.cell-def __(np, plt):+def _(np, plt):def create_plot():# Create sample datax = np.linspace(0, 10, 100)@@ -51,27 +50,27 @@ def __(np, plt):y2 = np.cos(x)y3 = np.tan(x)y4 = x**2-+# Create the plotfig, ax = plt.subplots(figsize=(10, 6))-+# Plot multiple lines without specifying colorsax.plot(x, y1, label='Sin')ax.plot(x, y2, label='Cos')ax.plot(x, y3, label='Tan')ax.plot(x, y4, label='x^2')-+# Customize the plotax.set_title('Dark Mode Plot with Auto Colors')ax.set_xlabel('X-axis')ax.set_ylabel('Y-axis')ax.legend()-+# Add a gridax.grid(True, linestyle='--', alpha=0.7)-+return plt- return create_plot,+ return (create_plot,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/theming/plotly_theme.py b/marimo/_smoke_tests/theming/plotly_theme.pyindex 3b616bb643..b3ba0a460c 100644--- a/marimo/_smoke_tests/theming/plotly_theme.py+++ b/marimo/_smoke_tests/theming/plotly_theme.py@@ -8,22 +8,22 @@import marimo-__generated_with = "0.8.3"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport plotly.io as pioimport plotly.graph_objects as goprint("default theme:", pio.templates.default)- return go, mo, pio+ return go, pio@app.cell-def __(go, pio):+def _(go, pio):pio.templates.default = "plotly_white"go.Figure(@@ -33,7 +33,7 @@ def __(go, pio):@app.cell-def __(go, pio):+def _(go, pio):pio.templates.default = "plotly"go.Figure(@@ -43,7 +43,7 @@ def __(go, pio):@app.cell-def __(go, pio):+def _(go, pio):pio.templates.default = "plotly_dark"go.Figure(diff --git a/marimo/_smoke_tests/third_party/_treescope.py b/marimo/_smoke_tests/third_party/_treescope.pyindex 965ed8b1db..bf0f75af19 100644--- a/marimo/_smoke_tests/third_party/_treescope.py+++ b/marimo/_smoke_tests/third_party/_treescope.py@@ -9,7 +9,7 @@import marimo-__generated_with = "0.11.6"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -22,7 +22,7 @@ def _():my_array = np.cos(np.arange(300).reshape((10,30)) * 0.2)figure = treescope.render_array(my_array)mo.iframe(figure._repr_html_())- return figure, mo, my_array, np, treescope+ return (figure,)@app.celldiff --git a/marimo/_smoke_tests/third_party/altair_example.py b/marimo/_smoke_tests/third_party/altair_example.pyindex ba1f96e03f..59a111647b 100644--- a/marimo/_smoke_tests/third_party/altair_example.py+++ b/marimo/_smoke_tests/third_party/altair_example.py@@ -9,12 +9,12 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(data):+def _(data):cars = data.cars()stocks = data.stocks.urlsource = data.windvectors()@@ -22,7 +22,7 @@ def __(data):@app.cell-def __(alt, source):+def _(alt, source):alt.Chart(source).mark_point(shape="wedge", filled=True).encode(latitude="latitude",longitude="longitude",@@ -38,7 +38,7 @@ def __(alt, source):@app.cell-def __(alt, cars, mo):+def _(alt, cars, mo):cars_scatter_plot = (alt.Chart(cars).mark_circle(size=60)@@ -59,11 +59,11 @@ def __(alt, cars, mo):that was an altair plot""")- return cars_scatter_plot,+ return@app.cell-def __(alt, stocks):+def _(alt, stocks):base = (alt.Chart(stocks).encode(x="date:T", y="price:Q", color="symbol:N")@@ -71,17 +71,17 @@ def __(alt, stocks):)(base.mark_line() + base.mark_point())- return base,+ return@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __():+def _():import altair as altfrom vega_datasets import datareturn alt, datadiff --git a/marimo/_smoke_tests/third_party/arviz_html.py b/marimo/_smoke_tests/third_party/arviz_html.pyindex 6c55ee08e0..31cd63e71c 100644--- a/marimo/_smoke_tests/third_party/arviz_html.py+++ b/marimo/_smoke_tests/third_party/arviz_html.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.12.8"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/third_party/databricks_connect.py b/marimo/_smoke_tests/third_party/databricks_connect.pyindex ef612dad5e..b7da42ba67 100644--- a/marimo/_smoke_tests/third_party/databricks_connect.py+++ b/marimo/_smoke_tests/third_party/databricks_connect.py@@ -1,8 +1,6 @@--import marimo-__generated_with = "0.13.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/third_party/holoviews_example.py b/marimo/_smoke_tests/third_party/holoviews_example.pyindex 1978cfbf69..e9d3924428 100644--- a/marimo/_smoke_tests/third_party/holoviews_example.py+++ b/marimo/_smoke_tests/third_party/holoviews_example.py@@ -13,12 +13,12 @@import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(mo):+def _(mo):mo.md("""# HoloViews in marimo@@ -31,7 +31,7 @@ def __(mo):@app.cell-def __():+def _():import pandas as pdimport numpy as npimport holoviews as hv@@ -39,100 +39,100 @@ def __():import marimo as mohv.extension("bokeh", "plotly", "matplotlib")- return hv, mo, np, opts, pd+ return hv, mo, np, pd@app.cell-def __(pd):+def _(pd):station_info = pd.read_csv("https://raw.githubusercontent.com/holoviz/holoviews/main/examples/assets/station_info.csv")- return station_info,+ return (station_info,)@app.cell-def __(hv, mo):+def _(hv, mo):backend = mo.ui.dropdown(options=list(hv.extension._backends.keys()),label="Choose your backend",full_width=True,)- return backend,+ return (backend,)@app.cell-def __(backend, hv, mo, station_info):+def _(backend, hv, mo, station_info):scatter = hv.Scatter(station_info, "services", "ridership")if backend.value:hv.extension(backend.value)mo.hstack([backend, scatter], align="center")- return scatter,+ return (scatter,)@app.cell-def __(mo):+def _(mo):mo.md("""## Area chart""")return@app.cell-def __(hv, np):+def _(hv, np):xs = np.linspace(0, np.pi * 4, 40)hv.Area((xs, np.sin(xs)))- return xs,+ return@app.cell-def __(mo):+def _(mo):mo.md("""## Scatter chart""")return@app.cell-def __(scatter):+def _(scatter):scatterreturn@app.cell-def __(mo):+def _(mo):mo.md("""# HV Plot""")return@app.cell-def __():+def _():import hvplot.pandasfrom bokeh.sampledata.penguins import data as dfdf.hvplot.scatter(x="bill_length_mm", y="bill_depth_mm", by="species")- return df, hvplot+ return@app.cell-def __(mo):+def _(mo):mo.md("""# Composed Views""")return@app.cell-def __():+def _():import polars as plfrom hvplot import polarsdf3 = pl.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3]}, strict=False)df4 = pl.DataFrame({"x": [1, 2, 3], "y": [3, 2.5, 3]}, strict=False)- return df3, df4, pl, polars+ return df3, df4@app.cell-def __(df3, df4):+def _(df3, df4):df3.hvplot.line("x", "y") * df4.hvplot.line("x", "y")return@app.cell-def __(df3, df4):+def _(df3, df4):df3.hvplot.line("x", "y") + df4.hvplot.line("x", "y")returndiff --git a/marimo/_smoke_tests/third_party/holoviews_scatter.py b/marimo/_smoke_tests/third_party/holoviews_scatter.pyindex 5843f7b8b2..f3c68080ea 100644--- a/marimo/_smoke_tests/third_party/holoviews_scatter.py+++ b/marimo/_smoke_tests/third_party/holoviews_scatter.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.11.2"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -31,7 +31,7 @@ def _():height=400,width=400,)- return df, hvplot, panel+ return@app.cell@@ -53,7 +53,7 @@ def _(mo):slider = pn.widgets.IntSlider(start=0, end=10, value=5)rx_stars = mo.ui.panel(slider.rx() * "*")rx_stars- return pn, rx_stars, slider+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/third_party/ipython_display.py b/marimo/_smoke_tests/third_party/ipython_display.pyindex 3dd72a94dd..5d50531c94 100644--- a/marimo/_smoke_tests/third_party/ipython_display.py+++ b/marimo/_smoke_tests/third_party/ipython_display.py@@ -6,45 +6,46 @@# ]# ///# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.3.1"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import IPythonimport marimo as mourl = IPython.display.HTML("https://marimo.io")url- return IPython, mo, url+ return IPython, url@app.cell-def __(IPython):+def _(IPython):html = IPython.display.HTML("<em>hello world</em>")html- return html,+ return (html,)@app.cell-def __(IPython, html, url):+def _(IPython, html, url):IPython.display.display(html, url)return@app.cell-def __():+def _():# not on PyPI# installation instructions here https://github.com/allefeld/pytikzimport tikz- return tikz,+ return (tikz,)@app.cell-def __(tikz):+def _(tikz):# define coordinates as a list of tuplescoords = [(0, 0), (0, 2), (1, 3.25), (2, 2), (2, 0), (0, 2), (2, 2), (0, 0), (2, 0)]@@ -52,11 +53,11 @@ def __(tikz):pic = tikz.Picture()# draw a line following the coordinatespic.draw(tikz.line(coords), thick=True, rounded_corners='4pt')- return coords, pic+ return (pic,)@app.cell-def __(pic):+def _(pic):pic.demo(dpi=300)returndiff --git a/marimo/_smoke_tests/third_party/leafmap/backends.py b/marimo/_smoke_tests/third_party/leafmap/backends.pyindex caddcdd166..880ac048f9 100644--- a/marimo/_smoke_tests/third_party/leafmap/backends.py+++ b/marimo/_smoke_tests/third_party/leafmap/backends.py@@ -1,17 +1,17 @@import marimo-__generated_with = "0.9.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return (mo,)+ return@app.cell-def __():+def _():import leafmap as default_leamapimport leafmap.leafmap as leafmapimport leafmap.foliumap as leafmap_folium@@ -20,26 +20,26 @@ def __():@app.cell-def __():+def _():import keplerglimport leafmap.kepler as leafmap_kepler- return keplergl, leafmap_kepler+ return (leafmap_kepler,)@app.cell-def __(default_leamap):+def _(default_leamap):default_leamap.Mapreturn@app.cell-def __(leafmap):+def _(leafmap):data = leafmap.examples.datasets.countries_geojsonreturn (data,)@app.cell-def __(data, leafmap):+def _(data, leafmap):_m = leafmap.Map()_m.add_data(data,@@ -53,14 +53,14 @@ def __(data, leafmap):@app.cell-def __(leafmap_plotly):+def _(leafmap_plotly):_m = leafmap_plotly.Map(center=(40, -100), zoom=3, height=500)_mreturn@app.cell-def __(data, leafmap_folium):+def _(data, leafmap_folium):_m = leafmap_folium.Map()_m.add_data(data,@@ -74,7 +74,7 @@ def __(data, leafmap_folium):@app.cell-def __(leafmap_kepler):+def _(leafmap_kepler):_m = leafmap_kepler.Map(center=[40, -100], zoom=2, height=600, widescreen=False)diff --git a/marimo/_smoke_tests/third_party/lonboard_example.py b/marimo/_smoke_tests/third_party/lonboard_example.pyindex 315c86cd56..fb48292161 100644--- a/marimo/_smoke_tests/third_party/lonboard_example.py+++ b/marimo/_smoke_tests/third_party/lonboard_example.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.13.10"+__generated_with = "0.15.5"app = marimo.App(width="full")diff --git a/marimo/_smoke_tests/third_party/mohtml_example.py b/marimo/_smoke_tests/third_party/mohtml_example.pyindex 8d69e01e42..cc9453b010 100644--- a/marimo/_smoke_tests/third_party/mohtml_example.py+++ b/marimo/_smoke_tests/third_party/mohtml_example.py@@ -7,12 +7,12 @@import marimo-__generated_with = "0.9.21"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():# You can import any HTML element this wayfrom mohtml import a, p, div, script, h1@@ -23,11 +23,11 @@ def __():klass="font-bold text-xl border-yellow-600 border-2 px-2 border-dashed",),)- return a, div, h1, p, script+ return@app.cell-def __():+def _():returndiff --git a/marimo/_smoke_tests/third_party/pandas/int_column_names.py b/marimo/_smoke_tests/third_party/pandas/int_column_names.pyindex 10092a19e5..49f0c9dce4 100644--- a/marimo/_smoke_tests/third_party/pandas/int_column_names.py+++ b/marimo/_smoke_tests/third_party/pandas/int_column_names.py@@ -1,31 +1,31 @@import marimo-__generated_with = "0.9.27"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport pandas as pdreturn mo, pd@app.cell-def __(pd):+def _(pd):pd.DataFrame([1, 2, 3])return@app.cell-def __(pd):+def _(pd):data = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=[0, 1, 2])datareturn (data,)@app.cell-def __(data, mo):+def _(data, mo):mo.ui.table(data)returndiff --git a/marimo/_smoke_tests/third_party/pandas/transform_edgecases.py b/marimo/_smoke_tests/third_party/pandas/transform_edgecases.pyindex 659d397a65..2d9a4b3528 100644--- a/marimo/_smoke_tests/third_party/pandas/transform_edgecases.py+++ b/marimo/_smoke_tests/third_party/pandas/transform_edgecases.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.14.11"+__generated_with = "0.15.5"app = marimo.App(width="medium")diff --git a/marimo/_smoke_tests/third_party/pandas_example.py b/marimo/_smoke_tests/third_party/pandas_example.pyindex eed11ae821..5e59091eeb 100644--- a/marimo/_smoke_tests/third_party/pandas_example.py+++ b/marimo/_smoke_tests/third_party/pandas_example.py@@ -5,32 +5,33 @@# "numpy",# ]# ///+import marimo-__generated_with = "0.1.0"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __(np):+def _(np):import pandas as pddf = pd.DataFrame([np.random.randn(20)]*10, columns=np.arange(20))df- return df, pd+ return (df,)@app.cell-def __(df):+def _(df):# Seriesdf[0]return@app.cell-def __():+def _():import numpy as np- return np,+ return (np,)if __name__ == "__main__":diff --git a/marimo/_smoke_tests/third_party/panel_example.py b/marimo/_smoke_tests/third_party/panel_example.pyindex e60e0aaa92..b1c0116a48 100644--- a/marimo/_smoke_tests/third_party/panel_example.py+++ b/marimo/_smoke_tests/third_party/panel_example.py@@ -1,20 +1,20 @@import marimo-__generated_with = "0.9.14"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as moimport panel as pnpn.extension("vega")- return mo, pn+ return (pn,)@app.cell-def __(pn):+def _(pn):slider = pn.widgets.IntSlider(start=0, end=10, value=5)slider.rx() * "🚀"@@ -22,13 +22,13 @@ def __(pn):@app.cell-def __(pn, slider):+def _(pn, slider):pn.Column(slider, pn.pane.Markdown("🚀"))return@app.cell-def __(pn):+def _(pn):[pn.widgets.FloatSlider(value=3.14),pn.widgets.Select(diff --git a/marimo/_smoke_tests/third_party/plotly_example.py b/marimo/_smoke_tests/third_party/plotly_example.pyindex e6c9a137f7..6f1be2a497 100644--- a/marimo/_smoke_tests/third_party/plotly_example.py+++ b/marimo/_smoke_tests/third_party/plotly_example.py@@ -9,18 +9,18 @@import marimo-__generated_with = "0.8.18"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(mo):+def _(mo):mo.md("""# Plotly Express Chart""")return@app.cell-def __():+def _():import plotly.express as pxpx.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])@@ -28,7 +28,7 @@ def __():@app.cell-def __(mo, px):+def _(mo, px):plot = mo.ui.plotly(px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16], width=600))@@ -42,7 +42,7 @@ def __(mo, px):@app.cell-def __(mo, plot):+def _(mo, plot):mo.vstack([mo.hstack(@@ -66,13 +66,13 @@ def __(mo, plot):@app.cell-def __(mo):+def _(mo):mo.md("""# Plotly Graph Objects Chart""")return@app.cell-def __(mo):+def _(mo):import pandas as pdimport plotly.graph_objects as go@@ -118,39 +118,39 @@ def __(mo):plot2 = mo.ui.plotly(fig)plot2- return contestant, df, fig, go, group, pd, plot2+ return go, pd, plot2@app.cell-def __(mo, plot2):+def _(mo, plot2):mo.ui.table(plot2.value, selection=None)return@app.cell-def __(mo):+def _(mo):mo.md("""# Re-rendering Chart""")return@app.cell-def __():+def _():import vega_datasets as datasetsimport marimo as mocars = datasets.data.cars()- return cars, datasets, mo+ return cars, mo@app.cell-def __(cars, mo):+def _(cars, mo):sample_size = mo.ui.slider(label="Sample", start=100, stop=len(cars), step=100)sample_sizereturn (sample_size,)@app.cell-def __(cars, mo, px, sample_size):+def _(cars, mo, px, sample_size):_fig = px.scatter(cars.sample(sample_size.value),x="Horsepower",@@ -167,19 +167,19 @@ def __(cars, mo, px, sample_size):@app.cell-def __(mo, plot3):+def _(mo, plot3):mo.ui.table(plot3.value, selection=None)return@app.cell-def __(mo):+def _(mo):mo.md("""# 3D Chart""")return@app.cell-def __(go, pd):+def _(go, pd):# load dataset_df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/volcano.csv"diff --git a/marimo/_smoke_tests/third_party/pyeacharts_example.py b/marimo/_smoke_tests/third_party/pyeacharts_example.pyindex 18a684377c..236e845054 100644--- a/marimo/_smoke_tests/third_party/pyeacharts_example.py+++ b/marimo/_smoke_tests/third_party/pyeacharts_example.py@@ -1,11 +1,11 @@import marimo-__generated_with = "0.8.18"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import pyecharts.options as optsfrom pyecharts.charts import Bar@@ -20,7 +20,7 @@ def __():)bar- return Bar, bar, opts+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/third_party/rich_example.py b/marimo/_smoke_tests/third_party/rich_example.pyindex cd54a37b0b..cbaed8e813 100644--- a/marimo/_smoke_tests/third_party/rich_example.py+++ b/marimo/_smoke_tests/third_party/rich_example.py@@ -5,27 +5,28 @@# "rich",# ]# ///+import marimo-__generated_with = "0.1.88"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as mo- return mo,+ return@app.cell-def __():+def _():# pip install richfrom rich import print as pprint- return pprint,+ return (pprint,)@app.cell-def __(pprint):+def _(pprint):pprint("[bold red]Error:[/bold red] Something went wrong!")pprint("[green]Success:[/green] Operation completed.")returndiff --git a/marimo/_smoke_tests/third_party/seaborn_example.py b/marimo/_smoke_tests/third_party/seaborn_example.pyindex 2695afcfea..4fa470d408 100644--- a/marimo/_smoke_tests/third_party/seaborn_example.py+++ b/marimo/_smoke_tests/third_party/seaborn_example.py@@ -8,12 +8,12 @@import marimo-__generated_with = "0.9.17"+__generated_with = "0.15.5"app = marimo.App()@app.cell(hide_code=True)-def __():+def _():import seaborn as snspenguins = sns.load_dataset("penguins")@@ -22,13 +22,13 @@ def __():@app.cell-def __(sns):+def _(sns):sns.color_palette("pastel")return@app.cell-def __(penguins, sns):+def _(penguins, sns):sns.jointplot(data=penguins,x="flipper_length_mm",@@ -39,13 +39,13 @@ def __(penguins, sns):@app.cell-def __(penguins, sns):+def _(penguins, sns):sns.pairplot(data=penguins, hue="species")return@app.cell-def __(sns, tips):+def _(sns, tips):sns.relplot(data=tips,x="total_bill",diff --git a/marimo/_smoke_tests/threads.py b/marimo/_smoke_tests/threads.pyindex eb2672d829..57b19c3f9a 100644--- a/marimo/_smoke_tests/threads.py+++ b/marimo/_smoke_tests/threads.py@@ -1,37 +1,35 @@import marimo-__generated_with = "0.9.10"+__generated_with = "0.15.5"app = marimo.App()@app.cell-def __():+def _():import marimo as moreturn (mo,)-def __():- def foo():- print("hi")- return (foo,)+def foo():+ print("hi")@app.cell-def __():+def _():import threadingreturn (threading,)@app.cell-def __(foo, mo, threading):+def _(mo, threading):with mo.redirect_stdout():threading.Thread(target=foo).start()return@app.cell-def __(foo, mo):+def _(mo):with mo.redirect_stdout():mo.Thread(target=foo).start()returndiff --git a/marimo/_smoke_tests/timezones.py b/marimo/_smoke_tests/timezones.pyindex ea52070ea3..095d3f9ae0 100644--- a/marimo/_smoke_tests/timezones.py+++ b/marimo/_smoke_tests/timezones.py@@ -1,6 +1,6 @@import marimo-__generated_with = "0.10.16"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -12,7 +12,7 @@ def _():import syssys.tracebacklimit = 1- return date, datetime, pd_lib, pl_lib, sys, time+ return date, datetime, pd_lib, pl_lib, time@app.cell(hide_code=True)@@ -69,7 +69,7 @@ def _(df, print_df):)print_df(_df)- return (nw,)+ return@app.celldiff --git a/marimo/_smoke_tests/toast.py b/marimo/_smoke_tests/toast.pyindex 21df2f22ec..fe3eeb520e 100644--- a/marimo/_smoke_tests/toast.py+++ b/marimo/_smoke_tests/toast.py@@ -1,33 +1,31 @@import marimo-__generated_with = "0.8.17"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo-return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""# Toast Notification Test""")return@app.cell-def __(mo):+def _(mo):def show_toast(title, description="", kind=None):mo.status.toast(title, description, kind)return None-return (show_toast,)@app.cell-def __(mo):+def _(mo):simple_toast = mo.ui.checkbox(label="Simple Toast")html_toast = mo.ui.checkbox(label="Toast with HTML description")danger_toast = mo.ui.checkbox(label="Danger Toast")@@ -35,13 +33,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.md("""Select a checkbox to trigger a toast notification:""")return@app.cell-def __(danger_toast, html_toast, mo, simple_toast):+def _(danger_toast, html_toast, mo, simple_toast):mo.vstack([simple_toast,@@ -53,7 +51,7 @@ def __(danger_toast, html_toast, mo, simple_toast):@app.cell-def __(danger_toast, html_toast, show_toast, simple_toast):+def _(danger_toast, html_toast, show_toast, simple_toast):if simple_toast.value:show_toast("Simple Toast", "This is a basic toast notification")diff --git a/marimo/_smoke_tests/tooltips.py b/marimo/_smoke_tests/tooltips.pyindex 8eb541dd28..5b0601d756 100644--- a/marimo/_smoke_tests/tooltips.py+++ b/marimo/_smoke_tests/tooltips.py@@ -1,18 +1,19 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.8.0"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():import marimo as mo- return mo,+ return (mo,)@app.cell-def __(mo):+def _(mo):mo.md("""# Tooltips@@ -24,13 +25,13 @@ def __(mo):@app.cell-def __(mo):+def _(mo):mo.ui.button(label="<span data-tooltip='I said dont press'>Don't press</span>")return@app.cell-def __():+def _():returndiff --git a/marimo/_smoke_tests/tqdm_notebook.py b/marimo/_smoke_tests/tqdm_notebook.pyindex f7e03f64da..4cf9b37553 100644--- a/marimo/_smoke_tests/tqdm_notebook.py+++ b/marimo/_smoke_tests/tqdm_notebook.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.13"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from tqdm.notebook import tqdmimport time@@ -14,10 +15,10 @@ def __():@app.cell-def __(time, tqdm):+def _(time, tqdm):for i in tqdm(range(10)):time.sleep(0.1)- return i,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/tqdm_update_test.py b/marimo/_smoke_tests/tqdm_update_test.pyindex 249301fcae..5862e915d1 100644--- a/marimo/_smoke_tests/tqdm_update_test.py+++ b/marimo/_smoke_tests/tqdm_update_test.py@@ -1,52 +1,54 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.7.13"+__generated_with = "0.15.5"app = marimo.App(width="medium")@app.cell-def __():+def _():from tqdm.notebook import tqdm, trangeimport timereturn time, tqdm, trange@app.cell-def __(time, tqdm):+def _(time, tqdm):# Test regular iterationfor i in tqdm(range(5)):time.sleep(0.1)- return i,+ return+@app.cell-def __(time, tqdm):+def _(time, trange):# Test regular iterationfor i in trange(5):time.sleep(0.1)- return i,+ return@app.cell-def __(time, tqdm):+def _(time, tqdm):# Test manual update methodpbar = tqdm(total=5)for i in range(5):time.sleep(0.1)pbar.update(1) # Explicitly calling updatepbar.close()- return i,+ return@app.cell-def __(time, tqdm):+def _(time, tqdm):# Test update with different incrementpbar = tqdm(total=50)for i in range(0, 50, 5):time.sleep(0.1)pbar.update(5) # Update by 5 each timepbar.close()- return i,+ returnif __name__ == "__main__":diff --git a/marimo/_smoke_tests/ws.py b/marimo/_smoke_tests/ws.pyindex cdc48eddc6..ad8cb2ac71 100644--- a/marimo/_smoke_tests/ws.py+++ b/marimo/_smoke_tests/ws.py@@ -1,12 +1,13 @@# Copyright 2024 Marimo. All rights reserved.+import marimo-__generated_with = "0.1.39"+__generated_with = "0.15.5"app = marimo.App(width="full")@app.cell-def __(mo, os):+def _(mo, os):env_api_key = os.environ.get("COINBASE_API_KEY")env_api_secret = os.environ.get("COINBASE_API_SECRET")@@ -28,11 +29,11 @@ def __(mo, os):)})- return api_key_input, api_secret_input, env_api_key, env_api_secret+ return api_key_input, api_secret_input@app.cell-def __(mo, pd):+def _(mo, pd):get_df, set_df = mo.state(pd.DataFrame(columns=[@@ -53,7 +54,7 @@ def __(mo, pd):@app.cell-def __(mo):+def _(mo):def output_stats(df):if len(df) == 0:return mo.callout("Waiting for data...")@@ -111,11 +112,11 @@ def __(mo):widths=[1, 1, 1, 1, 1, 1],gap=2,)- return output_stats,+ return (output_stats,)@app.cell-def __(alt, mo):+def _(alt, mo):def output_chart(df):_chart = (alt.Chart(df)@@ -128,23 +129,22 @@ def __(alt, mo):))return mo.ui.altair_chart(_chart)- return output_chart,+ return (output_chart,)@app.cell-def __(mo):+def _(mo):def output_table(df):return mo.ui.table(df[::-1], selection=None)- return output_table,+ return (output_table,)@app.cell-def __(+def _(WebSocketConnectionClosedException,api_key_input,api_secret_input,create_connection,- e,get_df,hashlib,hmac,@@ -276,20 +276,11 @@ def __(# thread_keepalive = Thread(target=websocket_keepalive)# thread.start()websocket_thread()- return (- add_signature_ws,- handle_new_ticker,- thread,- thread_keepalive,- thread_running,- websocket_keepalive,- websocket_thread,- ws,- )+ return@app.cell-def __():+def _():import marimo as moimport pandas as pdimport altair as alt@@ -298,7 +289,7 @@ def __():@app.cell-def __():+def _():import jsonimport timeimport hmac@@ -306,7 +297,6 @@ def __():from threading import Threadfrom websocket import create_connection, WebSocketConnectionClosedExceptionreturn (- Thread,WebSocketConnectionClosedException,create_connection,hashlib,diff --git a/marimo/_tutorials/dataflow.py b/marimo/_tutorials/dataflow.pyindex 473d6724fb..3083b511ac 100644--- a/marimo/_tutorials/dataflow.py+++ b/marimo/_tutorials/dataflow.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_tutorials/fileformat.py b/marimo/_tutorials/fileformat.pyindex 70c42aa17e..7fb99e9e9a 100644--- a/marimo/_tutorials/fileformat.py+++ b/marimo/_tutorials/fileformat.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()with app.setup:@@ -450,7 +450,7 @@ def _(mo):@app.cell-def _(__file__):+def _():with open(__file__, "r", encoding="utf-8") as f:contents = f.read()return (contents,)diff --git a/marimo/_tutorials/for_jupyter_users.py b/marimo/_tutorials/for_jupyter_users.pyindex 07f4f352e9..76db05c82c 100644--- a/marimo/_tutorials/for_jupyter_users.py+++ b/marimo/_tutorials/for_jupyter_users.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App(app_title="marimo for Jupyter users")diff --git a/marimo/_tutorials/intro.py b/marimo/_tutorials/intro.pyindex c4ca31a295..335420f5d6 100644--- a/marimo/_tutorials/intro.py+++ b/marimo/_tutorials/intro.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_tutorials/layout.py b/marimo/_tutorials/layout.pyindex bcdce2fddd..6261ca37dd 100644--- a/marimo/_tutorials/layout.py+++ b/marimo/_tutorials/layout.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_tutorials/markdown.py b/marimo/_tutorials/markdown.pyindex 74af918f8a..2ebf7bcdae 100644--- a/marimo/_tutorials/markdown.py+++ b/marimo/_tutorials/markdown.py@@ -11,7 +11,7 @@import marimo-__generated_with = "0.13.3"+__generated_with = "0.15.5"app = marimo.App()diff --git a/marimo/_tutorials/plots.py b/marimo/_tutorials/plots.pyindex 9beeedaf83..22aa95b9b3 100644--- a/marimo/_tutorials/plots.py+++ b/marimo/_tutorials/plots.py@@ -10,7 +10,7 @@import marimo-__generated_with = "0.12.2"+__generated_with = "0.15.5"app = marimo.App()@@ -261,7 +261,7 @@ def _(missing_packages, mo):def check_dependencies():if missing_packages:return module_not_found_explainer- return check_dependencies, module_not_found_explainer+ return (check_dependencies,)@app.cell(hide_code=True)@@ -288,7 +288,7 @@ def _():if not missing_packages:matplotlib.rcParams['figure.figsize'] = (6, 2.4)- return matplotlib, missing_packages, np, plt+ return missing_packages, np, plt@app.celldiff --git a/marimo/_tutorials/sql.py b/marimo/_tutorials/sql.pyindex 2ae49c6b6c..7b1354ea02 100644--- a/marimo/_tutorials/sql.py+++ b/marimo/_tutorials/sql.py@@ -13,7 +13,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App(width="medium")@@ -200,7 +200,7 @@ def _(has_polars_installed):import pandas as pddf = pd.DataFrame(_data)- return (df,)+ return@app.cell(hide_code=True)@@ -210,7 +210,7 @@ def _(mo):@app.cell-def _(df, mo):+def _(mo):_df = mo.sql(f"""-- This SQL cell is special since we can reference existing dataframes in the global scope as a table in the SQL query. For example, we can reference the `df` dataframe in the global scope, which was defined in another cell using Python.@@ -245,7 +245,7 @@ def _(mo, string):@app.cell-def _(df, mo, token_prefix):+def _(mo, token_prefix):result = mo.sql(f"""-- Change the dropdown to see the SQL query filter itself!@@ -401,7 +401,7 @@ def _(cars, mo):@app.cell-def _(cars, cylinders_dropdown, mo, origin_dropdown):+def _(cylinders_dropdown, mo, origin_dropdown):filtered_cars = mo.sql(f"""SELECT * FROM carsdiff --git a/marimo/_tutorials/ui.py b/marimo/_tutorials/ui.pyindex 61268729bd..e1ab7cf029 100644--- a/marimo/_tutorials/ui.py+++ b/marimo/_tutorials/ui.py@@ -2,7 +2,7 @@import marimo-__generated_with = "0.12.10"+__generated_with = "0.15.5"app = marimo.App()