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.

do not prompt for overwrite when exporting wasm to an empty directory (#8591)

Michael Chavindab9cb2c912ff4
diff --git a/marimo/_cli/export/commands.py b/marimo/_cli/export/commands.py
index df9128a11f..54d3868d74 100644
--- a/marimo/_cli/export/commands.py
+++ b/marimo/_cli/export/commands.py
@@ -885,12 +885,10 @@ def html_wasm(
out_dir = output
filename = "index.html"
- ignore_index_html = False
# If ends with .html, get the directory
if output.suffix == ".html":
out_dir = output.parent
filename = output.name
- ignore_index_html = True
marimo_file = MarimoPath(name)
@@ -898,7 +896,7 @@ def html_wasm(
return export_as_wasm(file_path, mode, show_code=show_code)
# Export assets first
- Exporter().export_assets(out_dir, ignore_index_html=ignore_index_html)
+ Exporter().export_assets(out_dir)
# Create .nojekyll file to prevent GitHub Pages from interfering with asset
# resolution
diff --git a/marimo/_server/export/exporter.py b/marimo/_server/export/exporter.py
index 9f51da679d..cbf3804763 100644
--- a/marimo/_server/export/exporter.py
+++ b/marimo/_server/export/exporter.py
@@ -555,9 +555,7 @@ class Exporter:
return None
return pdf_data
- def export_assets(
- self, directory: Path, ignore_index_html: bool = False
- ) -> None:
+ def export_assets(self, directory: Path) -> None:
# Copy assets to the same directory as the notebook
dirpath = Path(directory)
LOGGER.debug(f"Copying assets to {dirpath}")
@@ -570,11 +568,7 @@ class Exporter:
ROOT,
dirpath,
dirs_exist_ok=True,
- ignore=(
- shutil.ignore_patterns("index.html")
- if ignore_index_html
- else None
- ),
+ ignore=(shutil.ignore_patterns("index.html")),
)
def export_public_folder(
diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.py
index c2278110e1..5c4edbfad2 100644
--- a/tests/_cli/test_cli_export.py
+++ b/tests/_cli/test_cli_export.py
@@ -107,6 +107,7 @@ class TestExportHTML:
)
_assert_success(p)
html = Path(out_dir / "index.html").read_text()
+ assert "{ filename }" not in html
assert '"mode": "edit"' in html
assert '<marimo-code hidden=""></marimo-code>' not in html
assert "<marimo-wasm" in html