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.

Remove inspect call from top level (#3833)

Dylan Madisetti39673fb251aa
diff --git a/marimo/_ast/pytest.py b/marimo/_ast/pytest.py
index bf8fcdac02..2aee4f47a5 100644
--- a/marimo/_ast/pytest.py
+++ b/marimo/_ast/pytest.py
@@ -14,10 +14,11 @@ def _pytest_scaffold(stub: Any) -> Any:
return stub(stub=stub)
-PYTEST_BASE = ast.parse(inspect.getsource(_pytest_scaffold))
-
-
def wrap_fn_for_pytest(func: Fn, cell: Cell) -> Callable[..., Any]:
+ # Avoid declaring the function in the global scope, since it may cause
+ # issues with meta-analysis tools like cxfreeze (see #3828).
+ PYTEST_BASE = ast.parse(inspect.getsource(_pytest_scaffold))
+
# We modify the signature of the cell function such that pytest
# does not attempt to use the arguments as fixtures.