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.

fix: starlette import for wasm

Myles Scolnick8993f1ad1c7d
diff --git a/marimo/_plugins/stateless/mpl/_mpl.py b/marimo/_plugins/stateless/mpl/_mpl.py
index af07ff07cb..69e4ee8665 100644
--- a/marimo/_plugins/stateless/mpl/_mpl.py
+++ b/marimo/_plugins/stateless/mpl/_mpl.py
@@ -17,8 +17,6 @@ import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, Tuple
-from starlette.websockets import WebSocketState
-
from marimo._output.builder import h
from marimo._output.formatting import as_html
from marimo._output.hypertext import Html
@@ -145,6 +143,8 @@ def create_application(
except Exception:
pass
finally:
+ from starlette.websockets import WebSocketState
+
if websocket.application_state != WebSocketState.DISCONNECTED:
await websocket.close()
@@ -159,6 +159,8 @@ def create_application(
except Exception:
pass
finally:
+ from starlette.websockets import WebSocketState
+
if websocket.application_state != WebSocketState.DISCONNECTED:
await websocket.close()