diff --git a/scripts/check_version_match.py b/scripts/check_version_match.py index 6f5eacc..3a16340 100755 --- a/scripts/check_version_match.py +++ b/scripts/check_version_match.py @@ -3,7 +3,8 @@ from pathlib import Path import subprocess import sys -import tomllib +import tomli + ROOT = Path(__file__).resolve().parents[1] @@ -11,18 +12,18 @@ def pyproject_version() -> str: pyproject_path = ROOT / "pyproject.toml" with pyproject_path.open("rb") as f: - data = tomllib.load(f) + data = tomli.load(f) return data["tool"]["poetry"]["version"] -def latest_tag() -> str | None: +def latest_tag() -> str: try: tag = subprocess.check_output( ["git", "describe", "--tags", "--abbrev=0"], cwd=ROOT, text=True ).strip() return tag.lstrip("v") except subprocess.CalledProcessError: - return None + return "0.0.0" def main() -> int: diff --git a/tasks.py b/tasks.py index d0389b1..784e529 100644 --- a/tasks.py +++ b/tasks.py @@ -51,7 +51,7 @@ def test(c: Context) -> None: @task -def check_version(c: Context) -> None: +def checkversion(c: Context) -> None: """Validate that ``pyproject.toml`` matches the latest git tag. This task runs the ``scripts/check_version_match.py`` helper using Poetry