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
smoke-test: improve asgi smoke test (#7850)
Myles Scolnick80af9abe1e4e
diff --git a/marimo/_smoke_tests/custom_server/my_server.py b/marimo/_smoke_tests/custom_server/my_server.pyindex 16ba51503d..fc9c6b285f 100644--- a/marimo/_smoke_tests/custom_server/my_server.py+++ b/marimo/_smoke_tests/custom_server/my_server.py@@ -1,23 +1,41 @@+# /// script+# requires-python = ">=3.12"+# dependencies = [+# "fastapi",+# "marimo",+# "starlette",+# "jinja2",+# "itsdangerous",+# "python-dotenv",+# "python-multipart",+# "passlib",+# "pydantic",+# "vega-datasets==0.9.0",+# ]+# ///+# Copyright 2026 Marimo. All rights reserved.+from pathlib import Pathfrom typing import Annotated, Callable, Coroutinefrom fastapi.responses import HTMLResponse, RedirectResponseimport marimofrom fastapi import FastAPI, Form, Request, Response+dirname = Path(__file__).parent.parentserver = (marimo.create_asgi_app()# Mount the dataframe app at /dataframes- .with_app(path="/dataframes", root="../dataframe.py")+ .with_app(path="/dataframes", root=str(dirname / "dataframe.py"))# Mount the ansi app at /ansi- .with_app(path="/ansi", root="../ansi.py")+ .with_app(path="/ansi", root=str(dirname / "ansi.py"))# Mount directory at /data# You can visit /charts/altair_brush/# You can visit /charts/altair_polars/- .with_dynamic_directory(path="/chart", directory="../altair")- .with_dynamic_directory(path="/smoke_tests", directory="../")+ .with_dynamic_directory(path="/chart", directory=str(dirname / "altair"))+ .with_dynamic_directory(path="/smoke_tests", directory=str(dirname))# Mount the buttons app at the root- .with_app(path="", root="../buttons.py")+ .with_app(path="", root=str(dirname / "buttons.py")))# Create a FastAPI app@@ -64,6 +82,16 @@ async def post_login(token: Annotated[str, Form()]):async def root():return {"message": "pong"}[email protected]("/")+async def root():+ return HTMLResponse(+ """+ <h1>Choose an application</h1>+ <a href="/dataframes">Dataframes</a>+ <a href="/ansi">Ansi</a>+ <a href="/charts/altair_brush/">Chart</a>+ """+ )app.mount("/", server.build())