From 136ae911235d4f047725940239533db841e996ad Mon Sep 17 00:00:00 2001 From: Lorin Date: Mon, 2 Mar 2026 15:39:12 -0700 Subject: [PATCH 1/3] Add skip-install to lint env and clean up version.py dead code - Add skip-install = true to lint hatch env (no need to install the package just to run black/flake8) - Remove unused run_cmd function and subprocess import from version.py - Simplify get_version() by removing unnecessary try/except around a constant that can never raise OSError/ValueError Co-Authored-By: Claude Opus 4.6 (1M context) --- python/pyproject.toml | 1 + python/version.py | 22 ++-------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index b34b87f6..7e7590ff 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -136,6 +136,7 @@ extra-dependencies = [ [tool.hatch.envs.lint] path = ".venv/lint" template = "testenv" +skip-install = true dependencies = [ "flake8", "black==24.4.1" diff --git a/python/version.py b/python/version.py index 4db56e70..bb90a0a6 100644 --- a/python/version.py +++ b/python/version.py @@ -1,33 +1,15 @@ -import subprocess - CURRENT_VERSION = "0.1.30" -# run a shell command and return stdout -def run_cmd(cmd): - cmd_proc = subprocess.run(cmd, shell=True, capture_output=True) - if cmd_proc.returncode != 0: - raise OSError( - f"Shell command '{cmd}' failed with return code {cmd_proc.returncode}\n" - f"STDERR: {cmd_proc.stderr.decode('utf-8')}" - ) - return cmd_proc.stdout.decode("utf-8").strip() -# fetch the most recent build version for hatch environment creation def get_version(): - """Return the package version based on latest git tag.""" + """Return the package version based on CURRENT_VERSION or env override.""" import os # Optionally override with environment variable if "PACKAGE_VERSION" in os.environ: return os.environ.get("PACKAGE_VERSION") - # Fall back to git tag - try: - return CURRENT_VERSION - except (OSError, ValueError) as E: - # Return a fallback version if git operations fail - # TODO - Raise with error message - raise E + return CURRENT_VERSION __version__ = get_version() From 31398382ce0bdb8baa1069e880af3c1e9292e378 Mon Sep 17 00:00:00 2001 From: Lorin Date: Mon, 2 Mar 2026 16:56:40 -0700 Subject: [PATCH 2/3] Pin virtualenv<21 to fix hatch incompatibility virtualenv 21.0.0 (released 2026-02-25) removed the `propose_interpreters` attribute that hatch relies on, breaking all hatch environment creation. Pin virtualenv<21 until hatch releases a fix. See: https://github.com/pypa/hatch/issues/2193 Co-Authored-By: Claude Opus 4.6 (1M context) --- python/.env.versions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/.env.versions b/python/.env.versions index 9ccd756e..39ad83aa 100644 --- a/python/.env.versions +++ b/python/.env.versions @@ -5,4 +5,5 @@ HATCH_VERSION="1.14.2" # Full pip install command -HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION}" \ No newline at end of file +# Pin virtualenv<21 to work around https://github.com/pypa/hatch/issues/2193 +HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION} 'virtualenv<21'" \ No newline at end of file From b994b30c11dddc12006733c230b9ee975f9ec6e1 Mon Sep 17 00:00:00 2001 From: Lorin Date: Mon, 2 Mar 2026 17:02:46 -0700 Subject: [PATCH 3/3] Fix quoting in virtualenv pin (remove nested single quotes) Co-Authored-By: Claude Opus 4.6 (1M context) --- python/.env.versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/.env.versions b/python/.env.versions index 39ad83aa..259de5ad 100644 --- a/python/.env.versions +++ b/python/.env.versions @@ -6,4 +6,4 @@ HATCH_VERSION="1.14.2" # Full pip install command # Pin virtualenv<21 to work around https://github.com/pypa/hatch/issues/2193 -HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION} 'virtualenv<21'" \ No newline at end of file +HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION} virtualenv<21" \ No newline at end of file