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: parsing in python-314 (#7227)
Dylan Madisettia255d5a33d90
diff --git a/marimo/_ast/parse.py b/marimo/_ast/parse.pyindex 9cda622364..3f3a54dcd3 100644--- a/marimo/_ast/parse.py+++ b/marimo/_ast/parse.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport astimport io+import sysimport token as token_typesimport warningsfrom pathlib import Path@@ -187,7 +188,7 @@ class Extractor:if node.lineno - node.body[0].lineno == 0:# Quirk where the ellipse token seems to have a line index at# the end of the dots ...<- if isinstance(getattr(node.body[0], "value", None), ast.Ellipsis):+ if _is_ellipsis(getattr(node.body[0], "value", None)):col_offset += node.body[0].col_offset - 3else:col_offset += node.body[0].col_offset - 1@@ -909,6 +910,14 @@ def is_body_cell(node: Node) -> bool:) or is_unparsable_cell(node)+def _is_ellipsis(node: Optional[Node]) -> bool:+ if node is None:+ return False+ if sys.version_info < (3, 14):+ return isinstance(node, ast.Ellipsis)+ return isinstance(node, ast.Constant) and node.value == ...++def _is_setup_call(node: Node) -> bool:if isinstance(node, ast.Attribute):return (diff --git a/tests/_ast/codegen_data/test_get_codes_single_line_fn.py b/tests/_ast/codegen_data/test_get_codes_single_line_fn.pyindex 10ab2db776..e814937025 100644--- a/tests/_ast/codegen_data/test_get_codes_single_line_fn.py+++ b/tests/_ast/codegen_data/test_get_codes_single_line_fn.py@@ -7,6 +7,9 @@ app = marimo.App()@app.celldef one(a: int, b: int) -> None: c = a + b; print(c); return (c,)+def two(a: int, b: int) -> None: ...+if __name__ == "__main__":app.run()diff --git a/tests/_ast/test_load.py b/tests/_ast/test_load.pyindex 8cfab78b2a..04e419760f 100644--- a/tests/_ast/test_load.py+++ b/tests/_ast/test_load.py@@ -170,8 +170,8 @@ class TestGetCodes:app = load_app(get_filepath("test_get_codes_single_line_fn"))assert app is not Nonecell_manager = app._cell_manager- assert list(cell_manager.names()) == ["one"]- assert list(cell_manager.codes()) == ["c = a + b; print(c); "]+ assert list(cell_manager.names()) == ["one", "two"]+ assert list(cell_manager.codes()) == ["c = a + b; print(c); ", "..."]@staticmethoddef test_get_codes_multiline_string(load_app) -> None: