From aabd543a94f6040c6e441eab50ebc090a8ffd07a Mon Sep 17 00:00:00 2001 From: Brad Edwards Date: Thu, 24 Sep 2026 03:40:50 +0200 Subject: [PATCH] fix(release): bump uv.lock with release-please release-please's python updater rewrites pyproject.toml but not uv.lock, so the v5.6.0 release left main's lockfile at 5.5.0 and the uv-lock hook failed on the dev->main promotion. Add a toml extra-file for the lockfile's own aptl-labs entry and guard it with version-consistency tests. --- release-please-config.json | 7 ++++++- tests/test_version_consistency.py | 34 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/release-please-config.json b/release-please-config.json index 28fc2510..9abe1200 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -6,7 +6,12 @@ "release-type": "python", "package-name": "aptl", "extra-files": [ - "src/aptl/__init__.py" + "src/aptl/__init__.py", + { + "type": "toml", + "path": "uv.lock", + "jsonpath": "$.package[?(@.name.value=='aptl-labs')].version" + } ] } } diff --git a/tests/test_version_consistency.py b/tests/test_version_consistency.py index 5eab0048..09d17232 100644 --- a/tests/test_version_consistency.py +++ b/tests/test_version_consistency.py @@ -6,10 +6,17 @@ ``__version__`` stayed 4.0.0) and ``aptl --version`` reported the wrong value on a real PyPI install. release-please now bumps both (``extra-files`` + ``x-release-please-version`` annotation); this test fails if they drift again. + +The same drift hit ``uv.lock``: release-please left the lockfile's own +``aptl-labs`` entry at 5.5.0 after the 5.6.0 release, so the ``uv-lock`` +pre-commit hook failed on the dev->main promotion. release-please now bumps the +lockfile via a ``toml`` extra-file; the tests below pin that config and the +lockfile/pyproject agreement. """ from __future__ import annotations +import json import tomllib from pathlib import Path @@ -26,3 +33,30 @@ def test_version_matches_pyproject() -> None: "(release-please-config.json extra-files + the x-release-please-version " "annotation in src/aptl/__init__.py)" ) + + +def _pyproject() -> dict: + return tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8")) + + +def test_uv_lock_matches_pyproject() -> None: + project = _pyproject()["project"] + lock = tomllib.loads((REPO_ROOT / "uv.lock").read_text(encoding="utf-8")) + locked = [p["version"] for p in lock["package"] if p["name"] == project["name"]] + assert locked == [project["version"]], ( + f"uv.lock {project['name']} version={locked!r} != pyproject " + f"version={project['version']!r}; release-please must bump uv.lock too " + "(release-please-config.json toml extra-file)" + ) + + +def test_release_please_bumps_uv_lock() -> None: + config = json.loads( + (REPO_ROOT / "release-please-config.json").read_text(encoding="utf-8") + ) + name = _pyproject()["project"]["name"] + assert { + "type": "toml", + "path": "uv.lock", + "jsonpath": f"$.package[?(@.name.value=='{name}')].version", + } in config["packages"]["."]["extra-files"]