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.

improve: always add marimo in sandbox (#3439)

Akshay Agrawald51c2475d31d
diff --git a/marimo/_runtime/runtime.py b/marimo/_runtime/runtime.py
index 27030a0ff6..9c204c6771 100644
--- a/marimo/_runtime/runtime.py
+++ b/marimo/_runtime/runtime.py
@@ -549,6 +549,13 @@ class Kernel:
):
self.package_manager = create_package_manager(package_manager)
+ if self._should_update_script_metadata():
+ # All marimo notebooks depend on the marimo package; if the
+ # notebook already has marimo as a dependency, or an optional
+ # dependency group with marimo, such as marimo[sql], this is a
+ # NOOP.
+ self._update_script_metadata(["marimo"])
+
if (
autoreload_mode == "lazy" or autoreload_mode == "autorun"
# Pyodide doesn't support hot module reloading