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.

Force asyncio in edit mode (#2442)

Akshay Agrawalea0331faff1c
diff --git a/marimo/_server/start.py b/marimo/_server/start.py
index 78261e814f..28abe060a7 100644
--- a/marimo/_server/start.py
+++ b/marimo/_server/start.py
@@ -168,6 +168,11 @@ def start(
# close the websocket if we don't receive a pong after 60 seconds
ws_ping_timeout=60,
timeout_graceful_shutdown=1,
+ # Under uvloop, reading the socket we monitor under add_reader()
+ # occasionally throws BlockingIOError (errno 11, or errno 35,
+ # ...). RUN mode no longer uses a socket (it has no IPC) but EDIT
+ # does, so force asyncio.
+ loop="asyncio" if mode == SessionMode.EDIT else "auto",
)
)
app.state.server = server
diff --git a/tests/_convert/test_convert_utils.py b/tests/_convert/test_convert_utils.py
index fbbad06089..f2a6e1eafb 100644
--- a/tests/_convert/test_convert_utils.py
+++ b/tests/_convert/test_convert_utils.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import re
from textwrap import dedent
from marimo._convert import utils
@@ -25,12 +26,13 @@ def test_generate_from_sources():
# Test with basic sources
sources = ["print('Hello')", "x = 5"]
result = utils.generate_from_sources(sources)
+ result = re.sub(r"__generated_with = .*", "", result)
assert result == dedent(
"""
import marimo
-__generated_with = "0.8.20"
+
app = marimo.App()