diff --git a/python/.env.versions b/python/.env.versions index 9ccd756e..259de5ad 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 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()