From 3b6590e291062d2ff7e5f18d439fa81a3b8aeede Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Tue, 17 Nov 2026 17:33:17 -0500 Subject: [PATCH 1/3] Compare meta-package extras at major.minor so patch bumps pass meta-package-check --- scripts/meta-package/meta_package.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/meta-package/meta_package.py b/scripts/meta-package/meta_package.py index 03b4c2958..043425be4 100644 --- a/scripts/meta-package/meta_package.py +++ b/scripts/meta-package/meta_package.py @@ -4,7 +4,9 @@ """Checks that the aws-sdk-python meta-package matches the repository's clients. Each client under ``clients/`` must have: - - an extra named after its module suffix pinning ``~=``, + - an extra named after its module suffix pinning ``~=..0`` + for the client's current version (a patch bump stays inside the ``~=`` range, + so the extra is only rewritten on a minor or major bump), - an entry in the ``all`` extra, - an editable ``[tool.uv.sources]`` path, so a version bump that is not yet on PyPI still resolves. @@ -45,7 +47,7 @@ def _check_extras(extras: dict[str, list[str]], clients: dict[str, str]) -> list expected = {_extra(name): name for name in clients} for extra, name in sorted(expected.items()): - want = [f"{_module(name)}~={clients[name]}"] + want = [f"{_module(name)}~={_compatible(clients[name])}"] got = extras.get(extra) if got is None: errors.append(f"missing extra {extra} = {want}") @@ -86,6 +88,12 @@ def _module(name: str) -> str: return name.replace("-", "_") +def _compatible(version: str) -> str: + """Return the ``~=`` floor for ``version``: ``..0``.""" + major, minor = version.split(".")[:2] + return f"{major}.{minor}.0" + + def _load(path: Path) -> dict: with path.open("rb") as f: return tomllib.load(f) From 4bbd1bd1236ccc9ea0864d9cba5d905cfd7e223b Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Tue, 17 Nov 2026 18:02:41 -0500 Subject: [PATCH 2/3] Allow a meta-package pin at any patch the client has reached --- scripts/meta-package/meta_package.py | 39 ++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/scripts/meta-package/meta_package.py b/scripts/meta-package/meta_package.py index 043425be4..35931a6de 100644 --- a/scripts/meta-package/meta_package.py +++ b/scripts/meta-package/meta_package.py @@ -4,9 +4,10 @@ """Checks that the aws-sdk-python meta-package matches the repository's clients. Each client under ``clients/`` must have: - - an extra named after its module suffix pinning ``~=..0`` - for the client's current version (a patch bump stays inside the ``~=`` range, - so the extra is only rewritten on a minor or major bump), + - an extra named after its module suffix pinning ``~=``, where + the pin shares the client's major.minor and its patch does not exceed the + client's (a patch bump stays inside the ``~=`` range, so the pin is normally + left at ``x.y.0`` and only rewritten on a minor or major bump), - an entry in the ``all`` extra, - an editable ``[tool.uv.sources]`` path, so a version bump that is not yet on PyPI still resolves. @@ -47,12 +48,12 @@ def _check_extras(extras: dict[str, list[str]], clients: dict[str, str]) -> list expected = {_extra(name): name for name in clients} for extra, name in sorted(expected.items()): - want = [f"{_module(name)}~={_compatible(clients[name])}"] + module = _module(name) got = extras.get(extra) if got is None: - errors.append(f"missing extra {extra} = {want}") - elif got != want: - errors.append(f"extra {extra} is {got}, expected {want}") + errors.append(f"missing extra {extra} = ['{module}~={clients[name]}']") + elif error := _check_pin(got, module, clients[name]): + errors.append(f"extra {extra} is {got}, {error}") for extra in sorted(set(extras) - set(expected) - {ALL_EXTRA}): errors.append(f"extra {extra} has no client in clients/") @@ -88,10 +89,26 @@ def _module(name: str) -> str: return name.replace("-", "_") -def _compatible(version: str) -> str: - """Return the ``~=`` floor for ``version``: ``..0``.""" - major, minor = version.split(".")[:2] - return f"{major}.{minor}.0" +def _check_pin(got: list[str], module: str, client_version: str) -> str | None: + """A ``~=`` pin must share the client's major.minor and not exceed its patch.""" + prefix = f"{module}~=" + if len(got) != 1 or not got[0].startswith(prefix): + return f"expected ['{prefix}']" + current = _version(client_version) + if current is None: + return f"but client version {client_version!r} is not .." + major, minor, patch = current + pinned = _version(got[0].removeprefix(prefix)) + if pinned is None or pinned[:2] != (major, minor) or pinned[2] > patch: + return f"expected {prefix}{major}.{minor}.x with x <= {patch}" + return None + + +def _version(version: str) -> tuple[int, int, int] | None: + parts = version.split(".") + if len(parts) != 3 or not all(part.isdigit() for part in parts): + return None + return int(parts[0]), int(parts[1]), int(parts[2]) def _load(path: Path) -> dict: From 3afd6a2e5686f1cafa8b0baabcd9f3f20beda517 Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Tue, 17 Nov 2026 18:17:53 -0500 Subject: [PATCH 3/3] Format the version-mismatch message like the other extra errors --- scripts/meta-package/meta_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/meta-package/meta_package.py b/scripts/meta-package/meta_package.py index 35931a6de..1ec5e914f 100644 --- a/scripts/meta-package/meta_package.py +++ b/scripts/meta-package/meta_package.py @@ -100,7 +100,7 @@ def _check_pin(got: list[str], module: str, client_version: str) -> str | None: major, minor, patch = current pinned = _version(got[0].removeprefix(prefix)) if pinned is None or pinned[:2] != (major, minor) or pinned[2] > patch: - return f"expected {prefix}{major}.{minor}.x with x <= {patch}" + return f"expected ['{prefix}{major}.{minor}.x'] with x <= {patch}" return None