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
chore: drop the vacuous new_superfences version gate (#10395)
Thomas Schmelzer1e23704da5d6
diff --git a/marimo/_convert/markdown/flavor/pymdown.py b/marimo/_convert/markdown/flavor/pymdown.pyindex 5bdf66d215..1853fc4cdb 100644--- a/marimo/_convert/markdown/flavor/pymdown.py+++ b/marimo/_convert/markdown/flavor/pymdown.py@@ -10,7 +10,6 @@ from marimo._convert.markdown.flavor.base import (MarkdownFlavor,_escape_attribute,)-from marimo._dependencies.dependencies import DependencyManagerclass PymdownMarkdownFlavor(MarkdownFlavor):@@ -55,11 +54,7 @@ class PymdownMarkdownFlavor(MarkdownFlavor):) -> str:# Compatible with GitHub syntax highlighting:# ```python {.marimo attr=...}- if DependencyManager.new_superfences.has_required_version(quiet=True):- return f"{guard}{language} {{.marimo{attribute_str}}}"-- # ```{.python.marimo attr=...}- return f"{guard}{{.{language}.marimo{attribute_str}}}"+ return f"{guard}{language} {{.marimo{attribute_str}}}"def _render_code_fence(self,diff --git a/marimo/_convert/markdown/to_ir.py b/marimo/_convert/markdown/to_ir.pyindex 341b4d0ddf..db6cb0cb60 100644--- a/marimo/_convert/markdown/to_ir.py+++ b/marimo/_convert/markdown/to_ir.py@@ -44,7 +44,6 @@ from marimo._convert.markdown.flavor.base import (MarkdownImportContext,MarkdownImportDialect,)-from marimo._dependencies.dependencies import DependencyManagerfrom marimo._schemas.serialization import (AppInstantiation,CellDef,@@ -91,12 +90,13 @@ def extract_attribs(def _is_code_tag(text: str) -> bool:head = text.split("\n")[0].strip()- legacy_format = bool(re.search(r"\{.*python.*\}", head))- legacy_format |= bool(re.search(r"\{.*sql.*\}", head))- if DependencyManager.new_superfences.has_required_version(quiet=True):- supported_format = bool(re.search(r".*\{.*marimo.*\}", head))- return legacy_format or supported_format- return legacy_format+ # ```python {.marimo attr=...}, and the legacy+ # ```{.python.marimo attr=...} form we still read+ return bool(+ re.search(r"\{.*python.*\}", head)+ or re.search(r"\{.*sql.*\}", head)+ or re.search(r"\{.*marimo.*\}", head)+ )def _get_language(text: str) -> str:diff --git a/marimo/_dependencies/dependencies.py b/marimo/_dependencies/dependencies.pyindex 783d2fc521..7620b57bc7 100644--- a/marimo/_dependencies/dependencies.py+++ b/marimo/_dependencies/dependencies.py@@ -287,10 +287,6 @@ class DependencyManager:cloudpathlib = Dependency("cloudpathlib")cryptography = Dependency("cryptography")- # Version requirements to properly support the new superfences introduced in- # pymdown#2470- new_superfences = Dependency("pymdownx", min_version="10.11.0")-@staticmethoddef has(pkg: str) -> bool:"""Return True if any lib is installed."""diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.pyindex 948a3a016f..9dd70db979 100644--- a/tests/_cli/test_cli_export.py+++ b/tests/_cli/test_cli_export.py@@ -955,10 +955,7 @@ class TestExportMarkdown:_assert_success(p)assert "```{marimo .python" not in p.outputassert "```{marimo} python" not in p.output- assert (- "```python {.marimo" in p.output- or "```{.python.marimo" in p.output- )+ assert "```python {.marimo" in p.output@staticmethoddef test_export_markdown_help_documents_stdout_inference() -> None:diff --git a/tests/_convert/markdown/test_markdown_conversion.py b/tests/_convert/markdown/test_markdown_conversion.pyindex 92e1423adc..b13687c2e9 100644--- a/tests/_convert/markdown/test_markdown_conversion.py+++ b/tests/_convert/markdown/test_markdown_conversion.py@@ -463,6 +463,33 @@ def test_no_frontmatter() -> None:assert len(ids) == 3+def test_legacy_code_fences_still_parse() -> None:+ """The legacy `{.python.marimo}` fence form is read, though not emitted."""+ script = dedent(+ remove_empty_lines(+ """+ # My Notebook++ ```{.python.marimo}+ print("Hello, World!")+ ```++ ```{.sql.marimo query="df"}+ SELECT 1+ ```+ """+ )+ )+ notebook_ir = convert_from_md_to_marimo_ir(script)+ app = InternalApp(load_notebook_ir(notebook_ir))+ codes = [+ app.cell_manager.cell_data_at(cell_id).code+ for cell_id in app.cell_manager.cell_ids()+ ]+ assert 'print("Hello, World!")' in codes+ assert any("SELECT 1" in code for code in codes)++def test_plain_markdown_flagged_non_marimo() -> None:"""Plain markdown parses as valid but carries a non-marimo violation."""from marimo._ast.parse import is_non_marimo_markdowndiff --git a/tests/_convert/markdown/test_markdown_from_ir.py b/tests/_convert/markdown/test_markdown_from_ir.pyindex 894334929a..51a116bd1e 100644--- a/tests/_convert/markdown/test_markdown_from_ir.py+++ b/tests/_convert/markdown/test_markdown_from_ir.py@@ -320,11 +320,7 @@ def test_convert_from_ir_to_markdown_qmd_format():# Test .md filename produces standard formatmarkdown_md = convert_from_ir_to_markdown(notebook, filename="notebook.md")- # Should use either superfences or fallback format- assert (- "```python {.marimo" in markdown_md- or "```{.python.marimo" in markdown_md- )+ assert "```python {.marimo" in markdown_mddef test_convert_from_ir_to_markdown_mdx_format():@@ -389,10 +385,7 @@ def test_convert_from_ir_to_markdown_explicit_flavor():markdown_md = convert_from_ir_to_markdown(notebook, filename="notebook.qmd", flavor="pymdown")- assert (- "```python {.marimo" in markdown_md- or "```{.python.marimo" in markdown_md- )+ assert "```python {.marimo" in markdown_md@pytest.mark.parametrize(