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: marimo export returns propper error code (#3091)

Myles Scolnickb68468906c71
diff --git a/docs/guides/exporting.md b/docs/guides/exporting.md
index c08b287f52..7725ef739f 100644
--- a/docs/guides/exporting.md
+++ b/docs/guides/exporting.md
@@ -41,6 +41,13 @@ marimo export html notebook.py -o notebook.html --watch
When you export from the command line, marimo runs your notebook to produce
its visual outputs before saving as HTML.
+```{admonition} Note
+:class: note
+
+If any cells error during the export process, the status code will be non-zero. However, the export result may still be generated, with the error included in the output.
+Errors can be ignored by appending `|| true` to the command, e.g. `marimo export html notebook.py || true`.
+```
+
## Export to a Python script
Export to a flat Python script in topological order, so the cells adhere to
diff --git a/marimo/_cli/cli_validators.py b/marimo/_cli/cli_validators.py
index 9529b136bb..bf7f1f2e81 100644
--- a/marimo/_cli/cli_validators.py
+++ b/marimo/_cli/cli_validators.py
@@ -1,4 +1,5 @@
# Copyright 2024 Marimo. All rights reserved.
+from pathlib import Path
from typing import Any, Optional
import click
@@ -19,3 +20,15 @@ def base_url(ctx: Any, param: Any, value: Optional[str]) -> str:
if value.endswith("/"):
raise click.BadParameter("Must not end with /")
return value
+
+
+def is_file_path(ctx: Any, param: Any, value: Optional[str]) -> str:
+ del ctx
+ del param
+ if not value:
+ raise click.BadParameter("Must be a file path")
+ if not Path(value).exists():
+ raise click.BadParameter(f"File does not exist: {value}")
+ if not Path(value).is_file():
+ raise click.BadParameter(f"Not a file: {value}")
+ return value
diff --git a/marimo/_cli/export/commands.py b/marimo/_cli/export/commands.py
index b08a1cb2ad..8da5d4c4ea 100644
--- a/marimo/_cli/export/commands.py
+++ b/marimo/_cli/export/commands.py
@@ -6,10 +6,12 @@ from typing import TYPE_CHECKING, Callable, Literal
import click
+import marimo._cli.cli_validators as validators
from marimo._cli.parse_args import parse_args
from marimo._cli.print import echo, green
from marimo._dependencies.dependencies import DependencyManager
from marimo._server.export import (
+ ExportResult,
export_as_ipynb,
export_as_md,
export_as_script,
@@ -34,7 +36,7 @@ def watch_and_export(
marimo_path: MarimoPath,
output: str,
watch: bool,
- export_callback: Callable[[MarimoPath], str],
+ export_callback: Callable[[MarimoPath], ExportResult],
) -> None:
if watch and not output:
raise click.UsageError(
@@ -55,14 +57,18 @@ def watch_and_export(
# No watch, just run once
if not watch:
- data = export_callback(marimo_path)
- write_data(data)
+ result = export_callback(marimo_path)
+ write_data(result.contents)
+ if result.did_error:
+ raise click.ClickException(
+ "Export was successful, but some cells failed to execute."
+ )
return
async def on_file_changed(file_path: Path) -> None:
echo(f"File {str(file_path)} changed. Re-exporting to {green(output)}")
- data = export_callback(MarimoPath(file_path))
- write_data(data)
+ result = export_callback(MarimoPath(file_path))
+ write_data(result.contents)
async def start() -> None:
# Watch the file for changes
@@ -121,7 +127,7 @@ Optionally pass CLI args to the notebook:
If not provided, the HTML will be printed to stdout.
""",
)
[email protected]("name", required=True)
[email protected]("name", required=True, callback=validators.is_file_path)
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
def html(
name: str,
@@ -136,13 +142,12 @@ def html(
cli_args = parse_args(args)
- def export_callback(file_path: MarimoPath) -> str:
- (html, _filename) = asyncio_run(
+ def export_callback(file_path: MarimoPath) -> ExportResult:
+ return asyncio_run(
run_app_then_export_as_html(
file_path, include_code=include_code, cli_args=cli_args
)
)
- return html
return watch_and_export(MarimoPath(name), output, watch, export_callback)
@@ -183,7 +188,7 @@ Watch for changes and regenerate the script on modification:
If not provided, the script will be printed to stdout.
""",
)
[email protected]("name", required=True)
[email protected]("name", required=True, callback=validators.is_file_path)
def script(
name: str,
output: str,
@@ -193,8 +198,8 @@ def script(
Export a marimo notebook as a flat script, in topological order.
"""
- def export_callback(file_path: MarimoPath) -> str:
- return export_as_script(file_path)[0]
+ def export_callback(file_path: MarimoPath) -> ExportResult:
+ return export_as_script(file_path)
return watch_and_export(MarimoPath(name), output, watch, export_callback)
@@ -235,7 +240,7 @@ Watch for changes and regenerate the script on modification:
If not provided, markdown will be printed to stdout.
""",
)
[email protected]("name", required=True)
[email protected]("name", required=True, callback=validators.is_file_path)
def md(
name: str,
output: str,
@@ -245,8 +250,8 @@ def md(
Export a marimo notebook as a code fenced markdown document.
"""
- def export_callback(file_path: MarimoPath) -> str:
- return export_as_md(file_path)[0]
+ def export_callback(file_path: MarimoPath) -> ExportResult:
+ return export_as_md(file_path)
return watch_and_export(MarimoPath(name), output, watch, export_callback)
@@ -303,7 +308,7 @@ Requires nbformat to be installed.
type=bool,
help="Run the notebook and include outputs in the exported ipynb file.",
)
[email protected]("name", required=True)
[email protected]("name", required=True, callback=validators.is_file_path)
def ipynb(
name: str,
output: str,
@@ -314,19 +319,18 @@ def ipynb(
"""
Export a marimo notebook as a Jupyter notebook in topological order.
"""
+ DependencyManager.nbformat.require(
+ why="to convert marimo notebooks to ipynb"
+ )
- def export_callback(file_path: MarimoPath) -> str:
+ def export_callback(file_path: MarimoPath) -> ExportResult:
if include_outputs:
return asyncio_run(
run_app_then_export_as_ipynb(
file_path, sort_mode=sort, cli_args={}
)
- )[0]
- return export_as_ipynb(file_path, sort_mode=sort)[0]
-
- DependencyManager.nbformat.require(
- why="to convert marimo notebooks to ipynb"
- )
+ )
+ return export_as_ipynb(file_path, sort_mode=sort)
return watch_and_export(MarimoPath(name), output, watch, export_callback)
diff --git a/marimo/_cli/print.py b/marimo/_cli/print.py
index 0cfd8d6545..d093dcdfbd 100644
--- a/marimo/_cli/print.py
+++ b/marimo/_cli/print.py
@@ -38,9 +38,12 @@ def muted(text: str) -> str:
def echo(*args: Any, **kwargs: Any) -> None:
- import click
-
if GLOBAL_SETTINGS.QUIET:
return
- click.echo(*args, **kwargs)
+ try:
+ import click
+
+ click.echo(*args, **kwargs)
+ except ModuleNotFoundError:
+ print(*args, **kwargs) # noqa: T201
diff --git a/marimo/_islands/island_generator.py b/marimo/_islands/island_generator.py
index 8ef8946e3f..7422fd77b3 100644
--- a/marimo/_islands/island_generator.py
+++ b/marimo/_islands/island_generator.py
@@ -273,10 +273,11 @@ class MarimoIslandGenerator:
if self.has_run:
raise ValueError("You can only call build() once")
- session = await run_app_until_completion(
+ (session, did_error) = await run_app_until_completion(
file_manager=AppFileManager.from_app(self._app),
cli_args={},
)
+ del did_error
self.has_run = True
for stub in self._stubs:
diff --git a/marimo/_messaging/errors.py b/marimo/_messaging/errors.py
index b39468fcc5..0349372078 100644
--- a/marimo/_messaging/errors.py
+++ b/marimo/_messaging/errors.py
@@ -13,6 +13,9 @@ class CycleError:
edges_with_vars: tuple[EdgeWithVar, ...]
type: Literal["cycle"] = "cycle"
+ def describe(self) -> str:
+ return "This cell is in a cycle"
+
@dataclass
class MultipleDefinitionError:
@@ -20,6 +23,9 @@ class MultipleDefinitionError:
cells: tuple[CellId_t, ...]
type: Literal["multiple-defs"] = "multiple-defs"
+ def describe(self) -> str:
+ return f"The variable '{self.name}' was defined by another cell"
+
@dataclass
class DeleteNonlocalError:
@@ -27,11 +33,17 @@ class DeleteNonlocalError:
cells: tuple[CellId_t, ...]
type: Literal["delete-nonlocal"] = "delete-nonlocal"
+ def describe(self) -> str:
+ return f"The variable '{self.name}' can't be deleted because it was defined by another cell"
+
@dataclass
class MarimoInterruptionError:
type: Literal["interruption"] = "interruption"
+ def describe(self) -> str:
+ return "This cell was interrupted and needs to be re-run"
+
@dataclass
class MarimoAncestorPreventedError:
@@ -40,6 +52,9 @@ class MarimoAncestorPreventedError:
blamed_cell: Optional[CellId_t]
type: Literal["ancestor-prevented"] = "ancestor-prevented"
+ def describe(self) -> str:
+ return self.msg
+
@dataclass
class MarimoAncestorStoppedError:
@@ -47,6 +62,9 @@ class MarimoAncestorStoppedError:
raising_cell: CellId_t
type: Literal["ancestor-stopped"] = "ancestor-stopped"
+ def describe(self) -> str:
+ return self.msg
+
@dataclass
class MarimoExceptionRaisedError:
@@ -56,18 +74,27 @@ class MarimoExceptionRaisedError:
raising_cell: Optional[CellId_t]
type: Literal["exception"] = "exception"
+ def describe(self) -> str:
+ return self.msg
+
@dataclass
class MarimoSyntaxError:
msg: str
type: Literal["syntax"] = "syntax"
+ def describe(self) -> str:
+ return self.msg
+
@dataclass
class UnknownError:
msg: str
type: Literal["unknown"] = "unknown"
+ def describe(self) -> str:
+ return self.msg
+
@dataclass
class MarimoStrictExecutionError:
@@ -76,6 +103,9 @@ class MarimoStrictExecutionError:
blamed_cell: Optional[CellId_t]
type: Literal["strict-exception"] = "strict-exception"
+ def describe(self) -> str:
+ return self.msg
+
Error = Union[
CycleError,
diff --git a/marimo/_plugins/ui/_impl/input.py b/marimo/_plugins/ui/_impl/input.py
index ae89c395e4..ee10a1ee59 100644
--- a/marimo/_plugins/ui/_impl/input.py
+++ b/marimo/_plugins/ui/_impl/input.py
@@ -1654,5 +1654,5 @@ def _convert_numpy_array(steps: Any) -> list[Numeric]:
import numpy as np
if isinstance(steps, np.ndarray):
- return steps.tolist() # type: ignore[no-any-return]
+ return steps.tolist() # type: ignore[return-value,no-any-return]
return steps # type: ignore[no-any-return]
diff --git a/marimo/_plugins/ui/_impl/tables/pandas_table.py b/marimo/_plugins/ui/_impl/tables/pandas_table.py
index 9f523af756..02850ea28a 100644
--- a/marimo/_plugins/ui/_impl/tables/pandas_table.py
+++ b/marimo/_plugins/ui/_impl/tables/pandas_table.py
@@ -151,6 +151,6 @@ class PandasTableManagerFactory(TableManagerFactory):
def get_unique_column_values(
self, column: str
) -> list[str | int | float]:
- return self.as_pandas_frame()[column].unique().tolist() # type: ignore[no-any-return]
+ return self.as_pandas_frame()[column].unique().tolist() # type: ignore[return-value,no-any-return]
return PandasTableManager
diff --git a/marimo/_server/export/__init__.py b/marimo/_server/export/__init__.py
index 4a05fdca14..ed17bdeba2 100644
--- a/marimo/_server/export/__init__.py
+++ b/marimo/_server/export/__init__.py
@@ -2,11 +2,16 @@
from __future__ import annotations
import asyncio
-from typing import Callable, Literal
+import sys
+from dataclasses import dataclass
+from typing import Any, Callable, Literal, cast
+from marimo._cli.print import echo
from marimo._config.manager import (
get_default_config_manager,
)
+from marimo._messaging.cell_output import CellChannel
+from marimo._messaging.errors import Error
from marimo._messaging.ops import MessageOperation
from marimo._messaging.types import KernelMessage
from marimo._output.hypertext import patch_html_for_non_interactive_output
@@ -19,65 +24,95 @@ from marimo._server.models.export import ExportAsHTMLRequest
from marimo._server.models.models import InstantiateRequest
from marimo._server.session.session_view import SessionView
from marimo._utils.marimo_path import MarimoPath
+from marimo._utils.parse_dataclass import parse_raw
+
+
+@dataclass
+class ExportResult:
+ contents: str
+ download_filename: str
+ did_error: bool
def export_as_script(
path: MarimoPath,
-) -> tuple[str, str]:
+) -> ExportResult:
file_router = AppFileRouter.from_filename(path)
file_key = file_router.get_unique_file_key()
assert file_key is not None
file_manager = file_router.get_file_manager(file_key)
- return Exporter().export_as_script(file_manager)
+ result = Exporter().export_as_script(file_manager)
+ return ExportResult(
+ contents=result[0],
+ download_filename=result[1],
+ did_error=False,
+ )
def export_as_md(
path: MarimoPath,
-) -> tuple[str, str]:
+) -> ExportResult:
file_router = AppFileRouter.from_filename(path)
file_key = file_router.get_unique_file_key()
assert file_key is not None
file_manager = file_router.get_file_manager(file_key)
- return Exporter().export_as_md(file_manager)
+ result = Exporter().export_as_md(file_manager)
+ return ExportResult(
+ contents=result[0],
+ download_filename=result[1],
+ did_error=False,
+ )
def export_as_ipynb(
path: MarimoPath,
sort_mode: Literal["top-down", "topological"],
-) -> tuple[str, str]:
+) -> ExportResult:
file_router = AppFileRouter.from_filename(path)
file_key = file_router.get_unique_file_key()
assert file_key is not None
file_manager = file_router.get_file_manager(file_key)
- return Exporter().export_as_ipynb(file_manager, sort_mode=sort_mode)
+ result = Exporter().export_as_ipynb(file_manager, sort_mode=sort_mode)
+ return ExportResult(
+ contents=result[0],
+ download_filename=result[1],
+ did_error=False,
+ )
async def run_app_then_export_as_ipynb(
path: MarimoPath,
sort_mode: Literal["top-down", "topological"],
cli_args: SerializedCLIArgs,
-) -> tuple[str, str]:
+) -> ExportResult:
file_router = AppFileRouter.from_filename(path)
file_key = file_router.get_unique_file_key()
assert file_key is not None
file_manager = file_router.get_file_manager(file_key)
with patch_html_for_non_interactive_output():
- session_view = await run_app_until_completion(file_manager, cli_args)
+ (session_view, did_error) = await run_app_until_completion(
+ file_manager, cli_args
+ )
- return Exporter().export_as_ipynb(
+ result = Exporter().export_as_ipynb(
file_manager, sort_mode=sort_mode, session_view=session_view
)
+ return ExportResult(
+ contents=result[0],
+ download_filename=result[1],
+ did_error=did_error,
+ )
async def run_app_then_export_as_html(
path: MarimoPath,
include_code: bool,
cli_args: SerializedCLIArgs,
-) -> tuple[str, str]:
+) -> ExportResult:
# Create a file router and file manager
file_router = AppFileRouter.from_filename(path)
file_key = file_router.get_unique_file_key()
@@ -85,7 +120,9 @@ async def run_app_then_export_as_html(
file_manager = file_router.get_file_manager(file_key)
config = get_default_config_manager(current_path=file_manager.path)
- session_view = await run_app_until_completion(file_manager, cli_args)
+ session_view, did_error = await run_app_until_completion(
+ file_manager, cli_args
+ )
# Export the session as HTML
html, filename = Exporter().export_as_html(
file_manager=file_manager,
@@ -97,13 +134,17 @@ async def run_app_then_export_as_html(
files=[],
),
)
- return html, filename
+ return ExportResult(
+ contents=html,
+ download_filename=filename,
+ did_error=did_error,
+ )
async def run_app_then_export_as_reactive_html(
path: MarimoPath,
include_code: bool,
-) -> tuple[str, str]:
+) -> ExportResult:
import os
from marimo._islands.island_generator import MarimoIslandGenerator
@@ -115,23 +156,51 @@ async def run_app_then_export_as_reactive_html(
html = generator.render_html()
basename = os.path.basename(path.absolute_name)
filename = f"{os.path.splitext(basename)[0]}.html"
- return html, filename
+ return ExportResult(
+ contents=html,
+ download_filename=filename,
+ did_error=False,
+ )
async def run_app_until_completion(
file_manager: AppFileManager,
cli_args: SerializedCLIArgs,
-) -> SessionView:
+) -> tuple[SessionView, bool]:
from marimo._server.sessions import Session
instantiated_event = asyncio.Event()
- # Create a no-op session consumer
- class NoopSessionConsumer(SessionConsumer):
+ class DefaultSessionConsumer(SessionConsumer):
+ def __init__(self) -> None:
+ self.did_error = False
+ super().__init__(consumer_id="default")
+
def on_start(
self,
) -> Callable[[KernelMessage], None]:
def listener(message: KernelMessage) -> None:
+ # Print errors to stderr
+ if message[0] == "cell-op":
+ op_data = message[1]
+ if (
+ op_data.get("output")
+ and op_data["output"]["channel"]
+ == CellChannel.MARIMO_ERROR
+ ):
+ errors = cast(list[Any], op_data["output"]["data"])
+
+ @dataclass
+ class Container:
+ error: Error
+
+ for err in errors:
+ parsed = parse_raw({"error": err}, Container)
+ echo(
+ f"{parsed.error.__class__.__name__}: {parsed.error.describe()}",
+ file=sys.stderr,
+ )
+ self.did_error = True
if message[0] == "completed-run":
instantiated_event.set()
@@ -159,10 +228,11 @@ async def run_app_until_completion(
)
# Create a session
+ session_consumer = DefaultSessionConsumer()
session = Session.create(
# Any initialization ID will do
initialization_id="_any_",
- session_consumer=NoopSessionConsumer(consumer_id="noop"),
+ session_consumer=session_consumer,
# Run in EDIT mode so that console outputs are captured
mode=SessionMode.EDIT,
app_metadata=AppMetadata(
@@ -192,4 +262,4 @@ async def run_app_until_completion(
# Stop distributor, terminate kernel process, etc -- all information is
# captured by the session view.
session.close()
- return session.session_view
+ return session.session_view, session_consumer.did_error
diff --git a/tests/_cli/snapshots/export_markdown_with_errors.txt b/tests/_cli/snapshots/export_markdown_with_errors.txt
new file mode 100644
index 0000000000..e7542d5d64
--- /dev/null
+++ b/tests/_cli/snapshots/export_markdown_with_errors.txt
@@ -0,0 +1,16 @@
+---
+title: Notebook
+marimo-version: 0.0.0
+---
+
+```{.python.marimo}
+import marimo as mo
+```
+
+```{.python.marimo}
+slider = mo.ui.slider(0, 10)
+```
+
+```{.python.marimo}
+1 / 0
+```
diff --git a/tests/_cli/snapshots/ipynb_with_errors.txt b/tests/_cli/snapshots/ipynb_with_errors.txt
new file mode 100644
index 0000000000..125404d40d
--- /dev/null
+++ b/tests/_cli/snapshots/ipynb_with_errors.txt
@@ -0,0 +1,52 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "Hbol",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import marimo as mo"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "MJUe",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "slider = mo.ui.slider(0, 10)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "vblA",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "<span class=\"codehilite\"><div class=\"highlight\"><pre><span></span><span class=\"gt\">Traceback (most recent call last):</span>\n",
+ "<span class=\"w\"> </span><span class=\"k\">return</span> <span class=\"nb\">eval</span><span class=\"p\">(</span><span class=\"n\">cell</span><span class=\"o\">.</span><span class=\"n\">last_expr</span><span class=\"p\">,</span> <span class=\"n\">glbls</span><span class=\"p\">)</span>\n",
+ "<span class=\"w\"> </span><span class=\"pm\">^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>\n",
+ "<span class=\"w\"> </span><span class=\"mi\">1</span> <span class=\"o\">/</span> <span class=\"mi\">0</span>\n",
+ "<span class=\"w\"> </span><span class=\"pm\">~~^~~</span>\n",
+ "<span class=\"gr\">ZeroDivisionError</span>: <span class=\"n\">division by zero</span>\n",
+ "</pre></div>\n",
+ "</span>"
+ ]
+ }
+ ],
+ "source": [
+ "1 / 0"
+ ]
+ }
+ ],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/tests/_cli/snapshots/script_with_errors.txt b/tests/_cli/snapshots/script_with_errors.txt
new file mode 100644
index 0000000000..026c1a3d50
--- /dev/null
+++ b/tests/_cli/snapshots/script_with_errors.txt
@@ -0,0 +1,11 @@
+
+__generated_with = "0.0.0"
+
+# %%
+import marimo as mo
+
+# %%
+slider = mo.ui.slider(0, 10)
+
+# %%
+1 / 0
diff --git a/tests/_cli/test_cli_config.py b/tests/_cli/test_cli_config.py
index a313514af8..52a651d242 100644
--- a/tests/_cli/test_cli_config.py
+++ b/tests/_cli/test_cli_config.py
@@ -3,7 +3,12 @@ from __future__ import annotations
import subprocess
+import pytest
+from marimo._utils.platform import is_windows
+
+
[email protected](condition=is_windows(), reason="flaky on Windows")
def test_config_show() -> None:
p = subprocess.run(
["marimo", "config", "show"],
diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.py
index 5cb6fe8b67..704f6294da 100644
--- a/tests/_cli/test_cli_export.py
+++ b/tests/_cli/test_cli_export.py
@@ -6,6 +6,7 @@ import inspect
import subprocess
import sys
from os import path
+from pathlib import Path
from typing import TYPE_CHECKING
import pytest
@@ -73,6 +74,38 @@ class TestExportHTML:
html = html.replace(dirname, "path")
assert '<marimo-code hidden=""></marimo-code>' not in html
+ @staticmethod
+ def test_export_html_with_errors(
+ temp_marimo_file_with_errors: str,
+ ) -> None:
+ p = subprocess.run(
+ ["marimo", "export", "html", temp_marimo_file_with_errors],
+ capture_output=True,
+ )
+ assert p.returncode != 0, p.stderr.decode()
+ html = normalize_index_html(p.stdout.decode())
+ # Errors but still produces HTML
+ assert "ZeroDivisionError" in p.stderr.decode()
+ assert "<marimo-code" in html
+
+ @staticmethod
+ def test_export_html_with_multiple_definitions(
+ temp_marimo_file_with_multiple_definitions: str,
+ ) -> None:
+ p = subprocess.run(
+ [
+ "marimo",
+ "export",
+ "html",
+ temp_marimo_file_with_multiple_definitions,
+ ],
+ capture_output=True,
+ )
+ assert p.returncode != 0, p.stderr.decode()
+ # Errors but still produces HTML
+ assert "MultipleDefinitionError" in p.stderr.decode()
+ assert "<marimo-code" in p.stdout.decode()
+
@pytest.mark.skipif(
condition=DependencyManager.watchdog.has(),
reason="hangs when watchdog is installed",
@@ -148,7 +181,7 @@ class TestExportHtmlSmokeTests:
def assert_not_errored(
self, p: subprocess.CompletedProcess[bytes]
) -> None:
- assert p.returncode == 0
+ assert p.returncode == 0, p.stderr.decode()
assert not any(
line.startswith("Traceback")
for line in p.stderr.decode().splitlines()
@@ -158,6 +191,17 @@ class TestExportHtmlSmokeTests:
for line in p.stdout.decode().splitlines()
)
+ def assert_has_errors(self, p: subprocess.CompletedProcess[bytes]) -> None:
+ assert p.returncode != 0, p.stderr.decode()
+ assert any(
+ "Export was successful, but some cells failed to execute" in line
+ for line in p.stderr.decode().splitlines()
+ ), p.stderr.decode()
+ assert not any(
+ line.startswith("Traceback")
+ for line in p.stdout.decode().splitlines()
+ ), p.stdout.decode()
+
def test_export_intro_tutorial(self, tmp_path: pathlib.Path) -> None:
from marimo._tutorials import intro
@@ -168,6 +212,7 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
+ assert Path(out).exists()
self.assert_not_errored(p)
def test_export_ui_tutorial(self, tmp_path: pathlib.Path) -> None:
@@ -180,6 +225,7 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
+ assert Path(out).exists()
self.assert_not_errored(p)
def test_export_dataflow_tutorial(self, tmp_path: pathlib.Path) -> None:
@@ -192,7 +238,7 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
- self.assert_not_errored(p)
+ self.assert_has_errors(p)
def test_export_layout_tutorial(self, tmp_path: pathlib.Path) -> None:
from marimo._tutorials import layout as mod
@@ -204,8 +250,13 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
+ assert Path(out).exists()
self.assert_not_errored(p)
+ @pytest.mark.skipif(
+ condition=not DependencyManager.matplotlib.has(),
+ reason="matplotlib is not installed",
+ )
def test_export_plots_tutorial(self, tmp_path: pathlib.Path) -> None:
from marimo._tutorials import plots as mod
@@ -216,6 +267,7 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
+ assert Path(out).exists()
self.assert_not_errored(p)
def test_export_marimo_for_jupyter_users(
@@ -230,7 +282,8 @@ class TestExportHtmlSmokeTests:
["marimo", "export", "html", str(file), "-o", str(out)],
capture_output=True,
)
- self.assert_not_errored(p)
+ assert Path(out).exists()
+ self.assert_has_errors(p)
class TestExportScript:
@@ -257,6 +310,41 @@ class TestExportScript:
in p.stderr.decode()
)
+ @staticmethod
+ def test_export_script_with_multiple_definitions(
+ temp_marimo_file_with_multiple_definitions: str,
+ ) -> None:
+ p = subprocess.run(
+ [
+ "marimo",
+ "export",
+ "script",
+ temp_marimo_file_with_multiple_definitions,
+ ],
+ capture_output=True,
+ )
+ assert (
+ p.returncode != 0
+ ), "Expected non-zero return code due to multiple definitions"
+ error_message = p.stderr.decode()
+ assert (
+ "MultipleDefinitionError: This app can't be run because it has multiple definitions of the name x"
+ in error_message
+ )
+
+ @staticmethod
+ def test_export_script_with_errors(
+ temp_marimo_file_with_errors: str,
+ ) -> None:
+ p = subprocess.run(
+ ["marimo", "export", "script", temp_marimo_file_with_errors],
+ capture_output=True,
+ )
+ assert p.returncode == 0, p.stderr.decode()
+ output = p.stdout.decode()
+ output = output.replace(__version__, "0.0.0")
+ snapshot("script_with_errors.txt", output)
+
@pytest.mark.skipif(
condition=DependencyManager.watchdog.has() or _is_win32(),
reason="hangs when watchdog is installed, flaky on Windows",
@@ -366,6 +454,19 @@ class TestExportMarkdown:
output = output.replace(__version__, "0.0.0")
snapshot("broken.txt", output)
+ @staticmethod
+ def test_export_markdown_with_errors(
+ temp_marimo_file_with_errors: str,
+ ) -> None:
+ p = subprocess.run(
+ ["marimo", "export", "md", temp_marimo_file_with_errors],
+ capture_output=True,
+ )
+ assert p.returncode == 0, p.stderr.decode()
+ output = p.stdout.decode()
+ output = output.replace(__version__, "0.0.0")
+ snapshot("export_markdown_with_errors.txt", output)
+
@pytest.mark.skipif(
condition=DependencyManager.watchdog.has() or _is_win32(),
reason="hangs when watchdog is installed, flaky on Windows",
@@ -522,3 +623,53 @@ class TestExportIpynb:
# Outputs should be different since one includes execution results
assert no_outputs != with_outputs
+
+ @pytest.mark.skipif(
+ not DependencyManager.nbformat.has(),
+ reason="This test requires nbformat.",
+ )
+ def test_export_ipynb_with_multiple_definitions(
+ self, temp_marimo_file_with_multiple_definitions: str
+ ) -> None:
+ p = subprocess.run(
+ [
+ "marimo",
+ "export",
+ "ipynb",
+ temp_marimo_file_with_multiple_definitions,
+ "--include-outputs",
+ ],
+ capture_output=True,
+ )
+ assert p.returncode != 0, p.stderr.decode()
+ assert "MultipleDefinitionError" in p.stderr.decode()
+ assert p.stdout.decode() == ""
+
+ @pytest.mark.skipif(
+ not DependencyManager.nbformat.has(),
+ reason="This test requires nbformat.",
+ )
+ def test_export_ipynb_with_errors(
+ self, temp_marimo_file_with_errors: str
+ ) -> None:
+ p = subprocess.run(
+ [
+ "marimo",
+ "export",
+ "ipynb",
+ temp_marimo_file_with_errors,
+ "--include-outputs",
+ ],
+ capture_output=True,
+ )
+ assert p.returncode != 0, p.stderr.decode()
+ assert "ZeroDivisionError" in p.stderr.decode()
+ output = p.stdout.decode()
+ output = _delete_lines_with_files(output.replace(__version__, "0.0.0"))
+ snapshot("ipynb_with_errors.txt", output)
+
+
+def _delete_lines_with_files(output: str) -> str:
+ return "\n".join(
+ line for line in output.splitlines() if "File " not in line
+ )
diff --git a/tests/_cli/test_markdown_conversion.py b/tests/_cli/test_markdown_conversion.py
index 2eeecc4e8c..15b50607b1 100644
--- a/tests/_cli/test_markdown_conversion.py
+++ b/tests/_cli/test_markdown_conversion.py
@@ -46,7 +46,7 @@ def convert_from_py(py: str) -> str:
tempfile_name = f.name
f.write(py)
f.seek(0)
- output = export_as_md(MarimoPath(tempfile_name))[0]
+ output = export_as_md(MarimoPath(tempfile_name)).contents
finally:
os.remove(tempfile_name)
@@ -63,7 +63,9 @@ def convert_from_py(py: str) -> str:
)
def test_markdown_snapshots() -> None:
for name, mod in modules.items():
- output = sanitized_version(export_as_md(MarimoPath(mod.__file__))[0])
+ output = sanitized_version(
+ export_as_md(MarimoPath(mod.__file__)).contents
+ )
snapshot(f"{name}.md.txt", output)
diff --git a/tests/_server/export/snapshots/notebook_with_outputs.ipynb.txt b/tests/_server/export/snapshots/notebook_with_outputs.ipynb.txt
index cfba86683a..d1ac396c87 100644
--- a/tests/_server/export/snapshots/notebook_with_outputs.ipynb.txt
+++ b/tests/_server/export/snapshots/notebook_with_outputs.ipynb.txt
@@ -23,44 +23,6 @@
"execution_count": null,
"id": "MJUe",
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "world\n"
- ]
- }
- ],
- "source": [
- "import sys\n",
- "\n",
- "sys.stdout.write(\"world\\n\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "vblA",
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "error\n"
- ]
- }
- ],
- "source": [
- "sys.stderr.write(\"error\\n\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "bkHC",
- "metadata": {},
"outputs": [],
"source": [
"x = 10"
@@ -69,7 +31,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "lEQa",
+ "id": "vblA",
"metadata": {},
"outputs": [
{
@@ -90,7 +52,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "PKri",
+ "id": "bkHC",
"metadata": {},
"outputs": [],
"source": [
@@ -99,7 +61,7 @@
},
{
"cell_type": "markdown",
- "id": "Xref",
+ "id": "lEQa",
"metadata": {},
"source": [
"hello"
@@ -108,7 +70,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "SFPL",
+ "id": "PKri",
"metadata": {},
"outputs": [
{
@@ -128,64 +90,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "BYtC",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/markdown": [
- "<div><style>\n",
- ".dataframe > thead > tr,\n",
- ".dataframe > tbody > tr {\n",
- " text-align: right;\n",
- " white-space: pre-wrap;\n",
- "}\n",
- "</style>\n",
- "<small>shape: (3, 1)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>a</th></tr><tr><td>i64</td></tr></thead><tbody><tr><td>1</td></tr><tr><td>2</td></tr><tr><td>3</td></tr></tbody></table></div>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "import polars as pl\n",
- "\n",
- "df = pl.DataFrame({\"a\": [1, 2, 3]})\n",
- "df"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "RGSE",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/markdown": [
- "<div><style>\n",
- ".dataframe > thead > tr,\n",
- ".dataframe > tbody > tr {\n",
- " text-align: right;\n",
- " white-space: pre-wrap;\n",
- "}\n",
- "</style>\n",
- "<small>shape: (3, 1)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>a</th></tr><tr><td>i64</td></tr></thead><tbody><tr><td>1</td></tr><tr><td>2</td></tr><tr><td>3</td></tr></tbody></table></div>"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "mo.ui.table(df)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Kclp",
+ "id": "Xref",
"metadata": {},
"outputs": [
{
@@ -205,13 +110,13 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "emfo",
+ "id": "SFPL",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
- "<div style='display: flex;flex: 1;flex-direction: column;justify-content: flex-start;align-items: normal;flex-wrap: nowrap;gap: 0.5rem'><div><span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">hello</span></span></div><div><span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">world</span></span></div><div><marimo-mime-renderer data-mime='&quot;text/markdown&quot;' data-data='&quot;&lt;div&gt;&lt;style&gt;&#92;n.dataframe &gt; thead &gt; tr,&#92;n.dataframe &gt; tbody &gt; tr {&#92;n text-align: right;&#92;n white-space: pre-wrap;&#92;n}&#92;n&lt;/style&gt;&#92;n&lt;small&gt;shape: (3, 1)&lt;/small&gt;&lt;table border=&#92;&quot;1&#92;&quot; class=&#92;&quot;dataframe&#92;&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;a&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;i64&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&quot;'></marimo-mime-renderer></div></div>"
+ "<div style='display: flex;flex: 1;flex-direction: column;justify-content: flex-start;align-items: normal;flex-wrap: nowrap;gap: 0.5rem'><div><span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">hello</span></span></div><div><span class=\"markdown prose dark:prose-invert\"><span class=\"paragraph\">world</span></span></div></div>"
]
},
"metadata": {},
@@ -219,48 +124,7 @@
}
],
"source": [
- "mo.vstack([mo.md(\"hello\"), mo.md(\"world\"), df])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "Hstk",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "application/vnd.vegalite.v5+json": "{\n \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.20.1.json\",\n \"config\": {\n \"view\": {\n \"continuousHeight\": 300,\n \"continuousWidth\": 300\n }\n },\n \"data\": {\n \"name\": \"data-eee7b1e4b6c75ac82244a034063d66fd\"\n },\n \"datasets\": {\n \"data-eee7b1e4b6c75ac82244a034063d66fd\": [\n {\n \"a\": 1\n },\n {\n \"a\": 2\n },\n {\n \"a\": 3\n }\n ]\n },\n \"encoding\": {\n \"x\": {\n \"field\": \"a\",\n \"type\": \"quantitative\"\n }\n },\n \"mark\": {\n \"type\": \"point\"\n },\n \"usermeta\": {\n \"embedOptions\": {}\n }\n}"
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "import altair as alt\n",
- "\n",
- "chart = alt.Chart(df).mark_point().encode(x=\"a\")\n",
- "chart"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "nWHF",
- "metadata": {},
- "outputs": [
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/GU6VOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA+QUlEQVR4nO3dZ3xUdd7+8c9MyiRAEgiQkEDoVUqKiCKyiqIIiGKhxVtxLau3CSBYVmyIDXQRpUTdorLuEqqABUQRRQRRFlLoNQECIaGnZ5LMnP8D/7I3CpKETM7M5Hq/XvNgDuc4V36bzFx7vmdmLIZhGIiIiIiYxGp2ABEREanbVEZERETEVCojIiIiYiqVERERETGVyoiIiIiYSmVERERETKUyIiIiIqZSGRERERFT+ZodoDKcTifZ2dkEBQVhsVjMjiMiIiKVYBgGBQUFREZGYrVe+PyHR5SR7OxsoqKizI4hIiIi1ZCVlUWLFi0u+O8eUUaCgoKAn3+Y4OBgk9OIiIhIZeTn5xMVFXX2dfxCPKKM/DKaCQ4OVhkRERHxMBe7xEIXsIqIiIipVEZERETEVCojIiIiYiqVERERETGVyoiIiIiYSmVERERETKUyIiIiIqZSGRERERFTqYyIiIiIqapURqZMmcIVV1xBUFAQYWFhDB06lN27d1/0uEWLFtG5c2cCAgLo3r07K1asqHZgERER8S5VKiPfffcdCQkJ/Pjjj6xatYry8nJuuukmioqKLnjMDz/8wKhRo3jggQdITU1l6NChDB06lG3btl1yeBEREfF8FsMwjOoefPz4ccLCwvjuu+/4wx/+cN59RowYQVFREZ9//vnZbVdddRUxMTG89957lXqc/Px8QkJCyMvL03fTiIiIeIjKvn5f0jUjeXl5AISGhl5wnw0bNtC/f/9ztg0YMIANGzZc8Bi73U5+fv45NxERE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s3bqVtLS0s7dbb72Vfv36kZaWRlRUVG3G9xjV+X3u06cP+/btO1v2APbs2UNERISKyAVUZ52Li4t/Uzh+KYCGvmatxpjyWuiyS2PdwPz58w2bzWbMmTPH2LFjh/GnP/3JaNiwoZGTk2MYhmHcc889xtNPP312//Xr1xu+vr7GtGnTjJ07dxqTJk3SW3srqaprPXXqVMPf399YvHixcfTo0bO3goICs34Ej1DVdf41vZumcqq6zocOHTKCgoKMxMREY/fu3cbnn39uhIWFGa+88opZP4JHqOo6T5o0yQgKCjLmzZtnZGRkGF999ZXRrl07Y/jw4Wb9CB6hoKDASE1NNVJTUw3AmD59upGammocPHjQMAzDePrpp4177rnn7P6/vLX3ySefNHbu3GkkJSXprb2XatasWUbLli0Nf39/o1evXsaPP/549t+uvfZaY/To0efsv3DhQqNjx46Gv7+/0bVrV2P58uW1nNhzVWWtW7VqZQC/uU2aNKn2g3uYqv5O/18qI5VX1XX+4YcfjCuvvNKw2WxG27ZtjVdffdWoqKio5dSepyrrXF5ebrz44otGu3btjICAACMqKsp49NFHjdOnT9d+cA/y7bffnvf59pe1HT16tHHttdf+5piYmBjD39/faNu2rfHhhx+6NKPFMHRuS0RERMzjtdeMiIiIiGdQGRERERFTqYyIiIiIqVRGRERExFQqIyIiImIqlRERERExlcqIiIiImEplREREREylMiIiIiKmUhkRERERU6mMiIiIiKlURkRERMRU/w/+QUONzMncwAAAAABJRU5ErkJggg=="
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "\n",
- "plt.plot([1, 2])"
+ "mo.vstack([mo.md(\"hello\"), mo.md(\"world\")])"
]
}
],
diff --git a/tests/_server/export/test_exporter.py b/tests/_server/export/test_exporter.py
index a381f14f7e..c5e3236159 100644
--- a/tests/_server/export/test_exporter.py
+++ b/tests/_server/export/test_exporter.py
@@ -89,10 +89,6 @@ HAS_DEPS = (
# ruff: noqa: B018
@pytest.mark.skipif(not HAS_DEPS, reason="optional dependencies not installed")
- reason="Can be flaky and not finish",
- strict=False,
-)
async def test_export_ipynb_with_outputs():
app = App()
@@ -102,19 +98,19 @@ async def test_export_ipynb_with_outputs():
print("hello")
return ()
- # stdout
- @app.cell()
- def cell_2():
- import sys
+ # # stdout
+ # @app.cell()
+ # def cell_2():
+ # import sys
- sys.stdout.write("world\n")
- return (sys,)
+ # sys.stdout.write("world\n")
+ # return (sys,)
- # stderr
- @app.cell()
- def cell_3(sys):
- sys.stderr.write("error\n")
- return ()
+ # # stderr
+ # @app.cell()
+ # def cell_3(sys):
+ # sys.stderr.write("error\n")
+ # return ()
# This includes the filepath in the error message, which is not
# good for snapshots
@@ -156,19 +152,19 @@ async def test_export_ipynb_with_outputs():
return ()
# # polars
- @app.cell()
- def cell_9():
- import polars as pl
+ # @app.cell()
+ # def cell_9():
+ # import polars as pl
- df = pl.DataFrame({"a": [1, 2, 3]})
- df
- return (df,)
+ # df = pl.DataFrame({"a": [1, 2, 3]})
+ # df
+ # return (df,)
# mo.ui.table
- @app.cell()
- def cell_10(df, mo):
- mo.ui.table(df)
- return ()
+ # @app.cell()
+ # def cell_10(df, mo):
+ # mo.ui.table(df)
+ # return ()
# slider
@app.cell()
@@ -178,26 +174,26 @@ async def test_export_ipynb_with_outputs():
# hstack
@app.cell()
- def cell_12(mo, df):
- mo.vstack([mo.md("hello"), mo.md("world"), df])
+ def cell_12(mo):
+ mo.vstack([mo.md("hello"), mo.md("world")])
return ()
- # altair chart
- @app.cell()
- def cell_13(df):
- import altair as alt
+ # # altair chart
+ # @app.cell()
+ # def cell_13(df):
+ # import altair as alt
- chart = alt.Chart(df).mark_point().encode(x="a")
- chart
- return (chart,)
+ # chart = alt.Chart(df).mark_point().encode(x="a")
+ # chart
+ # return (chart,)
- # matplotlib
- @app.cell()
- def cell_14():
- import matplotlib.pyplot as plt
+ # # matplotlib
+ # @app.cell()
+ # def cell_14():
+ # import matplotlib.pyplot as plt
- plt.plot([1, 2])
- return (plt,)
+ # plt.plot([1, 2])
+ # return (plt,)
file_manager = AppFileManager.from_app(InternalApp(app))
exporter = Exporter()
@@ -209,11 +205,12 @@ async def test_export_ipynb_with_outputs():
# Create a session view with outputs
with patch_html_for_non_interactive_output():
- session_view = await run_app_until_completion(
+ session_view, did_error = await run_app_until_completion(
file_manager, cli_args={}
)
content, filename = exporter.export_as_ipynb(
file_manager, sort_mode="top-down", session_view=session_view
)
+ assert not did_error
assert filename == "notebook.ipynb"
snapshot("notebook_with_outputs.ipynb.txt", content)
diff --git a/tests/conftest.py b/tests/conftest.py
index 54e7df6a4b..3cbc84e832 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -379,6 +379,75 @@ def temp_md_marimo_file() -> Generator[str, None, None]:
tmp_dir.cleanup()
+def temp_marimo_file_with_errors() -> Generator[str, None, None]:
+ tmp_dir = TemporaryDirectory()
+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")
+ content = inspect.cleandoc(
+ """
+ import marimo
+ app = marimo.App()
+
+ @app.cell
+ def __():
+ import marimo as mo
+ return mo,
+
+ @app.cell
+ def __(mo):
+ slider = mo.ui.slider(0, 10)
+ return slider,
+
+ @app.cell
+ def __():
+ 1 / 0
+ return
+
+ if __name__ == "__main__":
+ app.run()
+ """
+ )
+
+ try:
+ with open(tmp_file, "w") as f:
+ f.write(content)
+ yield tmp_file
+ finally:
+ tmp_dir.cleanup()
+
+
+def temp_marimo_file_with_multiple_definitions() -> Generator[str, None, None]:
+ tmp_dir = TemporaryDirectory()
+ tmp_file = os.path.join(tmp_dir.name, "notebook.py")
+ content = inspect.cleandoc(
+ """
+ import marimo
+ app = marimo.App()
+
+ @app.cell
+ def __():
+ x = 1
+ return x,
+
+ @app.cell
+ def __():
+ x = 2
+ return x,
+
+ if __name__ == "__main__":
+ app.run()
+ """
+ )
+
+ try:
+ with open(tmp_file, "w") as f:
+ f.write(content)
+ yield tmp_file
+ finally:
+ tmp_dir.cleanup()
+
+
# Factory to create ExecutionRequests and abstract away cell ID
class ExecReqProvider:
def __init__(self) -> None: