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: skip update checks in ci (#2034)

Myles Scolnick128e4ec0610c
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 337a1e0c70..5f259a1fca 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -8,6 +8,7 @@ on:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: marimo
+ MARIMO_SKIP_UPDATE_CHECK: 1
jobs:
test:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index d3d772b067..9b7995c172 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -8,6 +8,7 @@ on:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: marimo
+ MARIMO_SKIP_UPDATE_CHECK: 1
jobs:
test_frontend:
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yaml
index 80c71689d8..309e1f521c 100644
--- a/.github/workflows/test_cli.yaml
+++ b/.github/workflows/test_cli.yaml
@@ -8,6 +8,7 @@ on:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: marimo
+ MARIMO_SKIP_UPDATE_CHECK: 1
jobs:
build_wheel:
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.py
index 923abc592c..13df36bd07 100644
--- a/marimo/_cli/cli.py
+++ b/marimo/_cli/cli.py
@@ -273,7 +273,7 @@ def edit(
name: Optional[str],
args: tuple[str, ...],
) -> None:
- if not skip_update_check:
+ if not skip_update_check and os.getenv("MARIMO_SKIP_UPDATE_CHECK") != "1":
# Check for version updates
check_for_updates()
diff --git a/marimo/_cli/upgrade.py b/marimo/_cli/upgrade.py
index a89b8c618b..dfae3f3f75 100644
--- a/marimo/_cli/upgrade.py
+++ b/marimo/_cli/upgrade.py
@@ -2,6 +2,7 @@
from __future__ import annotations
import json
+import os
import urllib.request
from dataclasses import dataclass
from datetime import datetime
@@ -72,7 +73,12 @@ def _update_with_latest_version(state: MarimoCLIState) -> MarimoCLIState:
"""
# querying pypi is +250kb and there is not a better API
# this endpoint just returns the version
- api_url = "https://marimo.io/api/oss/latest-version"
+ # so we only use pypi in tests
+ is_test = os.environ.get("MARIMO_PYTEST_HOME_DIR") is not None
+ if is_test:
+ api_url = "https://pypi.org/pypi/marimo/json"
+ else:
+ api_url = "https://marimo.io/api/oss/latest-version"
# Check if it is a different day
if state.last_checked_at:
diff --git a/tests/_cli/test_cli.py b/tests/_cli/test_cli.py
index c1dc8a08cc..c7047e6850 100644
--- a/tests/_cli/test_cli.py
+++ b/tests/_cli/test_cli.py
@@ -160,7 +160,15 @@ def test_cli_edit_none() -> None:
# annotations
port = _get_port()
p = subprocess.Popen(
- ["marimo", "edit", "-p", str(port), "--headless", "--no-token"]
+ [
+ "marimo",
+ "edit",
+ "-p",
+ str(port),
+ "--headless",
+ "--no-token",
+ "--skip-update-check",
+ ]
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode='home'", contents)
@@ -185,6 +193,7 @@ def test_cli_edit_token() -> None:
"--headless",
"--token-password",
"secret",
+ "--skip-update-check",
]
)
contents = _try_fetch(port, "localhost", "secret")
@@ -199,7 +208,16 @@ def test_cli_edit_directory() -> None:
d = tempfile.TemporaryDirectory()
port = _get_port()
p = subprocess.Popen(
- ["marimo", "edit", d.name, "-p", str(port), "--headless", "--no-token"]
+ [
+ "marimo",
+ "edit",
+ d.name,
+ "-p",
+ str(port),
+ "--headless",
+ "--no-token",
+ "--skip-update-check",
+ ]
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode='home'", contents)
@@ -214,7 +232,16 @@ def test_cli_edit_new_file() -> None:
path = os.path.join(d.name, "new.py")
port = _get_port()
p = subprocess.Popen(
- ["marimo", "edit", path, "-p", str(port), "--headless", "--no-token"]
+ [
+ "marimo",
+ "edit",
+ path,
+ "-p",
+ str(port),
+ "--headless",
+ "--no-token",
+ "--skip-update-check",
+ ]
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode='edit'", contents)
@@ -235,6 +262,7 @@ def test_cli_edit_with_additional_args(temp_marimo_file: str) -> None:
str(port),
"--headless",
"--no-token",
+ "--skip-update-check",
"--",
"-a=foo",
"--b=bar",
@@ -254,9 +282,12 @@ def test_cli_edit_with_additional_args(temp_marimo_file: str) -> None:
def test_cli_edit_update_check() -> None:
with tempfile.TemporaryDirectory() as tempdir:
port = _get_port()
+ env = {**os.environ, "MARIMO_PYTEST_HOME_DIR": tempdir}
+ # pop off MARIMO_SKIP_UPDATE_CHECK
+ env.pop("MARIMO_SKIP_UPDATE_CHECK", None)
p = subprocess.Popen(
["marimo", "edit", "-p", str(port), "--headless", "--no-token"],
- env={**os.environ, "MARIMO_PYTEST_HOME_DIR": tempdir},
+ env=env,
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode='home'", contents)
@@ -431,6 +462,7 @@ def test_cli_md_edit(temp_md_marimo_file: str) -> None:
str(port),
"--no-token",
"--headless",
+ "--skip-update-check",
]
)
contents = _try_fetch(port)
@@ -465,7 +497,15 @@ def test_cli_edit_interrupt_twice() -> None:
# two SIGINTs should kill the CLI
port = _get_port()
p = subprocess.Popen(
- ["marimo", "edit", "-p", str(port), "--headless", "--no-token"]
+ [
+ "marimo",
+ "edit",
+ "-p",
+ str(port),
+ "--headless",
+ "--no-token",
+ "--skip-update-check",
+ ]
)
_check_started(port)
with _patch_signals_win32():
@@ -498,7 +538,15 @@ def test_cli_run_interrupt_twice() -> None:
def test_cli_edit_shutdown() -> None:
port = _get_port()
p = subprocess.Popen(
- ["marimo", "edit", "-p", str(port), "--headless", "--no-token"],
+ [
+ "marimo",
+ "edit",
+ "-p",
+ str(port),
+ "--headless",
+ "--no-token",
+ "--skip-update-check",
+ ],
stdin=subprocess.PIPE,
)
_check_started(port)