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.

Stop HTTP Server for MPL Interactive on cleanup (#286)

Akshay Agrawalce54cb7d6eda
diff --git a/marimo/_plugins/stateless/mpl/_mpl.py b/marimo/_plugins/stateless/mpl/_mpl.py
index 7d15b07449..88a43d1966 100644
--- a/marimo/_plugins/stateless/mpl/_mpl.py
+++ b/marimo/_plugins/stateless/mpl/_mpl.py
@@ -252,6 +252,8 @@ def interactive(figure: "Figure | Axes") -> Html: # type: ignore[name-defined]
http_server = tornado.httpserver.HTTPServer(application)
http_server.add_sockets(sockets)
await cleanup_handle.shutdown_event.wait()
+ http_server.stop()
+ await http_server.close_all_connections()
def start_server() -> None:
asyncio.run(main())