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
fix(output): Polars lazyframe query plan visualisation fix (#10087)
ohmdelta5a761aeb5c2f
diff --git a/marimo/_output/formatters/df_formatters.py b/marimo/_output/formatters/df_formatters.pyindex f7ebe708fe..67e6cc3903 100644--- a/marimo/_output/formatters/df_formatters.py+++ b/marimo/_output/formatters/df_formatters.py@@ -48,16 +48,19 @@ def polars_dot_to_mermaid(dot: str) -> str:"""edge_regex = r"(?P<node1>\w+) -- (?P<node2>\w+)"+ directed_edge_regex = r"(?P<node1>\w+) -> (?P<node2>\w+)"node_regex = r"(?P<node>\w+)(\s+)?\[label=\"(?P<label>.*)\"]"- nodes = re.finditer(node_regex, dot)edges = re.finditer(edge_regex, dot)+ directed_edges = re.finditer(directed_edge_regex, dot)+ nodes = re.finditer(node_regex, dot)mermaid_str = "\n".join(["graph TD",*[f'\t{n["node"]}["{n["label"]}"]' for n in nodes],*[f"\t{e['node1']} --- {e['node2']}" for e in edges],+ *[f"\t{e['node1']} --> {e['node2']}" for e in directed_edges],])diff --git a/tests/_output/formatters/test_formatters.py b/tests/_output/formatters/test_formatters.pyindex 603e9d7b99..c5dfce104f 100644--- a/tests/_output/formatters/test_formatters.py+++ b/tests/_output/formatters/test_formatters.py@@ -635,7 +635,6 @@ def test_polars_dot_to_mermaid() -> None:@pytest.mark.skipif(not HAS_DEPS, reason="optional dependencies not installed")[email protected](reason="TODO: skipping since upstream broken this test")def test_polars_dot_to_mermaid_complex() -> None:import polars as pl@@ -650,15 +649,15 @@ def test_polars_dot_to_mermaid_complex() -> None:assert (polars_dot_to_mermaid(ldf._ldf.to_dot(optimized=True))== """graph TD-\tp4["TABLE\nπ 2/2"]+\tp4["TABLE\nπ */2"]\tp3["FILTER BY [(col(#quot;A#quot;)) > (1)]"]\tp2["π 2/2"]\tp5["TABLE\nπ */1"]\tp1["JOIN INNER\nleft: [col(#quot;A#quot;)];\nright: [col(#quot;A#quot;)]"]-\tp1 --- p2-\tp2 --- p3-\tp3 --- p4-\tp1 --- p5"""+\tp2 --> p1+\tp3 --> p2+\tp4 --> p3+\tp5 --> p1""")