Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: app title in wasm export (#3821)

Myles Scolnick808267859fb6
diff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.py
index 2d68d0cd30..ad55165b91 100644
--- a/marimo/_server/templates/templates.py
+++ b/marimo/_server/templates/templates.py
@@ -250,7 +250,12 @@ def wasm_notebook_template(
body = re.sub(r'="./assets/', f'="{asset_url}/assets/', body)
body = body.replace("{{ base_url }}", "")
- body = body.replace("{{ title }}", "marimo")
+ body = body.replace(
+ "{{ title }}",
+ parse_title(filename)
+ if app_config.app_title is None
+ else app_config.app_title,
+ )
body = body.replace("{{ user_config }}", json.dumps(user_config))
body = body.replace(
"{{ app_config }}", json.dumps(_del_none_or_empty(app_config.asdict()))
diff --git a/tests/_server/templates/snapshots/export5.txt b/tests/_server/templates/snapshots/export5.txt
index db2ecddae3..9be387349b 100644
--- a/tests/_server/templates/snapshots/export5.txt
+++ b/tests/_server/templates/snapshots/export5.txt
@@ -56,9 +56,9 @@
<marimo-mode data-mode='read' hidden></marimo-mode>
<marimo-version data-version='0.0.0' hidden></marimo-version>
<marimo-user-config data-config='{"completion": {"activate_on_typing": true, "copilot": false}, "display": {"cell_output": "above", "code_editor_font_size": 14, "dataframes": "rich", "default_width": "medium", "theme": "light"}, "formatting": {"line_length": 79}, "keymap": {"overrides": {}, "preset": "default"}, "package_management": {"manager": "uv"}, "runtime": {"auto_instantiate": true, "auto_reload": "off", "on_cell_change": "autorun", "watcher_on_save": "lazy"}, "save": {"autosave": "after_delay", "autosave_delay": 1000, "format_on_save": false}, "server": {"browser": "default", "follow_symlink": false}, "snippets": {"custom_paths": [], "include_default_snippets": true}}' data-overrides='{"formatting": {"line_length": 100}}' hidden></marimo-user-config>
- <marimo-app-config data-config='{"html_head_file": "head.html", "width": "compact"}' hidden></marimo-app-config>
+ <marimo-app-config data-config='{"app_title": "My App", "html_head_file": "head.html", "width": "compact"}' hidden></marimo-app-config>
<marimo-server-token data-token='token' hidden></marimo-server-token>
- <title>notebook</title>
+ <title>My App</title>
<script type="module" crossorigin crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/@marimo-team/[email protected]/dist/assets/index.js""></script>
<link rel="stylesheet" crossorigin crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/@marimo-team/[email protected]/dist/assets/index.css"">
diff --git a/tests/_server/templates/test_templates.py b/tests/_server/templates/test_templates.py
index 871ebd8da3..634ff67acf 100644
--- a/tests/_server/templates/test_templates.py
+++ b/tests/_server/templates/test_templates.py
@@ -347,7 +347,7 @@ class TestStaticNotebookTemplate(unittest.TestCase):
self.user_config,
self.config_overrides,
self.server_token,
- _AppConfig(html_head_file="head.html"),
+ _AppConfig(html_head_file="head.html", app_title="My App"),
self.filename,
"",
hash_code(self.code),
@@ -400,6 +400,7 @@ class TestWasmNotebookTemplate(unittest.TestCase):
assert json.dumps(self.user_config) in result
assert '<marimo-wasm hidden="">' in result
assert '<marimo-code hidden="" data-show-code="false">' in result
+ assert "<title>notebook</title>" in result
def test_wasm_notebook_template_custom_css_and_assets(self) -> None:
# Create css file
@@ -456,7 +457,9 @@ class TestWasmNotebookTemplate(unittest.TestCase):
mode=self.mode,
user_config=self.user_config,
config_overrides=self.config_overrides,
- app_config=_AppConfig(html_head_file="head.html"),
+ app_config=_AppConfig(
+ html_head_file="head.html", app_title="My App"
+ ),
code=self.code,
show_code=False,
)
@@ -466,5 +469,6 @@ class TestWasmNotebookTemplate(unittest.TestCase):
assert '<marimo-code hidden="" data-show-code="false">' in result
assert "#save-button" in result
assert "#filename-input" in result
+ assert "<title>My App</title>" in result
finally:
os.remove(head_file)