Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion marimo/_cli/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
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
Expand All @@ -26,7 +28,8 @@
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()
Expand All @@ -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],
Expand Down
3 changes: 1 addition & 2 deletions tests/_cli/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


Expand Down
Loading