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.

uv-suitable update instructions when using uv (#6681)

Yair Chuchem8745c18e6f18
diff --git a/marimo/_cli/upgrade.py b/marimo/_cli/upgrade.py
index 0ebd5a8181..e890654edd 100644
--- a/marimo/_cli/upgrade.py
+++ b/marimo/_cli/upgrade.py
@@ -7,6 +7,8 @@ import urllib.error
from datetime import datetime
from typing import Any, Callable, cast
+import psutil
+
import marimo._utils.requests as requests
from marimo import _loggers
from marimo._cli.print import echo, green, orange
@@ -26,7 +28,8 @@ LOGGER = _loggers.marimo_logger()
def print_latest_version(current_version: str, state: MarimoCLIState) -> None:
message = f"Update available {current_version} → {state.latest_version}"
echo(orange(message))
- echo(f"Run {green('pip install --upgrade marimo')} to upgrade.")
+ install_cmd = "uv add" if _is_in_uv() else "pip install"
+ echo(f"Run {green(f'{install_cmd} --upgrade marimo')} to upgrade.")
if state.notices:
echo()
@@ -37,6 +40,10 @@ def print_latest_version(current_version: str, state: MarimoCLIState) -> None:
echo()
+def _is_in_uv() -> bool:
+ return psutil.Process(os.getppid()).name() == "uv"
+
+
@server_tracer.start_as_current_span("check_for_updates")
def check_for_updates(
on_update: Callable[[str, MarimoCLIState], None],
diff --git a/tests/_cli/test_upgrade.py b/tests/_cli/test_upgrade.py
index bca9ac64cb..8418b45b97 100644
--- a/tests/_cli/test_upgrade.py
+++ b/tests/_cli/test_upgrade.py
@@ -37,8 +37,7 @@ def test_check_for_updates(
"0.1.0 → 0.1.2" in call[0][0] for call in mock_echo.call_args_list
)
assert any(
- "pip install --upgrade marimo" in call[0][0]
- for call in mock_echo.call_args_list
+ " --upgrade marimo" in call[0][0] for call in mock_echo.call_args_list
)