From 4c133514830bd99962463d4b0cc8d054ad96c20b Mon Sep 17 00:00:00 2001 From: Luke Lombardi <33990301+luke-lombardi@users.noreply.github.com> Date: Mon, 20 Jul 2026 14:59:11 -0400 Subject: [PATCH 1/2] Improve Beam CLI upgrade guidance --- python/poetry.lock | 4 ++-- python/pyproject.toml | 1 + python/src/beam/cli/utils.py | 17 ++++++++++++----- python/tests/cli/test_utils.py | 31 +++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 python/tests/cli/test_utils.py diff --git a/python/poetry.lock b/python/poetry.lock index 40ea2a1..b29a5b3 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -851,7 +851,7 @@ version = "24.1" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" -groups = ["dev"] +groups = ["main", "dev"] files = [ {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, @@ -1692,4 +1692,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = "^3.8" -content-hash = "c5fa52e3d98190a7d022c5ca7dabe9d0e80da6437b2c36191bf638cecb75796e" +content-hash = "e8fc2279928ecd8e6cb60b41d1fb76d6794c4071807d322c4ad9c2a6362779bd" diff --git a/python/pyproject.toml b/python/pyproject.toml index 345838b..cabf59b 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -10,6 +10,7 @@ packages = [ [tool.poetry.dependencies] python = "^3.8" +packaging = ">=24.0" requests = "^2.31.0" websockets = ">=13,<16" beta9 = "^0.1.262" diff --git a/python/src/beam/cli/utils.py b/python/src/beam/cli/utils.py index 53c2ee5..7083530 100644 --- a/python/src/beam/cli/utils.py +++ b/python/src/beam/cli/utils.py @@ -26,13 +26,20 @@ def check_version(): if current_version >= minimum_version: return + # Use the interpreter that is running the Beam CLI. A bare `pip` executable + # may belong to a different Python installation, leaving this CLI unchanged. + upgrade_command = f'"{sys.executable}" -m pip install --upgrade beam-client' + click.echo( ( - f"{click.style('Update Required', fg='yellow', bold=True)}\n\n" - f"Your current version: {click.style(str(current_version), bold=True)}\n" - f"Minimum required version: {click.style(str(minimum_version), fg='yellow', bold=True)}\n" - "\nPlease upgrade to the latest version.\n" - f" {click.style('pip install --upgrade beam-client', bold=True)}\n" + f"{click.style('Beam CLI update required', fg='yellow', bold=True)}\n\n" + f"Installed: {click.style(str(current_version), bold=True)}\n" + f"Minimum: {click.style(str(minimum_version), fg='yellow', bold=True)}\n" + f"Python: {sys.executable}\n" + "\nUpgrade this installation (not a different `pip` on your PATH):\n" + f" {click.style(upgrade_command, bold=True)}\n" + "\nThen verify:\n" + f" {click.style('beam --version', bold=True)}\n" ) ) diff --git a/python/tests/cli/test_utils.py b/python/tests/cli/test_utils.py new file mode 100644 index 0000000..323d3d2 --- /dev/null +++ b/python/tests/cli/test_utils.py @@ -0,0 +1,31 @@ +import sys + +import pytest + +from beam.cli import utils + + +class FakeResponse: + def raise_for_status(self): + pass + + def json(self): + return {"version": "0.2.202"} + + +def test_check_version_upgrades_the_python_environment_running_beam(monkeypatch, capsys): + monkeypatch.setattr(utils.requests, "get", lambda *args, **kwargs: FakeResponse()) + monkeypatch.setattr(utils.metadata, "version", lambda package: "0.2.191") + monkeypatch.setattr(sys, "executable", "/opt/Beam Client/bin/python") + + with pytest.raises(SystemExit) as exc_info: + utils.check_version() + + assert exc_info.value.code == 1 + output = capsys.readouterr().out + assert "Beam CLI update required" in output + assert "Installed: 0.2.191" in output + assert "Minimum: 0.2.202" in output + assert "Python: /opt/Beam Client/bin/python" in output + assert '"/opt/Beam Client/bin/python" -m pip install --upgrade beam-client' in output + assert "beam --version" in output From f8b22ab56f408e5a98ce40d2aa016aa814b68ae0 Mon Sep 17 00:00:00 2001 From: Luke Lombardi <33990301+luke-lombardi@users.noreply.github.com> Date: Mon, 20 Jul 2026 22:25:12 -0400 Subject: [PATCH 2/2] bump beta9 --- python/poetry.lock | 8 ++++---- python/pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/poetry.lock b/python/poetry.lock index b29a5b3..93dd578 100644 --- a/python/poetry.lock +++ b/python/poetry.lock @@ -123,14 +123,14 @@ typecheck = ["mypy"] [[package]] name = "beta9" -version = "0.1.262" +version = "0.1.264" description = "" optional = false python-versions = "<4.0,>=3.8" groups = ["main"] files = [ - {file = "beta9-0.1.262-py3-none-any.whl", hash = "sha256:bd71e795c42175e727992ecfd5c45b4a96006233927a187fa395a62178ecebc2"}, - {file = "beta9-0.1.262.tar.gz", hash = "sha256:2bb1b1a5b9d89d07e4ecffcfe0332019c8dce5280f134befeb6a29c271f59f0b"}, + {file = "beta9-0.1.264-py3-none-any.whl", hash = "sha256:1f06ee7084a1d136468e1716412c384b27e19c66c875ffe2a7ff361693c3b116"}, + {file = "beta9-0.1.264.tar.gz", hash = "sha256:9bb555874a5f21eaa62a9e808bcfbc158a0348507dcca2ecf143c511ed8e3329"}, ] [package.dependencies] @@ -1692,4 +1692,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = "^3.8" -content-hash = "e8fc2279928ecd8e6cb60b41d1fb76d6794c4071807d322c4ad9c2a6362779bd" +content-hash = "2809debd7a70b0e8859fe483187b848c59d05f81f253e1e2cc9cda8d6e44c884" diff --git a/python/pyproject.toml b/python/pyproject.toml index cabf59b..2d80b09 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "beam-client" -version = "0.2.204" +version = "0.2.206" description = "" authors = ["beam.cloud "] packages = [ @@ -13,7 +13,7 @@ python = "^3.8" packaging = ">=24.0" requests = "^2.31.0" websockets = ">=13,<16" -beta9 = "^0.1.262" +beta9 = "^0.1.264" [tool.poetry.group.dev.dependencies] pytest = "^8.1.1"