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
Support shells on windows (with extensions) (#3459)
Hal Wine61af9b016315
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.pyindex e60eeaa85e..3a77241cc6 100644--- a/marimo/_cli/cli.py+++ b/marimo/_cli/cli.py@@ -800,7 +800,8 @@ def shell_completion() -> None:)return- shell_name = Path(shell).name+ # in case we're on a windows system, use .stem to remove extension+ shell_name = Path(shell).stemcommands = {"bash": (diff --git a/tests/_cli/test_cli.py b/tests/_cli/test_cli.pyindex d336b54295..620badb6fb 100644--- a/tests/_cli/test_cli.py+++ b/tests/_cli/test_cli.py@@ -798,13 +798,43 @@ def test_cli_run_sandbox_prompt_yes() -> None:p.kill()-def test_shell_completion() -> None:+# shell-completion has 1 input (value of $SHELL) & 3 outputs (return code, stdout, & stderr)+# parameterize to give coverage. We use a boolean to specify if output on that stream should be present.+ "shell,rc,expect_stdout,expect_stderr".split(","),+ [+ # valid shell values, rc of 0, data only on stdout+ ("bash", 0, True, False),+ ("bash.exe", 0, True, False),+ ("/usr/bin/zsh", 0, True, False),+ pytest.param(+ r"c:\spam\eggs\fish.exe",+ 0,+ True,+ False,+ marks=pytest.mark.skipif(+ not sys.platform.startswith(("win32", "cygwin")),+ reason="win32 only",+ ),+ ),+ # invalid shell values, rc of 0, data only on stderr+ # (N.B. rc will become 2 when Issue #3476 is fixed)+ ("bogus", 0, False, True),+ ],+)+def test_shell_completion(+ shell: str, rc: int, expect_stdout: bool, expect_stderr: bool+) -> None:+ test_env = os.environ.copy()+ test_env["SHELL"] = shellp = subprocess.run(["marimo", "shell-completion"],capture_output=True,+ env=test_env,)- assert p.returncode == 0- assert p.stdout is not None+ assert p.returncode == rc+ assert bool(len(p.stdout)) == expect_stdout+ assert bool(len(p.stderr)) == expect_stderrHAS_DOCKER = DependencyManager.which("docker")