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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
test: maybe fix windows cli tests (#3146)
Myles Scolnickf7ab973c31c5
diff --git a/.github/workflows/test_cli.yaml b/.github/workflows/test_cli.yamlindex b5f6c86354..3c0e1546ef 100644--- a/.github/workflows/test_cli.yaml+++ b/.github/workflows/test_cli.yaml@@ -134,7 +134,7 @@ jobs:- name: Test CLIshell: bashrun: |- pytest -v tests/_cli/test_cli*+ pytest -v tests/_cli/test_cli* --maxfail=2test_examples:needs: [changes, build_wheel]diff --git a/marimo/_cli/print.py b/marimo/_cli/print.pyindex d093dcdfbd..20e8ea9d3c 100644--- a/marimo/_cli/print.py+++ b/marimo/_cli/print.py@@ -2,39 +2,77 @@from __future__ import annotations-from typing import Any+import os+import sys+from typing import Any, castfrom marimo._config.settings import GLOBAL_SETTINGS-# Print helpers++# Check if we're on Windows and if ANSI colors are supported+def _supports_color() -> bool:+ if os.environ.get("NO_COLOR") == "1":+ return False++ # Windows 10 build 14931+ supports ANSI color codes+ if os.name == "nt":+ try:+ import ctypes++ kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]+ # Get Windows version+ major = sys.getwindowsversion().major # type: ignore[attr-defined]+ build = sys.getwindowsversion().build # type: ignore[attr-defined]++ # Check if Windows 10+ and if VIRTUAL_TERMINAL_PROCESSING is enabled+ return cast(+ bool,+ major >= 10+ and build >= 14931+ and kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7), # type: ignore[attr-defined]+ )+ except Exception:+ return False+ return hasattr(sys.stdout, "isatty") and sys.stdout.isatty()+++_USE_COLOR = _supports_color()def bold(text: str) -> str:- return "\033[1m" + text + "\033[0m"+ return "\033[1m" + text + "\033[0m" if _USE_COLOR else textdef green(text: str, bold: bool = False) -> str:+ if not _USE_COLOR:+ return textprefix = "\033[32m" if not bold else "\033[1;32m"return prefix + text + "\033[0m"def yellow(text: str, bold: bool = False) -> str:+ if not _USE_COLOR:+ return textprefix = "\033[33m" if not bold else "\033[1;33m"return prefix + text + "\033[0m"def orange(text: str, bold: bool = False) -> str:+ if not _USE_COLOR:+ return textprefix = "\033[33m" if not bold else "\033[1;33m"return prefix + text + "\033[0m"def red(text: str, bold: bool = False) -> str:+ if not _USE_COLOR:+ return textprefix = "\033[31m" if not bold else "\033[1;31m"return prefix + text + "\033[0m"def muted(text: str) -> str:- return "\033[90m" + text + "\033[0m"+ return "\033[90m" + text + "\033[0m" if _USE_COLOR else textdef echo(*args: Any, **kwargs: Any) -> None:diff --git a/marimo/_server/print.py b/marimo/_server/print.pyindex d35bd7ad2b..b464873815 100644--- a/marimo/_server/print.py+++ b/marimo/_server/print.py@@ -38,10 +38,10 @@ def print_startup(f"{green('Create or edit notebooks in your browser', bold=True)} {_utf8('📝')}")print_()- print_tabbed(f"➜ {green('URL')}: {_colorized_url(url)}")+ print_tabbed(f"{_utf8('➜')} {green('URL')}: {_colorized_url(url)}")if network:print_tabbed(- f"➜ {green('Network')}: {_colorized_url(_get_network_url(url))}"+ f"{_utf8('➜')} {green('Network')}: {_colorized_url(_get_network_url(url))}")print_()