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: sandbox requirements from 'marimo edit <url>' (#7104)

Myles Scolnick59340a33dce2
diff --git a/frontend/src/core/export/hooks.ts b/frontend/src/core/export/hooks.ts
index 8dc76f87ef..b1f2989f08 100644
--- a/frontend/src/core/export/hooks.ts
+++ b/frontend/src/core/export/hooks.ts
@@ -17,9 +17,10 @@ export function useAutoExport() {
const htmlEnabled = appConfig.auto_download.includes("html");
const ipynbEnabled = appConfig.auto_download.includes("ipynb");
- const markdownDisabled = !markdownEnabled || state !== WebSocketState.OPEN;
- const htmlDisabled = !htmlEnabled || state !== WebSocketState.OPEN;
- const ipynbDisabled = !ipynbEnabled || state !== WebSocketState.OPEN;
+ const isConnected = state === WebSocketState.OPEN;
+ const markdownDisabled = !markdownEnabled || !isConnected;
+ const htmlDisabled = !htmlEnabled || !isConnected;
+ const ipynbDisabled = !ipynbEnabled || !isConnected;
const { autoExportAsHTML, autoExportAsIPYNB, autoExportAsMarkdown } =
useRequestClient();
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.py
index 134eab0c29..18782ff1b4 100644
--- a/marimo/_cli/cli.py
+++ b/marimo/_cli/cli.py
@@ -462,15 +462,6 @@ def edit(
)
return
- if should_run_in_sandbox(
- sandbox=sandbox, dangerous_sandbox=dangerous_sandbox, name=name
- ):
- from marimo._cli.sandbox import run_in_sandbox
-
- # TODO: consider adding recommended as well
- run_in_sandbox(sys.argv[1:], name=name, additional_features=["lsp"])
- return
-
GLOBAL_SETTINGS.PROFILE_DIR = profile_dir
if not skip_update_check and os.getenv("MARIMO_SKIP_UPDATE_CHECK") != "1":
GLOBAL_SETTINGS.CHECK_STATUS_UPDATE = True
@@ -509,6 +500,17 @@ def edit(
else:
name = os.getcwd()
+ # We check this after name validation, because this will convert
+ # URLs into local file paths
+ if should_run_in_sandbox(
+ sandbox=sandbox, dangerous_sandbox=dangerous_sandbox, name=name
+ ):
+ from marimo._cli.sandbox import run_in_sandbox
+
+ # TODO: consider adding recommended as well
+ run_in_sandbox(sys.argv[1:], name=name, additional_features=["lsp"])
+ return
+
start(
file_router=AppFileRouter.infer(name),
development_mode=GLOBAL_SETTINGS.DEVELOPMENT_MODE,
@@ -940,12 +942,6 @@ def run(
)
return
- if should_run_in_sandbox(
- sandbox=sandbox, dangerous_sandbox=None, name=name
- ):
- run_in_sandbox(sys.argv[1:], name=name)
- return
-
# Validate name, or download from URL
# The second return value is an optional temporary directory. It is unused,
# but must be kept around because its lifetime on disk is bound to the life
@@ -966,6 +962,14 @@ def run(
+ message.strip()
)
+ # We check this after name validation, because this will convert
+ # URLs into local file paths
+ if should_run_in_sandbox(
+ sandbox=sandbox, dangerous_sandbox=None, name=name
+ ):
+ run_in_sandbox(sys.argv[1:], name=name)
+ return
+
start(
file_router=AppFileRouter.from_filename(file),
development_mode=GLOBAL_SETTINGS.DEVELOPMENT_MODE,
diff --git a/marimo/_server/api/endpoints/ai.py b/marimo/_server/api/endpoints/ai.py
index 0155646fa1..8ad567d4d7 100644
--- a/marimo/_server/api/endpoints/ai.py
+++ b/marimo/_server/api/endpoints/ai.py
@@ -399,9 +399,7 @@ async def mcp_status(
schema:
$ref: "#/components/schemas/MCPStatusResponse"
"""
- app_state = AppState(request)
- app_state.require_current_session()
-
+ del request
try:
# Try to get MCP client
mcp_client = get_mcp_client()