From 7ea54f5048fdd40a3eacf81ef97f3418689b6319 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:29:51 +0900 Subject: [PATCH 01/24] refactor(pypi): do not parse the versions to select the wheels Only the major and the minor numbers of the Python version are needed to match the Python tags of the wheels, so get them directly instead of using a PEP 440 version parser. This means that `select_whl`, which is used by `coverage_deps.bzl` when `python/repositories.bzl` is loaded in a `WORKSPACE` file, will not need `pypackaging.bzl` once `version.bzl` is replaced with it. --- python/private/pypi/BUILD.bazel | 12 +++---- python/private/pypi/python_tag.bzl | 42 +++++++++++++++++----- python/private/pypi/select_whl.bzl | 19 +++++----- tests/pypi/python_tag/python_tag_tests.bzl | 11 ++++-- 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 5d51f2a01e..1754c1787a 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -383,12 +383,6 @@ bzl_library( ], ) -bzl_library( - name = "python_tag", - srcs = ["python_tag.bzl"], - deps = ["//python/private:version"], -) - bzl_library( name = "render_pkg_aliases", srcs = ["render_pkg_aliases.bzl"], @@ -414,7 +408,6 @@ bzl_library( deps = [ ":parse_whl_name", ":python_tag", - "//python/private:version", ], ) @@ -693,6 +686,11 @@ bzl_library( srcs = ["platform.bzl"], ) +bzl_library( + name = "python_tag", + srcs = ["python_tag.bzl"], +) + bzl_library( name = "version_from_filename", srcs = ["version_from_filename.bzl"], diff --git a/python/private/pypi/python_tag.bzl b/python/private/pypi/python_tag.bzl index 224c5f96f0..3bc7c4c6c7 100644 --- a/python/private/pypi/python_tag.bzl +++ b/python/private/pypi/python_tag.bzl @@ -1,7 +1,5 @@ "A simple utility function to get the python_tag from the implementation name" -load("//python/private:version.bzl", "version") - # Taken from # https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#python-tag _PY_TAGS = { @@ -19,19 +17,16 @@ def python_tag(implementation_name, python_version = ""): Args: implementation_name: {type}`str` the implementation name, e.g. "cpython" - python_version: {type}`str` a version who can be parsed using PEP440 compliant - parser. + python_version: {type}`str` the Python version, e.g. `3.14` or + `3.14.1`. Returns: A {type}`str` that represents the python_tag with a version if the python_version is given. """ if python_version: - v = version.parse(python_version, strict = True) - suffix = "{}{}".format( - v.release[0], - v.release[1] if len(v.release) > 1 else "", - ) + major, minor = python_major_minor(python_version) + suffix = "{}{}".format(major, "" if minor == None else minor) else: suffix = "" @@ -39,3 +34,32 @@ def python_tag(implementation_name, python_version = ""): _PY_TAGS.get(implementation_name, implementation_name), suffix, ) + +def python_major_minor(python_version): + """Get the major and minor numbers of a Python version. + + Only the first two numbers of the version are needed to match the + wheel tags, so the version is not parsed as per PEP 440. + + Args: + python_version: {type}`str` the Python version, e.g. `3.14`, + `3.14.1` or `3.15.0rc1`. + + Returns: + A {type}`tuple[int, int | None]` of the major and minor numbers, the + minor is `None` if the version does not have it. + """ + major, _, tail = python_version.partition(".") + tail, _, _ = tail.partition(".") + + # Drop what may follow the minor number, e.g. `rc1` in `3.15rc1` + minor = "" + for c in tail.elems(): + if not c.isdigit(): + break + minor += c + + if not major.isdigit() or (tail and not minor): + fail("Expected the Python version to start with '.', got: '{}'".format(python_version)) + + return (int(major), int(minor) if minor else None) diff --git a/python/private/pypi/select_whl.bzl b/python/private/pypi/select_whl.bzl index b32fc68f01..f8215e5fca 100644 --- a/python/private/pypi/select_whl.bzl +++ b/python/private/pypi/select_whl.bzl @@ -1,8 +1,7 @@ "Select a single wheel that fits the parameters of a target platform." -load("//python/private:version.bzl", "version") load(":parse_whl_name.bzl", "parse_whl_name") -load(":python_tag.bzl", "PY_TAG_GENERIC", "python_tag") +load(":python_tag.bzl", "PY_TAG_GENERIC", "python_major_minor", "python_tag") _ANDROID = "android" _IOS = "ios" @@ -152,16 +151,17 @@ def _python_tag_priority(*, tag, implementation, py_version): else: return None - # Add a 0 at the end in case it is a single digit - ver_str = "{}.{}".format(ver_str[0], ver_str[1:] or "0") + if not ver_str.isdigit(): + return None - ver = version.parse(ver_str) - if not version.is_compatible(py_version, ver): + # The minor is 0 if the tag only has the major version, e.g. `py3` + ver = (int(ver_str[0]), int(ver_str[1:] or "0")) + if ver[0] != py_version[0] or ver > py_version: return None return ( tag.startswith(implementation), - version.key(ver), + ver, ) def _candidates_by_priority( @@ -178,7 +178,8 @@ def _candidates_by_priority( A dictionary where keys are priority tuples which allows us to sort and pick the last item. """ - py_version = version.parse(python_version, strict = True) + major, minor = python_major_minor(python_version) + py_version = (major, minor or 0) implementation = python_tag(implementation_name) ret = {} @@ -206,7 +207,7 @@ def _candidates_by_priority( logger.debug(lambda: "The python_tag in '{}' does not match implementation or version: {} {}".format( whl.filename, implementation, - py_version.string, + python_version, )) continue diff --git a/tests/pypi/python_tag/python_tag_tests.bzl b/tests/pypi/python_tag/python_tag_tests.bzl index ca86575e5b..2eaa0c2173 100644 --- a/tests/pypi/python_tag/python_tag_tests.bzl +++ b/tests/pypi/python_tag/python_tag_tests.bzl @@ -20,8 +20,15 @@ def _test_without_version(env): _tests.append(_test_without_version) def _test_with_version(env): - got = python_tag("cpython", "3.1.15") - env.expect.that_str(got).equals("cp31") + for give, expect in { + "3": "cp3", + "3.1.15": "cp31", + "3.15": "cp315", + "3.15.0rc1": "cp315", + "3.15rc1": "cp315", + }.items(): + got = python_tag("cpython", give) + env.expect.that_str(got).equals(expect) _tests.append(_test_with_version) From 4c177f8b9fc7ac9cbd50eb5f456897d059b67974 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:32:01 +0900 Subject: [PATCH 02/24] refactor(coverage): do not evaluate the markers to select the wheels `coverage_deps.bzl` is loaded by `python/repositories.bzl`, which the `WORKSPACE` users load in order to define the dependencies of `rules_python`. This means that it cannot use any dependency that is defined by `py_repositories`, which the marker evaluation is going to need once it is done by `pypackaging.bzl`. Each coverage version only needs to be limited to a range of the Python versions, so write the bounds as tuples instead of the PEP 508 markers and compare them directly. The update script now accepts `[@]` instead of `[; ]`. --- dev/update_deps/update_coverage_deps.py | 56 +- docs/devguide.md | 6 +- python/private/BUILD.bazel | 2 +- python/private/coverage_deps.bzl | 683 ++++++++++++++++-------- 4 files changed, 494 insertions(+), 253 deletions(-) diff --git a/dev/update_deps/update_coverage_deps.py b/dev/update_deps/update_coverage_deps.py index 655a1ae6d5..c224af4209 100755 --- a/dev/update_deps/update_coverage_deps.py +++ b/dev/update_deps/update_coverage_deps.py @@ -35,7 +35,8 @@ class Whl: url: str sha256: str - marker: str + min_python: tuple[int, int] | None + max_python: tuple[int, int] | None def __repr__(self): return "\n".join( @@ -43,7 +44,8 @@ def __repr__(self): "struct(", f' url = "{self.url}",', f' hash = "sha256:{self.sha256}",', - f" marker = {json.dumps(self.marker)},", + f" min_python = {self.min_python!r},", + f" max_python = {self.max_python!r},", "),", ] ) @@ -61,30 +63,46 @@ def __repr__(self): return "[\n{}\n]".format(inner) -def _whl(url: str, digests: dict[str, str], marker: str, **kwargs: Any) -> Whl: +def _whl( + url: str, + digests: dict[str, str], + min_python: tuple[int, int] | None, + max_python: tuple[int, int] | None, + **kwargs: Any, +) -> Whl: return Whl( url=url, sha256=digests["sha256"], - marker=marker, + min_python=min_python, + max_python=max_python, ) @dataclass class VersionSpec: - """A package version and the PEP 508 marker for when to use it.""" + """A package version and the first Python version to use it with.""" version: str - marker: str + min_python: tuple[int, int] | None def _parse_version_spec(value: str) -> VersionSpec: - version, _, marker = value.partition(";") + error = argparse.ArgumentTypeError( + f"Expected '[@.]', got '{value}'" + ) + version, at, python = value.partition("@") version = version.strip() if not version: - raise argparse.ArgumentTypeError( - f"Expected '[; ]', got '{value}'" - ) - return VersionSpec(version=version, marker=marker.strip()) + raise error + + if not at: + return VersionSpec(version=version, min_python=None) + + major, _, minor = python.strip().partition(".") + if not major.isdigit() or not minor.isdigit(): + raise error + + return VersionSpec(version=version, min_python=(int(major), int(minor))) def _parse_args() -> argparse.Namespace: @@ -100,10 +118,10 @@ def _parse_args() -> argparse.Namespace: nargs="+", type=_parse_version_spec, help=( - "The versions of the package to download, each optionally with a " - "PEP 508 environment marker for when the version should be used, " - "e.g. \"7.10.7; python_full_version < '3.15'\". The markers should not " - "overlap." + "The versions of the package to download, each optionally with " + "the first Python version that it should be used with, e.g. " + "'7.10.7 7.17.0@3.15' uses 7.17.0 with Python 3.15 and newer and " + "7.10.7 with the older Python versions." ), ) parser.add_argument( @@ -131,8 +149,12 @@ def _get_urls(name: str, version: str) -> list[dict[str, Any]]: def main(): args = _parse_args() + # Each version is used until the first Python version of the next one. + specs = sorted(args.versions, key=lambda x: x.min_python or (0, 0)) + max_pythons = [s.min_python for s in specs[1:]] + [None] + whls = [] - for spec in args.versions: + for spec, max_python in zip(specs, max_pythons): for u in _get_urls(args.name, spec.version): if u["yanked"]: continue @@ -140,7 +162,7 @@ def main(): if not u["filename"].endswith(".whl"): continue - whls.append(_whl(marker=spec.marker, **u)) + whls.append(_whl(min_python=spec.min_python, max_python=max_python, **u)) whls.sort(key=lambda x: x.url.rpartition("/")[2]) diff --git a/docs/devguide.md b/docs/devguide.md index 22839bcb42..bf3b04fc53 100644 --- a/docs/devguide.md +++ b/docs/devguide.md @@ -103,9 +103,9 @@ integration test. ``` 1. Bump the coverage dependencies using the script using: ``` - bazel run //dev/update_deps:update_coverage_deps - # for example: - # bazel run //dev/update_deps:update_coverage_deps 7.10.7 + bazel run //dev/update_deps:update_coverage_deps -- [@]... + # for example, to use 7.17.0 with Python 3.15 and newer and 7.10.7 otherwise: + # bazel run //dev/update_deps:update_coverage_deps -- 7.10.7 7.17.0@3.15 ``` ## Updating tool dependencies diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 78e4c48cd2..7ee5ca44d1 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -366,7 +366,7 @@ bzl_library( ":version_label", "//python:versions", "//python/private:bazel_tools", - "//python/private/pypi:pep508_evaluate", + "//python/private/pypi:python_tag", "//python/private/pypi:select_whl", ], ) diff --git a/python/private/coverage_deps.bzl b/python/private/coverage_deps.bzl index 6f826f897a..fdaac87c4d 100644 --- a/python/private/coverage_deps.bzl +++ b/python/private/coverage_deps.bzl @@ -20,1124 +20,1343 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("//python:versions.bzl", "FREETHREADED") load("//python/private:repo_utils.bzl", "repo_utils") load("//python/private:version_label.bzl", "version_label") -load("//python/private/pypi:pep508_evaluate.bzl", "evaluate") +load("//python/private/pypi:python_tag.bzl", "python_major_minor") load("//python/private/pypi:select_whl.bzl", "select_whl") # The wheels below were generated with: # -# bazel run //dev/update_deps:update_coverage_deps -- \ -# "7.10.7; python_full_version < '3.15'" \ -# "7.17.0; python_full_version >= '3.15'" +# bazel run //dev/update_deps:update_coverage_deps -- 7.10.7 7.17.0@3.15 # # Newer coverage versions do not support older python versions, so each version -# has a `python_full_version` marker for when it should be used. The markers are -# evaluated against `python_version` and `python_full_version` only. +# has the `min_python` (inclusive) and `max_python` (exclusive) bounds for when +# it should be used. # START: maintained by 'bazel run //dev/update_deps:update_coverage_deps ' _coverage_wheels = [ struct( url = "https://files.pythonhosted.org/packages/e5/6c/3a3f7a46888e69d18abe3ccc6fe4cb16cccb1e6a2f99698931dafca489e6/coverage-7.10.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:fc04cc7a3db33664e0c2d10eb8990ff6b3536f6842c9590ae8da4c614b9ed05a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/03/94/952d30f180b1a916c11a56f5c22d3535e943aa22430e9e3322447e520e1c/coverage-7.10.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e201e015644e207139f7e2351980feb7040e6f4b2c2978892f3e3789d1c125e5", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/50/2b/9e0cf8ded1e114bcd8b2fd42792b57f1c4e9e4ea1824cde2af93a67305be/coverage-7.10.7-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:240af60539987ced2c399809bd34f7c78e8abe0736af91c3d7d0e795df633d17", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/19/20/d0384ac06a6f908783d9b6aa6135e41b093971499ec488e47279f5b846e6/coverage-7.10.7-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8421e088bc051361b01c4b3a50fd39a4b9133079a2229978d9d30511fd05231b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/60/83/5c283cff3d41285f8eab897651585db908a909c572bdc014bcfaf8a8b6ae/coverage-7.10.7-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6be8ed3039ae7f7ac5ce058c308484787c86e8437e72b30bf5e88b8ea10f3c87", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/60/22/02eb98fdc5ff79f423e990d877693e5310ae1eab6cb20ae0b0b9ac45b23b/coverage-7.10.7-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e28299d9f2e889e6d51b1f043f58d5f997c373cc12e6403b90df95b8b047c13e", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b4/bc/25c83bcf3ad141b32cd7dc45485ef3c01a776ca3aa8ef0a93e77e8b5bc43/coverage-7.10.7-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:c4e16bd7761c5e454f4efd36f345286d6f7c5fa111623c355691e2755cae3b9e", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/3c/b7/95574702888b58c0928a6e982038c596f9c34d52c5e5107f1eef729399b5/coverage-7.10.7-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b1c81d0e5e160651879755c9c675b974276f135558cf4ba79fee7b8413a515df", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/47/b6/40095c185f235e085df0e0b158f6bd68cc6e1d80ba6c7721dc81d97ec318/coverage-7.10.7-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:606cc265adc9aaedcc84f1f064f0e8736bc45814f15a357e30fca7ecc01504e0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/c8/50/4aea0556da7a4b93ec9168420d170b55e2eb50ae21b25062513d020c6861/coverage-7.10.7-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:10b24412692df990dbc34f8fb1b6b13d236ace9dfdd68df5b28c2e39cafbba13", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/6a/28/ea1a84a60828177ae3b100cb6723838523369a44ec5742313ed7db3da160/coverage-7.10.7-cp310-cp310-win32.whl", hash = "sha256:b51dcd060f18c19290d9b8a9dd1e0181538df2ce0717f562fff6cf74d9fc0b5b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/fc/1a/a81d46bbeb3c3fd97b9602ebaa411e076219a150489bcc2c025f151bd52d/coverage-7.10.7-cp310-cp310-win_amd64.whl", hash = "sha256:3a622ac801b17198020f09af3eaf45666b344a0d69fc2a6ffe2ea83aeef1d807", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/d2/5d/c1a17867b0456f2e9ce2d8d4708a4c3a089947d0bec9c66cdf60c9e7739f/coverage-7.10.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a609f9c93113be646f44c2a0256d6ea375ad047005d7f57a5c15f614dc1b2f59", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/54/f0/514dcf4b4e3698b9a9077f084429681bf3aad2b4a72578f89d7f643eb506/coverage-7.10.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:65646bb0359386e07639c367a22cf9b5bf6304e8630b565d0626e2bdf329227a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/20/f6/9626b81d17e2a4b25c63ac1b425ff307ecdeef03d67c9a147673ae40dc36/coverage-7.10.7-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5f33166f0dfcce728191f520bd2692914ec70fac2713f6bf3ce59c3deacb4699", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b0/ef/bd8e719c2f7417ba03239052e099b76ea1130ac0cbb183ee1fcaa58aaff3/coverage-7.10.7-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:35f5e3f9e455bb17831876048355dca0f758b6df22f49258cb5a91da23ef437d", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a5/b6/bf054de41ec948b151ae2b79a55c107f5760979538f5fb80c195f2517718/coverage-7.10.7-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4da86b6d62a496e908ac2898243920c7992499c1712ff7c2b6d837cc69d9467e", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/0f/e5/3860756aa6f9318227443c6ce4ed7bf9e70bb7f1447a0353f45ac5c7974b/coverage-7.10.7-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6b8b09c1fad947c84bbbc95eca841350fad9cbfa5a2d7ca88ac9f8d836c92e23", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/26/0f/bd08bd042854f7fd07b45808927ebcce99a7ed0f2f412d11629883517ac2/coverage-7.10.7-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4376538f36b533b46f8971d3a3e63464f2c7905c9800db97361c43a2b14792ab", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/8e/a7/4777b14de4abcc2e80c6b1d430f5d51eb18ed1d75fca56cbce5f2db9b36e/coverage-7.10.7-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:121da30abb574f6ce6ae09840dae322bef734480ceafe410117627aa54f76d82", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/34/72/17d082b00b53cd45679bad682fac058b87f011fd8b9fe31d77f5f8d3a4e4/coverage-7.10.7-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:88127d40df529336a9836870436fc2751c339fbaed3a836d42c93f3e4bd1d0a2", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/81/7a/92367572eb5bdd6a84bfa278cc7e97db192f9f45b28c94a9ca1a921c3577/coverage-7.10.7-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ba58bbcd1b72f136080c0bccc2400d66cc6115f3f906c499013d065ac33a4b61", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/2f/88/a23cc185f6a805dfc4fdf14a94016835eeb85e22ac3a0e66d5e89acd6462/coverage-7.10.7-cp311-cp311-win32.whl", hash = "sha256:972b9e3a4094b053a4e46832b4bc829fc8a8d347160eb39d03f1690316a99c14", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/fe/ef/0b510a399dfca17cec7bc2f05ad8bd78cf55f15c8bc9a73ab20c5c913c2e/coverage-7.10.7-cp311-cp311-win_amd64.whl", hash = "sha256:a7b55a944a7f43892e28ad4bc0561dfd5f0d73e605d1aa5c3c976b52aea121d2", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/51/7f/023657f301a276e4ba1850f82749bc136f5a7e8768060c2e5d9744a22951/coverage-7.10.7-cp311-cp311-win_arm64.whl", hash = "sha256:736f227fb490f03c6488f9b6d45855f8e0fd749c007f9303ad30efab0e73c05a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/13/e4/eb12450f71b542a53972d19117ea5a5cea1cab3ac9e31b0b5d498df1bd5a/coverage-7.10.7-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7bb3b9ddb87ef7725056572368040c32775036472d5a033679d1fa6c8dc08417", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/37/66/593f9be12fc19fb36711f19a5371af79a718537204d16ea1d36f16bd78d2/coverage-7.10.7-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:18afb24843cbc175687225cab1138c95d262337f5473512010e46831aa0c2973", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/66/80/4c49f7ae09cafdacc73fbc30949ffe77359635c168f4e9ff33c9ebb07838/coverage-7.10.7-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:399a0b6347bcd3822be369392932884b8216d0944049ae22925631a9b3d4ba4c", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a6/90/a64aaacab3b37a17aaedd83e8000142561a29eb262cede42d94a67f7556b/coverage-7.10.7-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:314f2c326ded3f4b09be11bc282eb2fc861184bc95748ae67b360ac962770be7", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/98/2e/2dda59afd6103b342e096f246ebc5f87a3363b5412609946c120f4e7750d/coverage-7.10.7-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c41e71c9cfb854789dee6fc51e46743a6d138b1803fab6cb860af43265b42ea6", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/53/dc/8d8119c9051d50f3119bb4a75f29f1e4a6ab9415cd1fa8bf22fcc3fb3b5f/coverage-7.10.7-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc01f57ca26269c2c706e838f6422e2a8788e41b3e3c65e2f41148212e57cd59", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/98/b3/edaff9c5d79ee4d4b6d3fe046f2b1d799850425695b789d491a64225d493/coverage-7.10.7-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a6442c59a8ac8b85812ce33bc4d05bde3fb22321fa8294e2a5b487c3505f611b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/11/25/9a0728564bb05863f7e513e5a594fe5ffef091b325437f5430e8cfb0d530/coverage-7.10.7-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:78a384e49f46b80fb4c901d52d92abe098e78768ed829c673fbb53c498bef73a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/e0/fd/ca2650443bfbef5b0e74373aac4df67b08180d2f184b482c41499668e258/coverage-7.10.7-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:5e1e9802121405ede4b0133aa4340ad8186a1d2526de5b7c3eca519db7bb89fb", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/24/79/f692f125fb4299b6f963b0745124998ebb8e73ecdfce4ceceb06a8c6bec5/coverage-7.10.7-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d41213ea25a86f69efd1575073d34ea11aabe075604ddf3d148ecfec9e1e96a1", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/5e/75/61b9bbd6c7d24d896bfeec57acba78e0f8deac68e6baf2d4804f7aae1f88/coverage-7.10.7-cp312-cp312-win32.whl", hash = "sha256:77eb4c747061a6af8d0f7bdb31f1e108d172762ef579166ec84542f711d90256", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ca/f3/3bf7905288b45b075918d372498f1cf845b5b579b723c8fd17168018d5f5/coverage-7.10.7-cp312-cp312-win_amd64.whl", hash = "sha256:f51328ffe987aecf6d09f3cd9d979face89a617eacdaea43e7b3080777f647ba", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/5c/44/3e32dbe933979d05cf2dac5e697c8599cfe038aaf51223ab901e208d5a62/coverage-7.10.7-cp312-cp312-win_arm64.whl", hash = "sha256:bda5e34f8a75721c96085903c6f2197dc398c20ffd98df33f866a9c8fd95f4bf", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/9a/94/b765c1abcb613d103b64fcf10395f54d69b0ef8be6a0dd9c524384892cc7/coverage-7.10.7-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:981a651f543f2854abd3b5fcb3263aac581b18209be49863ba575de6edf4c14d", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/72/4f/732fff31c119bb73b35236dd333030f32c4bfe909f445b423e6c7594f9a2/coverage-7.10.7-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:73ab1601f84dc804f7812dc297e93cd99381162da39c47040a827d4e8dafe63b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/87/02/ae7e0af4b674be47566707777db1aa375474f02a1d64b9323e5813a6cdd5/coverage-7.10.7-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a8b6f03672aa6734e700bbcd65ff050fd19cddfec4b031cc8cf1c6967de5a68e", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a2/77/8c6d22bf61921a59bce5471c2f1f7ac30cd4ac50aadde72b8c48d5727902/coverage-7.10.7-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:10b6ba00ab1132a0ce4428ff68cf50a25efd6840a42cdf4239c9b99aad83be8b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b1/20/b6ea4f69bbb52dac0aebd62157ba6a9dddbfe664f5af8122dac296c3ee15/coverage-7.10.7-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c79124f70465a150e89340de5963f936ee97097d2ef76c869708c4248c63ca49", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/f9/28/4831523ba483a7f90f7b259d2018fef02cb4d5b90bc7c1505d6e5a84883c/coverage-7.10.7-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:69212fbccdbd5b0e39eac4067e20a4a5256609e209547d86f740d68ad4f04911", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a7/9f/4331142bc98c10ca6436d2d620c3e165f31e6c58d43479985afce6f3191c/coverage-7.10.7-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:7ea7c6c9d0d286d04ed3541747e6597cbe4971f22648b68248f7ddcd329207f0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ce/60/bda83b96602036b77ecf34e6393a3836365481b69f7ed7079ab85048202b/coverage-7.10.7-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b9be91986841a75042b3e3243d0b3cb0b2434252b977baaf0cd56e960fe1e46f", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/5f/af/152633ff35b2af63977edd835d8e6430f0caef27d171edf2fc76c270ef31/coverage-7.10.7-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:b281d5eca50189325cfe1f365fafade89b14b4a78d9b40b05ddd1fc7d2a10a9c", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/9d/71/d92105d122bd21cebba877228990e1646d862e34a98bb3374d3fece5a794/coverage-7.10.7-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:99e4aa63097ab1118e75a848a28e40d68b08a5e19ce587891ab7fd04475e780f", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a2/9e/9fdb08f4bf476c912f0c3ca292e019aab6712c93c9344a1653986c3fd305/coverage-7.10.7-cp313-cp313-win32.whl", hash = "sha256:dc7c389dce432500273eaf48f410b37886be9208b2dd5710aaf7c57fd442c698", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b1/b1/a75fd25df44eab52d1931e89980d1ada46824c7a3210be0d3c88a44aaa99/coverage-7.10.7-cp313-cp313-win_amd64.whl", hash = "sha256:cac0fdca17b036af3881a9d2729a850b76553f3f716ccb0360ad4dbc06b3b843", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/14/3a/d720d7c989562a6e9a14b2c9f5f2876bdb38e9367126d118495b89c99c37/coverage-7.10.7-cp313-cp313-win_arm64.whl", hash = "sha256:4b6f236edf6e2f9ae8fcd1332da4e791c1b6ba0dc16a2dc94590ceccb482e546", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/bb/22/e04514bf2a735d8b0add31d2b4ab636fc02370730787c576bb995390d2d5/coverage-7.10.7-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a0ec07fd264d0745ee396b666d47cef20875f4ff2375d7c4f58235886cc1ef0c", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/11/0b/91128e099035ece15da3445d9015e4b4153a6059403452d324cbb0a575fa/coverage-7.10.7-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:dd5e856ebb7bfb7672b0086846db5afb4567a7b9714b8a0ebafd211ec7ce6a15", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/8b/51/66420081e72801536a091a0c8f8c1f88a5c4bf7b9b1bdc6222c7afe6dc9b/coverage-7.10.7-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f57b2a3c8353d3e04acf75b3fed57ba41f5c0646bbf1d10c7c282291c97936b4", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/5d/22/9b8d458c2881b22df3db5bb3e7369e63d527d986decb6c11a591ba2364f7/coverage-7.10.7-cp313-cp313t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1ef2319dd15a0b009667301a3f84452a4dc6fddfd06b0c5c53ea472d3989fbf0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/f7/08/16bee2c433e60913c610ea200b276e8eeef084b0d200bdcff69920bd5828/coverage-7.10.7-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:83082a57783239717ceb0ad584de3c69cf581b2a95ed6bf81ea66034f00401c0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/20/9d/e53eb9771d154859b084b90201e5221bca7674ba449a17c101a5031d4054/coverage-7.10.7-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:50aa94fb1fb9a397eaa19c0d5ec15a5edd03a47bf1a3a6111a16b36e190cff65", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ad/b0/69bc7050f8d4e56a89fb550a1577d5d0d1db2278106f6f626464067b3817/coverage-7.10.7-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:2120043f147bebb41c85b97ac45dd173595ff14f2a584f2963891cbcc3091541", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ef/4b/2514b060dbd1bc0aaf23b852c14bb5818f244c664cb16517feff6bb3a5ab/coverage-7.10.7-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:2fafd773231dd0378fdba66d339f84904a8e57a262f583530f4f156ab83863e6", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/54/78/7ba2175007c246d75e496f64c06e94122bdb914790a1285d627a918bd271/coverage-7.10.7-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:0b944ee8459f515f28b851728ad224fa2d068f1513ef6b7ff1efafeb2185f999", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/c0/b3/fac9f7abbc841409b9a410309d73bfa6cfb2e51c3fada738cb607ce174f8/coverage-7.10.7-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4b583b97ab2e3efe1b3e75248a9b333bd3f8b0b1b8e5b45578e05e5850dfb2c2", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ee/51/a03bec00d37faaa891b3ff7387192cef20f01604e5283a5fabc95346befa/coverage-7.10.7-cp313-cp313t-win32.whl", hash = "sha256:2a78cd46550081a7909b3329e2266204d584866e8d97b898cd7fb5ac8d888b1a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/53/22/3cf25d614e64bf6d8e59c7c669b20d6d940bb337bdee5900b9ca41c820bb/coverage-7.10.7-cp313-cp313t-win_amd64.whl", hash = "sha256:33a5e6396ab684cb43dc7befa386258acb2d7fae7f67330ebb85ba4ea27938eb", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/49/a1/00164f6d30d8a01c3c9c48418a7a5be394de5349b421b9ee019f380df2a0/coverage-7.10.7-cp313-cp313t-win_arm64.whl", hash = "sha256:86b0e7308289ddde73d863b7683f596d8d21c7d8664ce1dee061d0bcf3fbb4bb", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/23/9c/5844ab4ca6a4dd97a1850e030a15ec7d292b5c5cb93082979225126e35dd/coverage-7.10.7-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:b06f260b16ead11643a5a9f955bd4b5fd76c1a4c6796aeade8520095b75de520", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/f0/89/673f6514b0961d1f0e20ddc242e9342f6da21eaba3489901b565c0689f34/coverage-7.10.7-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:212f8f2e0612778f09c55dd4872cb1f64a1f2b074393d139278ce902064d5b32", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/05/e8/261cae479e85232828fb17ad536765c88dd818c8470aca690b0ac6feeaa3/coverage-7.10.7-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3445258bcded7d4aa630ab8296dea4d3f15a255588dd535f980c193ab6b95f3f", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/82/62/14ed6546d0207e6eda876434e3e8475a3e9adbe32110ce896c9e0c06bb9a/coverage-7.10.7-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bb45474711ba385c46a0bfe696c695a929ae69ac636cda8f532be9e8c93d720a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ff/49/07f00db9ac6478e4358165a08fb41b469a1b053212e8a00cb02f0d27a05f/coverage-7.10.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:813922f35bd800dca9994c5971883cbc0d291128a5de6b167c7aa697fcf59360", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a2/59/c5201c62dbf165dfbc91460f6dbbaa85a8b82cfa6131ac45d6c1bfb52deb/coverage-7.10.7-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:93c1b03552081b2a4423091d6fb3787265b8f86af404cff98d1b5342713bdd69", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/07/ae/5920097195291a51fb00b3a70b9bbd2edbfe3c84876a1762bd1ef1565ebc/coverage-7.10.7-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:cc87dd1b6eaf0b848eebb1c86469b9f72a1891cb42ac7adcfbce75eadb13dd14", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b9/3c/a815dde77a2981f5743a60b63df31cb322c944843e57dbd579326625a413/coverage-7.10.7-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:39508ffda4f343c35f3236fe8d1a6634a51f4581226a1262769d7f970e73bffe", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/aa/99/f5cdd8421ea656abefb6c0ce92556709db2265c41e8f9fc6c8ae0f7824c9/coverage-7.10.7-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:925a1edf3d810537c5a3abe78ec5530160c5f9a26b1f4270b40e62cc79304a1e", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/c3/7a/e9a2da6a1fc5d007dd51fca083a663ab930a8c4d149c087732a5dbaa0029/coverage-7.10.7-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2c8b9a0636f94c43cd3576811e05b89aa9bc2d0a85137affc544ae5cb0e4bfbd", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ef/5b/0b5799aa30380a949005a353715095d6d1da81927d6dbed5def2200a4e25/coverage-7.10.7-cp314-cp314-win32.whl", hash = "sha256:b7b8288eb7cdd268b0304632da8cb0bb93fadcfec2fe5712f7b9cc8f4d487be2", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/da/b0/e802fbb6eb746de006490abc9bb554b708918b6774b722bb3a0e6aa1b7de/coverage-7.10.7-cp314-cp314-win_amd64.whl", hash = "sha256:1ca6db7c8807fb9e755d0379ccc39017ce0a84dcd26d14b5a03b78563776f681", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/9e/e8/71d0c8e374e31f39e3389bb0bd19e527d46f00ea8571ec7ec8fd261d8b44/coverage-7.10.7-cp314-cp314-win_arm64.whl", hash = "sha256:097c1591f5af4496226d5783d036bf6fd6cd0cbc132e071b33861de756efb880", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/62/09/9a5608d319fa3eba7a2019addeacb8c746fb50872b57a724c9f79f146969/coverage-7.10.7-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:a62c6ef0d50e6de320c270ff91d9dd0a05e7250cac2a800b7784bae474506e63", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/f5/6f/f58d46f33db9f2e3647b2d0764704548c184e6f5e014bef528b7f979ef84/coverage-7.10.7-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:9fa6e4dd51fe15d8738708a973470f67a855ca50002294852e9571cdbd9433f2", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/74/5c/183ffc817ba68e0b443b8c934c8795553eb0c14573813415bd59941ee165/coverage-7.10.7-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:8fb190658865565c549b6b4706856d6a7b09302c797eb2cf8e7fe9dabb043f0d", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/0f/48/71a8abe9c1ad7e97548835e3cc1adbf361e743e9d60310c5f75c9e7bf847/coverage-7.10.7-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:affef7c76a9ef259187ef31599a9260330e0335a3011732c4b9effa01e1cd6e0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/84/fd/193a8fb132acfc0a901f72020e54be5e48021e1575bb327d8ee1097a28fd/coverage-7.10.7-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e16e07d85ca0cf8bafe5f5d23a0b850064e8e945d5677492b06bbe6f09cc699", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b1/8f/74ecc30607dd95ad50e3034221113ccb1c6d4e8085cc761134782995daae/coverage-7.10.7-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:03ffc58aacdf65d2a82bbeb1ffe4d01ead4017a21bfd0454983b88ca73af94b9", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/0f/55/79ff53a769f20d71b07023ea115c9167c0bb56f281320520cf64c5298a96/coverage-7.10.7-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:1b4fd784344d4e52647fd7857b2af5b3fbe6c239b0b5fa63e94eb67320770e0f", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/88/e2/dac66c140009b61ac3fc13af673a574b00c16efdf04f9b5c740703e953c0/coverage-7.10.7-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0ebbaddb2c19b71912c6f2518e791aa8b9f054985a0769bdb3a53ebbc765c6a1", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a2/f1/f48f645e3f33bb9ca8a496bc4a9671b52f2f353146233ebd7c1df6160440/coverage-7.10.7-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:a2d9a3b260cc1d1dbdb1c582e63ddcf5363426a1a68faa0f5da28d8ee3c722a0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/bb/3b/8442618972c51a7affeead957995cfa8323c0c9bcf8fa5a027421f720ff4/coverage-7.10.7-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a3cc8638b2480865eaa3926d192e64ce6c51e3d29c849e09d5b4ad95efae5399", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b2/dc/101f3fa3a45146db0cb03f5b4376e24c0aac818309da23e2de0c75295a91/coverage-7.10.7-cp314-cp314t-win32.whl", hash = "sha256:67f8c5cbcd3deb7a60b3345dffc89a961a484ed0af1f6f73de91705cc6e31235", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/4c/a1/74c51803fc70a8a40d7346660379e144be772bab4ac7bb6e6b905152345c/coverage-7.10.7-cp314-cp314t-win_amd64.whl", hash = "sha256:e1ed71194ef6dea7ed2d5cb5f7243d4bcd334bfb63e59878519be558078f848d", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/12/65/f116a6d2127df30bcafbceef0302d8a64ba87488bf6f73a6d8eebf060873/coverage-7.10.7-cp314-cp314t-win_arm64.whl", hash = "sha256:7fe650342addd8524ca63d77b2362b02345e5f1a093266787d210c70a50b471a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/a3/ad/d1c25053764b4c42eb294aae92ab617d2e4f803397f9c7c8295caa77a260/coverage-7.10.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fff7b9c3f19957020cac546c70025331113d2e61537f6e2441bc7657913de7d3", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/52/2f/b9f9daa39b80ece0b9548bbb723381e29bc664822d9a12c2135f8922c22b/coverage-7.10.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:bc91b314cef27742da486d6839b677b3f2793dfe52b51bbbb7cf736d5c29281c", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/dd/6e/30d006c3b469e58449650642383dddf1c8fb63d44fdf92994bfd46570695/coverage-7.10.7-cp39-cp39-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:567f5c155eda8df1d3d439d40a45a6a5f029b429b06648235f1e7e51b522b396", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/b0/49/8a070782ce7e6b94ff6a0b6d7c65ba6bc3091d92a92cef4cd4eb0767965c/coverage-7.10.7-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2af88deffcc8a4d5974cf2d502251bc3b2db8461f0b66d80a449c33757aa9f40", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/6a/92/1c1c5a9e8677ce56d42b97bdaca337b2d4d9ebe703d8c174ede52dbabd5f/coverage-7.10.7-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c7315339eae3b24c2d2fa1ed7d7a38654cba34a13ef19fbcb9425da46d3dc594", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/c0/54/b140edee7257e815de7426d5d9846b58505dffc29795fff2dfb7f8a1c5a0/coverage-7.10.7-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:912e6ebc7a6e4adfdbb1aec371ad04c68854cd3bf3608b3514e7ff9062931d8a", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/e4/9e/6d6b8295940b118e8b7083b29226c71f6154f7ff41e9ca431f03de2eac0d/coverage-7.10.7-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:f49a05acd3dfe1ce9715b657e28d138578bc40126760efb962322c56e9ca344b", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/db/e5/5e957ca747d43dbe4d9714358375c7546cb3cb533007b6813fc20fce37ad/coverage-7.10.7-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:cce2109b6219f22ece99db7644b9622f54a4e915dad65660ec435e89a3ea7cc3", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/9a/45/540fc5cc92536a1b783b7ef99450bd55a4b3af234aae35a18a339973ce30/coverage-7.10.7-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:f3c887f96407cea3916294046fc7dab611c2552beadbed4ea901cbc6a40cc7a0", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/75/0b/8287b2e5b38c8fe15d7e3398849bb58d382aedc0864ea0fa1820e8630491/coverage-7.10.7-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:635adb9a4507c9fd2ed65f39693fa31c9a3ee3a8e6dc64df033e8fdf52a7003f", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/0c/1d/29724999984740f0c86d03e6420b942439bf5bd7f54d4382cae386a9d1e9/coverage-7.10.7-cp39-cp39-win32.whl", hash = "sha256:5a02d5a850e2979b0a014c412573953995174743a3f7fa4ea5a6e9a3c5617431", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/43/11/4b1e6b129943f905ca54c339f343877b55b365ae2558806c1be4f7476ed5/coverage-7.10.7-cp39-cp39-win_amd64.whl", hash = "sha256:c134869d5ffe34547d14e174c866fd8fe2254918cc0a95e99052903bc1543e07", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/ec/16/114df1c291c22cac3b0c127a73e0af5c12ed7bbb6558d310429a0ae24023/coverage-7.10.7-py3-none-any.whl", hash = "sha256:f7941f6f2fe6dd6807a1208737b8a0cbcf1cc6d7b07d24998ad2d63590868260", - marker = "python_full_version < '3.15'", + min_python = None, + max_python = (3, 15), ), struct( url = "https://files.pythonhosted.org/packages/75/25/79a66272edd250031aeee6db87d500a0bf76390d0d5f8c2f431fe354715f/coverage-7.17.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:99a7b390cbccc6bf029ca4da3f0f607c218bb4085e9cd6b58a90d14ca12993c3", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/52/a6/f5f6fefb2fc1305363927edad1d0a60ce6ef80d6c1a74a79e825f0f670eb/coverage-7.17.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f72640e02a470b57b15cd655820133f6892760209283a363a60e2df932d5f0fe", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/28/61/72889bac8eb44c51f8043edb227df551dfdca1fc4819a6c6d67b3f69427b/coverage-7.17.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:2dc9233f39149b5a4f4aba17a4b6bc5cca22e52cfc4b06fdb07d014439b8b2ea", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/f4/e4/03e4a5644df9b73de0d44d1b82acd18b06c42b5abc3f1433be8363fa983d/coverage-7.17.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8e8113d3852e9377421a61de1917df27b3abb25404a4ecf69f9e64612c4345b5", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/6f/4e/949022286df7e59e8633a3a7e6635e0e6b53af7d57074cb0bf8f500373fb/coverage-7.17.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c86a39539d10d666bb819c16c94d7edfc1aa2e0531b937f7c549b83d15177c6e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/27/cf/7d67f60df081006315699b7edb9402c1b47142caf1383f4e56ae8ff1a501/coverage-7.17.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:559f748446ee799803686b5784e3deb54c70d655ac386a860e06b11672504ba7", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e1/e0/9293d94afbc099990a085e88229a51c79b00828aba0f2adda32dc4cc16d1/coverage-7.17.0-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:34d65c9e8e257f48a654908005046fbf1bc48d9540ae3776ad08c0acd010e10c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/24/c8/bcd28efedf262c074dae76f61098739eb02b15f3f716f80cc86f9885b8a9/coverage-7.17.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5b7fa0997b8eba7378ac66f31ec7f70164490353ab79b9667d37c0d365e50177", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b8/dc/503f55e5e2200933403c90d619d9f779b5060ddd338b1bdc63cd235592cb/coverage-7.17.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:6ae0453a3390e67f7bfbe34417bbdf5b4ebfc21db23fb446a0a41115eeeca6ca", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/bb/b1/f1a57c36077cc516240636f7eff0d1427939ed795f096dd2c7769213a56c/coverage-7.17.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:96151262832f3c230ebae23b2d6911ad549e1738465946c97004913ff06112ba", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a8/4f/c2e59d4a132936c7c207b9b69ab99c0f27b14c3c93266e9922aa3b562b37/coverage-7.17.0-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:cd7397de6cc782f00fe5ac1d75e9b306bcfa49c8b6b8dd6ed1f7709393ad40b3", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/05/04/50742c0ee8b6c85826ff11737c93ed957fea4c9acf4b4b99804bdac1dd84/coverage-7.17.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9d1fdf82c6fea57b5e9dada509f9ce9638c8334664e2c98c7f6f1ccf3d143ad2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/8e/cd/83ad4bbbfcb6d045a33c14cdca313f6c9275737c67f3b7300222e3239a37/coverage-7.17.0-cp311-cp311-win32.whl", hash = "sha256:38c86e5d74bbfd88a393fa3f91257c1225c63aa6db6d5918de3e49ab04f91c6e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/ca/c8/dcc5a7effa79707eb8a61e699b141cff7c9b46036771274cfb48ea7b765f/coverage-7.17.0-cp311-cp311-win_amd64.whl", hash = "sha256:2ed3097c6817bc1a7fc8ae0a6131db74aa1150d863cccc308237ff362d3226b2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/d1/58/a8553e0dcd38d8136df63964638d2b588e0a4a916bff1bca996244fda693/coverage-7.17.0-cp311-cp311-win_arm64.whl", hash = "sha256:6052e878b628abcd38fa5f2b64abebc686eed4e2267da42434017a9c6d24f241", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/0a/25/989fd3b495c4274ac0cf54cb6664326415e60183a7f8a73dd9bbb0b11e34/coverage-7.17.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:0cfdc938ca3319d873d1f1252e60620a39aee4ebf9dbd7cc58238109ebda9c51", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/db/cb/14726426bf3241657facbf0f7df7babd8f7d3fcf8e4609b7929f9dceecbc/coverage-7.17.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d523da3c2e4bca49417768bcdb1a443c5b359dc44b8b93a3102e118fce912c40", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/8e/97/f95ed32cd3cfbe261a3598e694cb770cefc7b2d13ff013418d6f70a44dde/coverage-7.17.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:adbf3450c0f3f2b2854e282a8758f2b3eddf787eeff24ec9c9bc2cbc38328cc1", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/91/ac/eb4c31f741509a9ef48cf6f28385e98e9de0785599282252eee252ff8af7/coverage-7.17.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:85932227e9dd38e62cd29c17fefdfecfb919eead6af1e3259522d03cf85de983", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e8/3e/d9cd006d1a3cc5deab07beb29b86cb4a10dd84d66b330820363fb8d310d6/coverage-7.17.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:30f5477aac9c9e4a0a641c55f8f8fddd7f3bd91176c912c50f40ffced96b4034", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c0/3a/4c872c6ae0762b09cdb8e856891bb3f584848cb60b6dda2bacb85fe2f3f0/coverage-7.17.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:0b8bb651a4406fb6a983a905309fec1783443c65e1771b41e92740a0f4a1176b", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/df/98/1d41a2373fa98b423bcd70adb91d75e38eafb417955426dbb920b10016f3/coverage-7.17.0-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0edeb6594f080c8de1263cccb239cb316ef77aeb959e2e0f38f2953fcc72a49e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/92/6a/fe04b5e63e76506daa63d90bdfb00a53767fe5df18546b437d6226918d6b/coverage-7.17.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:da94ec0484e84fce5c7bf8d0f54b97767a90d992653a129b35634699d516e0a5", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/4f/c3/5c5a78dc19dd4799be9c6ec022316fb25ababaeacfaf0f52f24c56a57b43/coverage-7.17.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a25cc5e8c23a590815c6a7aa43624234d25cb23b21b484adb8a0daed59860db5", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/ed/e7/4c1d8eaff4d756fefd15d58c4953a78ab656782fd0e32c5a3465dba61aa0/coverage-7.17.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:db645c81cf4d6bcb392ea1894aad65d55d1588a8472c834b25ca575da3029a56", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a6/2a/0b17c3e2e7b6ff1a5d92eb58915c0d1026668928f961d14dac73cf1b6096/coverage-7.17.0-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:6a80a11b90c4a03df1502304cf24ff953255b6b5d076ef79066ecf88baaff31f", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/d3/2d/eb0cbde0535342df0d17a667163030a3afb67e5eb9e3ad94af9540041584/coverage-7.17.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e4eaf11d6b0f2147f46cfbf06fe7edcca6f095d0120da00ddc2458995ee869fc", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/2e/47/1be2a6db7eb655d0a1d899217c3f2469f9121cbbeddac35c1c8173b1482e/coverage-7.17.0-cp312-cp312-win32.whl", hash = "sha256:912a29f338798541d795e2e25903c6fe7a99dee70a40fe4706a9a124649b523e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/11/c5/201c894c57de81875d8b8cc527ba222aa350e8cfb183eb3f6df45d06ad8e/coverage-7.17.0-cp312-cp312-win_amd64.whl", hash = "sha256:88a1a9fb0075b83389dd9b403bb3fce976031b3c2aa0e05e3e57143cf639de69", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/0b/5d/196095339b19758cf83f507fb598bc42820ae124745feb3084662729e17a/coverage-7.17.0-cp312-cp312-win_arm64.whl", hash = "sha256:2c680e838ff9e68d491158625ca2c1ddb17d78d791bba96a31f8b839b4990438", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/54/e6/1f01afbc9f4fa8ca5e1fa6fdf537a5c58b5765d1b4167ee284cddb9acc72/coverage-7.17.0-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:84538c040f4e6214f663459d89372ce4e6b2bbdd9d397ef0dca7b3ecd56b8eb2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/92/7a/bdb7e6260c4a211389aeac9b89dc31662ebe122153ad0ecfd156897912df/coverage-7.17.0-cp313-cp313-android_24_x86_64.whl", hash = "sha256:6abfb6a4cf1cb1b67bc8fccdde177e2d2b781d0d34449e7078156547025140e5", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/37/4e/276e7d5b3cfb124871bdb544c27b004a8b4e270e6bf8e7414149c54b5e5b/coverage-7.17.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:ef65e96f0fc1a7c8b7644c7011d47a8228555e7888ac4d6246f715a7f3d7c398", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b3/7d/dac073db12f3c131598a6693253aded581e4d7d622a89864f11bfb0ca2f5/coverage-7.17.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:55939ea4c097fda2edabf80fac5e49bef15597b950a9f29fc56292a895245feb", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/00/45/877b0a9248e921080ae91d115c13192d17e308f5aee86bcc7f7bc2a54ed1/coverage-7.17.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bfb6f868af552c0ceb2d19220b8cbcc2be096ca26163ac30e682a13041433429", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/4f/f5/2c48d47abec0e4590b302920334be5ee3854f96bbd22524feabb8d92b220/coverage-7.17.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8d823d66afd59566030539c49c7a6acaf3083996682be2dda760c63555842094", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a8/a0/ec0442f3f372c7fd742f49b3022edd392f79e37a0048e1fa333f56d01ec3/coverage-7.17.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:50678474e714c684b82c108e63fbb8f1bcf1266d8293a49980f1d08526f093b5", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/92/e2/eb0927ba93809f76eee69fa1e47999825fc7dbbabc3e0e1a2744f2677acb/coverage-7.17.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:045c1eeb19fb4eae949850a761102fffb3a5f638b97f977912f95843e54f6669", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/9a/a2/8d4c6055efb32099b15c9cc33d007b8aabebc4832f372a3274de5ba0afc5/coverage-7.17.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dfb12891a773cbc2132349c77c690a045a882fe3f98b4bda50dfabb01893f9bd", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/2c/1e/93412288688a7b03f152a734c8ef086e395108a0a6a746985d3967e220f2/coverage-7.17.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3067608b4429629f640c1b23d2f69b05d2fd45e00ebb6ee9e8fad220a6c11722", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/3c/20/7eb8d805c4f1a212245cef20181dfbf39535357985073d49730ee9cf08d4/coverage-7.17.0-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a1762e85cbbe3b5ff9c6dcbcc1b89d5c72320094292b7b9572bf882c85e428b7", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/1a/c1/1df29630b4ed17e135c76390afcc6bd273c3dc5ba2a21a76813a600fe98c/coverage-7.17.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:62bb77987d3f72a0aaa77c567ee7f9806bc2e748c8f46fafbe1fdb90dd148398", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a1/79/2365d1008d28aafe468a450a24c6c63363de794b5140223d67685cd0e205/coverage-7.17.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:6cc31f27240d4e080437e3b8229d92f1d809c9a4f233607385373b73974e183e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c0/9f/f002952d295d772688dffce0d991e3822795b1e3aad158073712a5a5e86e/coverage-7.17.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:61cde5222f1933d476647c5a25ed1a8678b7703098cb5a15f4a0aa39967d8c28", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/40/fe/f9e15fbb426be97cd679ee5d359151e046f103bcd76b5092c318c26ed596/coverage-7.17.0-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:11f5f7fb2d97a0fe865f5e7bad4eb0619b957637f676bc088d13844adf26ba95", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c2/4a/3c398f38694387334ff4c9f71afc8e15b4fa7db7bc0bea4d5b6032eb0df0/coverage-7.17.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6e09612b1b82c9df1d2b6c85dee88d5aad3e73d77a8ec0b16ac6a7322cbdf5d9", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/bd/a9/908a3cf1a2335aec1c788682a06c2f742a62a4f987033f080de1c5fd1997/coverage-7.17.0-cp313-cp313-win32.whl", hash = "sha256:bd3e9eb493631ff1ca34bf5efac25b5c66724f837bf6182c4fc771c55946423d", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/13/f7/8cdd7bfd8a63b3e6b133fc395ecfc7b1cb6f561926e7e2ad050de85b83e7/coverage-7.17.0-cp313-cp313-win_amd64.whl", hash = "sha256:f1fc9a7cea899c51d8a53e66c2f082a3d9e461ece32418d3ef0a0b90c32bfd3d", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/09/cf/0b3fc57f735cd3831ca13d0be5312a5477d5934066683c5d34018cab7541/coverage-7.17.0-cp313-cp313-win_arm64.whl", hash = "sha256:e65a1e61a68493fbfbe44d8bec71b3231d81b9917f62d3dafe0e105072147e83", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/4d/e1/722462fe79912ebebc101497bd16c42413cde2dbae771017f1ec0acb84c2/coverage-7.17.0-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:dc5936491e306f2f6f095bd5fba593de11eb0375cee787ca1f245c3a333a523a", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b7/74/826b9c09f2ebfea803bccb391d935688a25309bff8e819fc446bc629c108/coverage-7.17.0-cp314-cp314-android_24_x86_64.whl", hash = "sha256:968c5fb6e0c83cab752d79a70209648ce4d90cae815c60fa229b59e264601062", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/6d/19/c8514d7f5e0659a96ff2bc7377119dca6d420e2761c5fc69ae37618734f8/coverage-7.17.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:12cb8a20ad904a5811e6660d829a586b216e5254b9b34b76dde8a4d65d827dc6", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/81/74/ef9433ce599f07d8633b4ce6e6d6921505c4ef3f7f9006f8eb66e2c278cf/coverage-7.17.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:bb5ca66937c55bc85d1a5e9c5900a3e4693a8edf2280a9b3672b7b2661a84b95", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/d8/66/26e58981940e8b3944c6a9941bec5c7f50840e7009a046712e3f3bcd9e6a/coverage-7.17.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:5cc15faaf318ee5040d835a62c75bc6f122d837274f3b5efd47bf9fbd4ac5b85", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e9/63/fe175310815cc8357b83b773c9b4c20943c269f217dd825a37c4b4bfe324/coverage-7.17.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:7d6d9d396c8b7bcaf76d774a10140b218111484e54c73a5f2a1b75655381748e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/2c/b0/ac84761f5b4bd226696b0ec4606903d2ef7208abda0aec06c14a4218def4/coverage-7.17.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:42e6f170d1ac04b7eb3363310a6c41cdfd82c1fe6bf9ffbc4a86f380bdf091c7", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e9/58/d8bdd65a661913bc12eaaa3e59742b2cb8b94f2e7f78e62184f0a58ca493/coverage-7.17.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:acdb5f3c96046efff9dc6c572a6acb2b8d0da09372d7b9a9ed7249cf7d17434f", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/7b/15/5d82e2f0a75ea149e0a6412e137e1d610538772fdfd7199737db7fe234da/coverage-7.17.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3393209f6894713161ee82a9b0e673e58237e0f9733c6638e7a6c0c620ef0b33", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/0f/cc/e3ebfd295d1dd47c7bc84a17d73f150465a37ab388dd68fe82b495dc79a0/coverage-7.17.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e9494d9e99389d39e6a96227749af898d8924ff591cb63944f8a98e68582bf0e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e0/9d/e2adff76d6544bbc6df7366d74967923c2de37ba889a006bfb875bf5857b/coverage-7.17.0-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:032d4c2db4c677eb71d43f2f8b80bf64e9346f7a3f7b6ebb13f1782f3cc6c274", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/d9/fd/ecd1e9cddf1c36b5d03c438568b1f53e63db84bb3656539d71b454484c7d/coverage-7.17.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:4343a9378b964eb3cb80fa90406385de91c7e982a769ca9314d848f93bc0d3f2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/40/b6/e17a19dccdbcad494c64691f71c1dba3e55c30625bc29ffbb88ac5a0aa8b/coverage-7.17.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:b609df3d6d900464207532c5170a65c6ede8d2e0b91f151f90008a866395cd76", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/6a/0d/37dac534709a3fa43a937c8b0604839bb44b8670b83d143a4b78fec20d1e/coverage-7.17.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:a01ef92caeedfa4f2ad171a3a8e6fece4565de871d8bca428151bf9929f41048", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/cb/17/7c05186925b4d64a46c271dfd944e3f0c1ad89db9095c31a6df157a75df2/coverage-7.17.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:a3914e2c98c34b94c26d2add3d2a61ccfd3534fc4eaa879ee290bdbb5184ba6c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/95/65/c241cdee66a0ff86c68f6d37328e735d10e3d30cd6ff66f356039eb688d2/coverage-7.17.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e8a72b26dc5c9a9422e45472b1d67ba5caf273c524c8668cc04b23062663755e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/db/09/e93233fe2405574ce0a31ed201c0cba3a860e085db5d2828bf12b7dc0790/coverage-7.17.0-cp314-cp314-win32.whl", hash = "sha256:03baf0688e14a5a44ffd1eefa8928dfc92b14565e521174e072b31b971aa1657", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/d7/77/04979eb217edb94b94afabb4bcc179f60c746f68d3fd0b12688ba9195730/coverage-7.17.0-cp314-cp314-win_amd64.whl", hash = "sha256:3a4459b0f389dd1e51aac3dbfc4ca35b30cae7dc99caa3c0a086d1997a985709", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a0/38/155f2f2c6769f8c43eca8a5e581443faa0908828650090b97103b4a41376/coverage-7.17.0-cp314-cp314-win_arm64.whl", hash = "sha256:a32ee5831b15ba239bef5d272ae586ca8acea4a661b5f2941f5a0d380e518b23", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/52/55/d6751572d9445485c4c5a51ec6ae11caa5c11b7ef2448cdccc884f7f54d9/coverage-7.17.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:9c083e253e96fdeeaf48133fe836cac86ace2db215d235700e7f7532420a200c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/2f/a8/82d37760e537bfdb9fdee285fa1e1b45bc153293d23e2331c7befedd1990/coverage-7.17.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b88fb4d4d7608cbcebdc7ff7dbffc2115e3b81d6c33a79147cd79d54fcb080f4", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/24/96/70ec00a9db6d7bdd3f914eba12057360769f5cb78a98456e71fe1937deb5/coverage-7.17.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:2bf3ee38a40c0570c316b9e7507c472469586906a20f289705898528c31aaea8", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/77/d8/d99be3bfbb208512f039c80b31e404138a86678fc929a17acd5b7135a6ae/coverage-7.17.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7c570293f001ea91598b90e90cb9b98fddee833e90bbede432cbd218331ccd8e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/82/50/6cbe8b5a5060edbd21ce8109c4e900f8b7656e8b72ede6dc4d82dc0b8bfb/coverage-7.17.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:791f9ee09814dd30d9562b4f4eb037a371485ec1c830b53999d2320d20c4e764", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/bd/05/d3633add01e5518dfdacfdbd1be41cb5c581412dd8bccd663edf6ef7fec8/coverage-7.17.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c7c5672ecf1b497de7a0b37743bef40e3b58e3207e9fe2ed6682cb0420836a88", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/57/d9/b83387780271bf9ea9f96a3aeb01c1c302c4494a927923c4fa70cd170a3f/coverage-7.17.0-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:337f87e62e1c5f43c8198d879f677c342d152f84d3f157add12558853cbb8eaf", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e4/be/8e80b29764ae3f4d70d44952eee3f3927eb36897490fe799e400adb7f5da/coverage-7.17.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:c8a58baa8eb6154c6645eadcc19b6c089deab78c24a612a83206f2a8a5992a7c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b8/c9/e702f588fe8d83ca844f133270ad0a49bf650c8cf260551ff6f11a6b6bbf/coverage-7.17.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:fb5745048ee20f796b0e3ab61831049e749acff188563e2af32f58ede957ac1b", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/8a/11/ee13ad14b714d75ef07c490b6e43969574a8b8b8c6d67bc741fcbacbf9c3/coverage-7.17.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:7b5abcae74750302ac4bc77351eaee87c450e4abd3b6225eacde3858e260f8b2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e2/bc/854e8912c11c54aaf416e74602000589c6efbbe1f251dc90202fdabddcb6/coverage-7.17.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:4e153f0bd6509dbf837fd585f489b3328bfd98f2a718a0b15ae63032148b285c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a8/dd/96432830ddf63bc42654de54eee77a0cd6949cc65769bda06f353323f23a/coverage-7.17.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:e42a835271922fe7bf98c7a05c78d4032f4e52bf5b07fafa1eadfdfc2f0ad22f", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/ce/ee/230c6ec065a6629d41cc89323ceb54d37e2650c104f70fc108f4ee7c5051/coverage-7.17.0-cp314-cp314t-win32.whl", hash = "sha256:5900055351ec89fdffb34b27898815106529ded29a9496464c1ebd6313fd40fa", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/f0/1d/23eb6aadcb3c00764ff2961c0ff55f5dfa2543856d932b949bbc04fa68e9/coverage-7.17.0-cp314-cp314t-win_amd64.whl", hash = "sha256:5ee9c8bd13a59e301dc2aefe7aa8384633406808de051b1982775667094eb673", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/3e/f1/7df117e8e016b7a3ee459e833b3456f3610505afefd071f8727702d98439/coverage-7.17.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a9cb9a0fb58e6fff5442969af36094ecd6976f4907f179e33b27e15355d8f74", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/9f/a1/f9c24911755f91e6f451ca2e2c1804fbcbe9fecbc3310e341bbbbfa1d85b/coverage-7.17.0-cp315-cp315-android_24_arm64_v8a.whl", hash = "sha256:adabc1079ba844b096799ba8638d8df434aca1613f95bb7d5791af320cf05559", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b0/a5/2b665b40c626e6bb40e5e8e23d91170b48b5f2f57186f46b07f2fac42386/coverage-7.17.0-cp315-cp315-android_24_x86_64.whl", hash = "sha256:6b4593d2871c4c801656dd5861e759f8f5156febd6b6061b02f6a72d64618b7b", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/3d/8c/22b518d61b930b8a4d62905d046c76a03675ef19b466462011dfb16439a3/coverage-7.17.0-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:c2c48a36bb970b7265b196032bfd4237c0b373f2b25ef7012d7e905b5b35c19c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/08/5b/d3b141455944e030cd4987f055f8c84a44a1a0b28d81ae93389f44051691/coverage-7.17.0-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:f8bc2cd4c6aa58be1ca243fb8cddb6c3c42031fe4403991ad9cf2b3baed03d9f", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/03/24/aab2156983f7022361352640c583d08f0238e4cd7463eb921172001b4cfe/coverage-7.17.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:cbf0b83ce927de6053279ba61342d9f8892afde1385fcba9144cd05d4023d109", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/87/db/94697b9ccf4ec94cdad07bf94e2a21b9702247cb212d2d5f18d2b9c3d0de/coverage-7.17.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:66efc0fb99cee34626fc17d3adac9c3cd816bfdad563bb1e983c3ef432f566d4", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a0/fd/db1c4ade4219831d590fff5aa5b7d9ceaf84586e8e60da6fff71b6182251/coverage-7.17.0-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:58a304efdf2253fb2ea03d45d0a04cc174a92a0cd5279c28c5bb893ce7410968", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/95/ee/84ed138990ed752abd73db4adffc1842d6152017d8e21809cc109a413fda/coverage-7.17.0-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:aed06129a9f530a948928260d7d2d81c47261355b0127e3c782251b38958463c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/64/ad/c1e4367bbd1e7d562d6bc979c82b542f2040544e95a8cd995b694caf0e1a/coverage-7.17.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f6cdb47a9be2d3313829bed1d296086287682a3ee901ff987b3432b45705b771", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b5/3a/e8e8509b0940403eab15d86f70022790a01fce3e971a161919c544953f7a/coverage-7.17.0-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:804fbaf81d09b34e2f8b1159d01e211a50713d743d32fd9b2ca6cf0ae507a66f", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/1f/77/d64bbdbb734b1059ebcde2b5df567f142a9948079e51af9b0abf8c9ec17b/coverage-7.17.0-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b2afebb96da9a1bbca142f8cc12320c14e5c215e0a49cded4f191f5a31506a28", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/e2/29/7cf81f08a254532c074eb52cfe6b12bb753d08f2997269c9fac8de359541/coverage-7.17.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:bd04fd23206be9ad3de13b0b39313094fafa66a1f6baf70f5471c004a9fac47d", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/7f/56/bacea6dee2d5ccb31ab0cfffcee87ca7efa80ff048840209c8013aeaf02e/coverage-7.17.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:5ebfbc87836529a31d25c2dec1262c38eea852ec1c46c0f690a515a7339d9c5b", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a4/97/fd8a6a63740f9ee177c53b59e2f4d0752369bb0fd154086a1e69aa1fb255/coverage-7.17.0-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:a59c3b470ac3b2432af3598a996affbeb10236cd899a005c1c4e517fcff8b592", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c1/37/7cd3d3520d45db3788456452b65446182c08f2a7c276f40c9dd11966be02/coverage-7.17.0-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:7fef12cec4b96f59e09761cbd4fc9bdf4788062d1ae435b920241fc16c8a9549", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c1/b9/80343a55e07d854927a915cc21a52e350ae1db9ead33f0248507b960785f/coverage-7.17.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:a14e8d69464da9cbe1dc29e7116dbd37296d1d51a695327c478e250349085089", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/f3/32/e4c816f0cb3efdc6392bb276ff88359729f9dec605bdd3c1c7a44776f759/coverage-7.17.0-cp315-cp315-win32.whl", hash = "sha256:9a66074231799d8884d267234d49f60c90b43a945dfe069646b72f3058cd4e67", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/43/14/283120142ac281834808584249b89957de997c28573ddd65ae106b622121/coverage-7.17.0-cp315-cp315-win_amd64.whl", hash = "sha256:79cf71e5f9a48877ccfed5baa2c72f45af4feeaa596249e23eb15b473134830e", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b9/bc/83dbc6c3bd58042afaefcb0cfd7d7a2e3076989a2f3d9bc6e6edac819784/coverage-7.17.0-cp315-cp315-win_arm64.whl", hash = "sha256:09e563b49c81cd0a33734e926d7a4a6ef1778d74304cde2dcc3aff8b30ea1036", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/00/ed/9463d1cb1766a2570343a372c2871c7fb4d561e5051f029399f4d57ce947/coverage-7.17.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:a5e2e0625dfc789af0b2e10acfc106b352f314fffbd19e6392a7961c8cbe5d9a", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/ae/59/6536c7fa87be13236b4184fc395f14d18f622a5b8ef7448a6bfdf5f24ec0/coverage-7.17.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:194562ab1eff0d85aee8a17ce4c5c0bc1ebf70a629a7145257123156ad100fd6", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/b0/bc/4ffae6038f78382c9ab6a4969cb5fc01d50b083d119851085807629abe88/coverage-7.17.0-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:85682ca89bc4601125dcdff23fa70e6274e13c9ad502fba845e6c274ab2c6569", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c0/60/cae4b708b4217d33ebf66b9c57f8910a257346b3eaf054a78d73605ddc4c/coverage-7.17.0-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0d0fac604a962ff546beb038cba9a5a09d88e6e3f01612fb46f7bd4fe5dc8dca", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/a9/84/1225ab04e55a6a2e483e903a5eb0f8f081cb5325df833594534aa288d91c/coverage-7.17.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:72edd4f9483ae30cd1ba4f230687840ef7b58a16afb1c9e81131fd6d64655f36", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/94/ad/567f8dd9246a553aa8753732c41f0e0654e98e9a617d6282e64eae0e6aa8/coverage-7.17.0-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:91e487ad07c511da77b574820141a7c2da09bc2a4b4090b5be2424295d100697", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/66/5f/e0ee76895df40601e4aedffb6b8e71ea48e276a629fb4488b92cffffca14/coverage-7.17.0-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1cabb31531002fef5197de5df3c84730aef01e750e25154b9813a2583435aba2", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/19/6d/d19c6e45e940e5b9ba697b7be9a8e63cef73d90bdea45b670a59df466717/coverage-7.17.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:c9ac886242bbd50fb35a2242ba79555a99891e657da33f98b7ca968e3488a350", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/27/a3/b2731bb7aef2db800b330603675c3fa58a6497a05d5b5f8625f3b6285f68/coverage-7.17.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:d45cdc495671fc99268ff3653e0da4244972e9fc0e1fc3ea9de18781ad28963a", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/50/75/d0c90a81b6b6607933109914dc8b0ef0a5f4cacf9482ca868ae773ee5d0b/coverage-7.17.0-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:12961f738d717a046d4bf3f8d1727eb3ebe2ed5478ff96cd6233d4dfc39323d3", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/64/1e/f038f3a2614e9ef839a40a184713aca40b8ed79e626ab5cdc388771045df/coverage-7.17.0-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:1ee0a982b0e1230b3edf768a7dd022bd2377303763895327ac62deb5efacee03", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c9/30/8d636e639b2d8b1934128573402a7caf66c8cfbc794fa02061d84f115c34/coverage-7.17.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:460679f53893081edb94eeed011d26be37228ba649b853fd2aed7e4394fb1f35", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/73/7a/219f6b391cb0636242d06c390a8add5af91afa3e92afd0380dbedd34f487/coverage-7.17.0-cp315-cp315t-win32.whl", hash = "sha256:600e121e412cd6bdb52ec105b95c6a04da0c9710d1534f6e64a42db667907802", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/f0/3f/514d294319c5eac11494394545de209079f33993e14526c220eab29b2a96/coverage-7.17.0-cp315-cp315t-win_amd64.whl", hash = "sha256:c3e11b81faafb1f063248735c3e2c5c4183fc1db2c7f46782170dd7760dffcbc", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/f6/82/c0d8bb0a67df838fc7bc6f4060ffc404fd1154fd18e624d83e6abc41aeef/coverage-7.17.0-cp315-cp315t-win_arm64.whl", hash = "sha256:d472ee1c64868a917a47f02ffb4ac8c22b477f7589d57a3eb0c58b1ad4f0137c", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), struct( url = "https://files.pythonhosted.org/packages/c9/17/48032919343afa2906112d458aceda2043afdb24a2ee8eb4c60904d8ddf1/coverage-7.17.0-py3-none-any.whl", hash = "sha256:bac487dce0d2aff28ddf1a533a916f771416eee0e493960f611e49037b878e9d", - marker = "python_full_version >= '3.15'", + min_python = (3, 15), + max_python = None, ), ] # END: maintained by 'bazel run //dev/update_deps:update_coverage_deps ' @@ -1170,14 +1389,14 @@ def select_coverage_whl(*, python_version, platform): abi += "t" base_platform = platform[:-len(FREETHREADED)] - marker_env = { - "python_full_version": python_version, - "python_version": ".".join(python_version.split(".")[:2]), - } + major, minor = python_major_minor(python_version) + py = (major, minor or 0) whls = [] for whl in _coverage_wheels: - if whl.marker and not evaluate(whl.marker, env = marker_env): + if whl.min_python and py < whl.min_python: + continue + if whl.max_python and py >= whl.max_python: continue whls.append(struct( From cb060ebb66aefd5899756357810f2a3eb9004c92 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:30:22 +0900 Subject: [PATCH 03/24] refactor: normalize the names with pypackaging.bzl Use `pypackaging.utils.canonicalize_name` instead of the hand written loop. The result is the same, we only keep the conversion of the dashes to underscores so that the name can be used in the labels. --- python/private/BUILD.bazel | 11 ++++++----- python/private/normalize_name.bzl | 14 +++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 7ee5ca44d1..9d30e138e7 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -966,6 +966,12 @@ bzl_library( ], ) +bzl_library( + name = "normalize_name", + srcs = ["normalize_name.bzl"], + deps = ["@pypackaging.bzl//:pypackaging"], +) + bzl_library( name = "artifacts_manifest", srcs = ["artifacts_manifest.bzl"], @@ -1001,11 +1007,6 @@ bzl_library( srcs = ["full_version.bzl"], ) -bzl_library( - name = "normalize_name", - srcs = ["normalize_name.bzl"], -) - bzl_library( name = "pbs_manifest", srcs = ["pbs_manifest.bzl"], diff --git a/python/private/normalize_name.bzl b/python/private/normalize_name.bzl index 7898222e41..7d3886f9ca 100644 --- a/python/private/normalize_name.bzl +++ b/python/private/normalize_name.bzl @@ -38,6 +38,8 @@ Also see Python spec on normalizing package names: https://packaging.python.org/en/latest/specifications/name-normalization/ """ +load("@pypackaging.bzl", "pypackaging") + def normalize_name(name): """normalize a PyPI package name and return a valid bazel label. @@ -47,14 +49,4 @@ def normalize_name(name): Returns: a normalized name as a string. """ - name = name.replace("-", "_").replace(".", "_").lower() - if "__" not in name: - return name - - # Handle the edge-case where there are consecutive `-`, `_` or `.` characters, - # which is a valid Python package name. - return "_".join([ - part - for part in name.split("_") - if part - ]) + return pypackaging.utils.canonicalize_name(name).replace("-", "_") From d3c8627a2711afd6c7d4005b78b10c52da65f5c1 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:48:58 +0900 Subject: [PATCH 04/24] build: add pypackaging.bzl 0.3.0 as a dependency We have been maintaining our own Starlark implementations of PEP 440 versions and PEP 508 requirements and environment markers. `pypackaging.bzl` is a Starlark port of `packaging` that is tested against the upstream test-suite, so add it as a dependency in order to start using it instead. `WORKSPACE` users get the new dependency from `py_repositories`. Our own `WORKSPACE` file now calls it before the internal setup, which loads the repository rules that are going to use the new dependency. --- BUILD.bazel | 3 ++- MODULE.bazel | 1 + WORKSPACE | 9 ++++++--- downloader_config.cfg | 2 ++ gazelle/downloader_config.cfg | 2 ++ python/private/py_repositories.bzl | 6 ++++++ sphinxdocs/downloader_config.cfg | 2 ++ 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 6fc1b87763..5bc3acc23c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -23,7 +23,8 @@ # gazelle:resolve starlark @bazel_tools//tools/build_defs/repo:http.bzl //python/private:bazel_tools # gazelle:resolve starlark @bazel_tools//tools/build_defs/repo:utils.bzl //python/private:bazel_tools -# Prevent Gazelle from incorrectly stripping the .bzl suffix from the toml.bzl repo name +# Prevent Gazelle from incorrectly stripping the .bzl suffix from the repo names +# gazelle:resolve starlark @pypackaging.bzl//:pypackaging.bzl @pypackaging.bzl//:pypackaging # gazelle:resolve starlark @toml.bzl//:toml.bzl @toml.bzl//:toml # Override Gazelle's incorrect default resolution for platforms host constraints Starlark library diff --git a/MODULE.bazel b/MODULE.bazel index 4b69b54aed..1d858fc36a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,6 +8,7 @@ bazel_dep(name = "bazel_features", version = "1.55.0") bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "package_metadata", version = "0.0.7") bazel_dep(name = "platforms", version = "0.0.11") +bazel_dep(name = "pypackaging.bzl", version = "0.3.0") bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "toml.bzl", version = "0.4.1") diff --git a/WORKSPACE b/WORKSPACE index 631b94118d..f282982d82 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -61,14 +61,17 @@ load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_i stardoc_pinned_maven_install() +load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") + +# This needs to be called before the internal setup, because the repository +# rules that it loads use the dependencies defined here. +py_repositories() + load("//:internal_dev_setup.bzl", "rules_python_internal_setup") rules_python_internal_setup() load("@pythons_hub//:versions.bzl", "PYTHON_VERSIONS") -load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") - -py_repositories() python_register_multi_toolchains( name = "python", diff --git a/downloader_config.cfg b/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/downloader_config.cfg +++ b/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end diff --git a/gazelle/downloader_config.cfg b/gazelle/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/gazelle/downloader_config.cfg +++ b/gazelle/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 3489613a6c..09923dafa2 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -78,6 +78,12 @@ def py_repositories(transition_settings = []): strip_prefix = "toml.bzl-0.4.0", url = "https://github.com/jvolkman/toml.bzl/releases/download/v0.4.0/toml.bzl-v0.4.0.tar.gz", ) + http_archive( + name = "pypackaging.bzl", + sha256 = "09570564367dfbff313950528376c9ba9ded9025cacb2c731545db19bc27e1e9", + strip_prefix = "pypackaging.bzl-0.3.0", + url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.3.0/pypackaging.bzl-v0.3.0.tar.gz", + ) http_archive( name = "package_metadata", sha256 = "8f27dc7393e3f3bdc793bdc4ba36d67a63c22cc9d38cc65d3204654974ea4563", diff --git a/sphinxdocs/downloader_config.cfg b/sphinxdocs/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/sphinxdocs/downloader_config.cfg +++ b/sphinxdocs/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end From 2a57aebc7dbec5c50fe9136baf78b85dc1fdabec Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:31:39 +0900 Subject: [PATCH 05/24] refactor(pypi): parse the requirements with pypackaging.bzl Use `pypackaging.requirements.parse` instead of the hand written partitioning of the requirement lines. The extras are now sorted and the unused `version` field is dropped. `name==version @ url` lines are not valid as per PEP 508, but they are still accepted because they are used in the requirements files. Whilst at it, parse each requirement line once instead of once per platform. --- news/pypackaging-bzl.changed.md | 5 +++ python/private/pypi/BUILD.bazel | 2 +- python/private/pypi/parse_requirements.bzl | 8 +++- python/private/pypi/pep508_requirement.bzl | 50 +++++++++------------- tests/pypi/pep508/requirement_tests.bzl | 29 +++++++------ 5 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 news/pypackaging-bzl.changed.md diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md new file mode 100644 index 0000000000..b233f37b2d --- /dev/null +++ b/news/pypackaging-bzl.changed.md @@ -0,0 +1,5 @@ +(pypi) The requirements are now parsed by +[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl), which is a +Starlark port of [`packaging`](https://github.com/pypa/packaging). This means +that invalid input, which was silently accepted before, is now an error. +`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 1754c1787a..835bf4f1f4 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -311,7 +311,7 @@ bzl_library( bzl_library( name = "pep508_requirement", srcs = ["pep508_requirement.bzl"], - deps = ["//python/private:normalize_name"], + deps = ["@pypackaging.bzl//:pypackaging"], ) bzl_library( diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 2d8c4b4774..f82d6f850e 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -511,6 +511,9 @@ def _parse_requirements_from_req_files( reqs_by_name = {} requirements_by_platform = {} + + # The same lines are used on many platforms, so parse them once. + names = {} for plat, parse_results in requirements.items(): requirements_dict = {} for entry in sorted( @@ -518,9 +521,10 @@ def _parse_requirements_from_req_files( key = lambda x: (len(x[1].partition("==")[0]), x), ): req_line = entry[1] - req = requirement(req_line) + if req_line not in names: + names[req_line] = requirement(req_line).name - requirements_dict[req.name] = entry + requirements_dict[names[req_line]] = entry extra_pip_args_for_plat = options[plat] diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index 7552642572..9c145bcbf5 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -15,44 +15,36 @@ """This module is for parsing PEP508 requires-dist and requirements lines. """ -load("//python/private:normalize_name.bzl", "normalize_name") - -_STRIP = ["(", " ", ">", "=", "<", "~", "!", "@"] +load("@pypackaging.bzl", "pypackaging") def requirement(spec): """Parse a PEP508 requirement line Args: - spec: {type}`str` requirement line that will be parsed. + spec: {type}`str` requirement line that will be parsed. The options + of a `requirements.txt` line, e.g. `--hash`, are ignored. Returns: A struct with the information. """ - spec = spec.strip() - requires, _, maybe_hashes = spec.partition(";") - - version_start = requires.find("==") - version = None - if version_start != -1: - # Extract everything after '==' until the next space or end of the string - version, _, _ = requires[version_start + 2:].partition(" ") - - # Remove any trailing characters from the version string - version = version.strip(" ") - - marker, _, _ = maybe_hashes.partition("--hash") - requires, _, extras_unparsed = requires.partition("[") - extras_unparsed, _, _ = extras_unparsed.partition("]") - for char in _STRIP: - requires, _, _ = requires.partition(char) - extras = [normalize_name(e) for e in extras_unparsed.replace(" ", "").split(",") if e] - name = requires.strip(" ") - name = normalize_name(name) + + # The options are not a part of PEP 508. + spec, _, _ = spec.partition(" --") + + head, semicolon, marker = spec.partition(";") + name, at, url = head.partition("@") + if at and "==" in name: + # PEP 508 does not allow a version for the direct URL requirements, + # but `name==version @ url` has always been accepted here, so that + # the version of the distribution is known. + name, _, _ = name.partition("==") + spec = name + at + url + semicolon + marker + + req = pypackaging.requirements.parse(spec) return struct( - name = name.replace("_", "-"), - name_ = name, - marker = marker.strip(" "), - extras = extras, - version = version, + name = req.name, + name_ = req.name.replace("-", "_"), + marker = req.marker_str or "", + extras = [e.replace("-", "_") for e in req.extras], ) diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index 2ce45922da..92cfa32caa 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -20,22 +20,25 @@ _tests = [] def _test_requirement_line_parsing(env): want = { - " name1[ foo ] ": ("name1", ["foo"], None, ""), - "Name[foo]": ("name", ["foo"], None, ""), - "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["fred", "bar"], None, "python_version=='2.7'"), - "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], None, "(os_name=='a' or os_name=='b') and os_name=='c'"), - "name@http://foo.com": ("name", [], None, ""), - "name[ Foo123 ]": ("name", ["foo123"], None, ""), - "name[extra-one,extra-two.three]==1.0": ("name", ["extra_one", "extra_two_three"], "1.0", ""), - "name[extra]@http://foo.com": ("name", ["extra"], None, ""), - "name[foo]": ("name", ["foo"], None, ""), - "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], None, "python_version<'2.7' and platform_version=='2'"), - "name_foo[bar]": ("name-foo", ["bar"], None, ""), - "name_foo[bar]==0.25": ("name-foo", ["bar"], "0.25", ""), + " name1[ foo ] ": ("name1", ["foo"], ""), + "Name[foo]": ("name", ["foo"], ""), + "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["bar", "fred"], "python_version=='2.7'"), + "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], "(os_name=='a' or os_name=='b') and os_name=='c'"), + "name@http://foo.com": ("name", [], ""), + "name[ Foo123 ]": ("name", ["foo123"], ""), + "name[extra-one,extra-two.three]==1.0": ("name", ["extra_one", "extra_two_three"], ""), + "name[extra]@http://foo.com": ("name", ["extra"], ""), + "name[foo]": ("name", ["foo"], ""), + "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], "python_version<'2.7' and platform_version=='2'"), + "name_foo==0.25 ; os_name=='a' --hash=sha256:deadbeef": ("name-foo", [], "os_name=='a'"), + "name_foo[bar]": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25 --hash=sha256:deadbeef": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25 @ http://foo.com ; os_name=='a'": ("name-foo", ["bar"], "os_name=='a'"), } got = { - i: (parsed.name, parsed.extras, parsed.version, parsed.marker) + i: (parsed.name, parsed.extras, parsed.marker) for i, parsed in {case: requirement(case) for case in want}.items() } env.expect.that_dict(got).contains_exactly(want) From d0aec1f262128de97113d39f90d72df7c46dc29b Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:32:19 +0900 Subject: [PATCH 06/24] refactor(pypi): evaluate the markers with pypackaging.bzl Use `pypackaging.markers` to parse and evaluate the environment markers instead of the hand written tokenizer and evaluator. What is left in `pep508_evaluate.bzl` is what `pypackaging.bzl` does not have: the partial evaluation and the `platform_machine` aliases. The aliases are now applied by the evaluator, so the `_aliases` key is no longer needed in the env. The behaviour changes that come from following `packaging`: - Invalid markers are now errors. - `platform_version` is compared as a string and not as a version. - `==` no longer ignores the local version segment and the ordered comparisons with a local version are `False`. - The non-standard `not` operator and the empty parentheses are no longer accepted. - A partially evaluated marker that is satisfied is `True` instead of an empty string. --- news/pypackaging-bzl.changed.md | 9 +- python/private/pypi/BUILD.bazel | 11 +- python/private/pypi/env_marker_setting.bzl | 7 +- python/private/pypi/flags.bzl | 3 +- python/private/pypi/pep508_deps.bzl | 7 +- python/private/pypi/pep508_env.bzl | 23 +- python/private/pypi/pep508_evaluate.bzl | 554 ++++----------------- tests/pypi/pep508/env_tests.bzl | 3 - tests/pypi/pep508/evaluate_tests.bzl | 76 +-- 9 files changed, 136 insertions(+), 557 deletions(-) diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md index b233f37b2d..07e85f76eb 100644 --- a/news/pypackaging-bzl.changed.md +++ b/news/pypackaging-bzl.changed.md @@ -1,5 +1,8 @@ -(pypi) The requirements are now parsed by +(pypi) The requirements and the environment markers are now handled by [`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl), which is a Starlark port of [`packaging`](https://github.com/pypa/packaging). This means -that invalid input, which was silently accepted before, is now an error. -`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. +that invalid input, which was silently accepted before, is now an error and +that the environment markers are evaluated like `packaging` does it: +`platform_version` is compared as a string, the local version segments are +not ignored in `==` comparisons and the non-standard `not` operator is no +longer accepted. `WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index 835bf4f1f4..b5730b000f 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -283,7 +283,6 @@ bzl_library( name = "pep508_deps", srcs = ["pep508_deps.bzl"], deps = [ - ":pep508_env", ":pep508_evaluate", ":pep508_requirement", "//python/private:normalize_name", @@ -293,19 +292,13 @@ bzl_library( bzl_library( name = "pep508_env", srcs = ["pep508_env.bzl"], - deps = [ - "//python/private:normalize_name", - "//python/private:version", - ], + deps = ["//python/private:version"], ) bzl_library( name = "pep508_evaluate", srcs = ["pep508_evaluate.bzl"], - deps = [ - "//python/private:enum", - "//python/private:version", - ], + deps = ["@pypackaging.bzl//:pypackaging"], ) bzl_library( diff --git a/python/private/pypi/env_marker_setting.bzl b/python/private/pypi/env_marker_setting.bzl index 71c6b410ed..15c0ac6ab6 100644 --- a/python/private/pypi/env_marker_setting.bzl +++ b/python/private/pypi/env_marker_setting.bzl @@ -4,7 +4,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") load("//python/private:common_labels.bzl", "labels") load("//python/private:toolchain_types.bzl", "TARGET_TOOLCHAIN_TYPE") load(":env_marker_info.bzl", "EnvMarkerInfo") -load(":pep508_env.bzl", "create_env", "set_missing_env_defaults") +load(":pep508_env.bzl", "set_missing_env_defaults") load(":pep508_evaluate.bzl", "evaluate") # Use capitals to hint its not an actual boolean type. @@ -38,10 +38,7 @@ def env_marker_setting(*, name, expression, **kwargs): ) def _env_marker_setting_impl(ctx): - env = create_env() - env.update( - ctx.attr._env_marker_config_flag[EnvMarkerInfo].env, - ) + env = dict(ctx.attr._env_marker_config_flag[EnvMarkerInfo].env) runtime = ctx.toolchains[TARGET_TOOLCHAIN_TYPE].py3_runtime diff --git a/python/private/pypi/flags.bzl b/python/private/pypi/flags.bzl index 36cb5373ff..6836209871 100644 --- a/python/private/pypi/flags.bzl +++ b/python/private/pypi/flags.bzl @@ -23,7 +23,6 @@ load("//python/private:common_labels.bzl", "labels") load(":env_marker_info.bzl", "EnvMarkerInfo") load( ":pep508_env.bzl", - "create_env", "os_name_select_map", "platform_machine_select_map", "platform_system_select_map", @@ -54,7 +53,7 @@ def _default_env_marker_config(**kwargs): ) def _env_marker_config_impl(ctx): - env = create_env() + env = {} env["os_name"] = ctx.attr.os_name env["sys_platform"] = ctx.attr.sys_platform env["platform_machine"] = ctx.attr.platform_machine diff --git a/python/private/pypi/pep508_deps.bzl b/python/private/pypi/pep508_deps.bzl index e36ceadbd5..7286dd758b 100644 --- a/python/private/pypi/pep508_deps.bzl +++ b/python/private/pypi/pep508_deps.bzl @@ -16,7 +16,6 @@ """ load("//python/private:normalize_name.bzl", "normalize_name") -load(":pep508_env.bzl", "create_env") load(":pep508_evaluate.bzl", "evaluate") load(":pep508_requirement.bzl", "requirement") @@ -168,9 +167,8 @@ def _resolve_extras(self_name, reqs, extras): return sorted(extras) def _evaluate_any(req, extras): - env = create_env() for extra in extras: - if evaluate(req.marker, env = env | {"extra": extra}): + if evaluate(req.marker, env = {"extra": extra}): return True return False @@ -181,12 +179,11 @@ def _add_reqs(deps, deps_select, dep, reqs, *, extras): _add(deps, deps_select, dep) return - env = create_env() markers = {} found_unconditional = False for req in reqs: for x in extras: - m = evaluate(req.marker, env = env | {"extra": x}, strict = False) + m = evaluate(req.marker, env = {"extra": x}, strict = False) if m == False: continue elif m == True: diff --git a/python/private/pypi/pep508_env.bzl b/python/private/pypi/pep508_env.bzl index 9fe9dcaada..95a9679300 100644 --- a/python/private/pypi/pep508_env.bzl +++ b/python/private/pypi/pep508_env.bzl @@ -15,7 +15,6 @@ """This module is for implementing PEP508 environment definition. """ -load("//python/private:normalize_name.bzl", "normalize_name") load("//python/private:version.bzl", "version") _DEFAULT = "//conditions:default" @@ -31,15 +30,6 @@ _os_aliases = { } # See https://stackoverflow.com/a/45125525 -platform_machine_aliases = { - # These pairs mean the same hardware, but different values may be used - # on different host platforms. - "amd64": "x86_64", - "arm64": "aarch64", - "i386": "x86_32", - "i686": "x86_32", -} - # NOTE: There are many cpus, and unfortunately, the value isn't directly # accessible to Starlark. Using CcToolchain.cpu might work, though. # Some targets are aliases and are omitted below as their value is implied @@ -184,8 +174,7 @@ def env(*, env = None, os, arch, python_version = "", extra = None): Returns: A dict that can be used as `env` in the marker evaluation. """ - env = env or {} - env = env | create_env() + env = dict(env or {}) if extra != None: env["extra"] = extra @@ -214,16 +203,6 @@ def env(*, env = None, os, arch, python_version = "", extra = None): return env -def create_env(): - return { - # Per-variable normalization functions. Each entry maps a marker - # variable name to a function (value) -> normalized_value. - "_aliases": { - "extra": normalize_name, - "platform_machine": lambda x: platform_machine_aliases.get(x, x), - }, - } - def set_missing_env_defaults(env): """Sets defaults based on existing values. diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index 61e461a54f..c0cbbed725 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -12,490 +12,150 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This module is for implementing PEP508 in starlark as FeatureFlagInfo -""" +"""Evaluate the PEP 508 environment markers. -load("//python/private:enum.bzl", "enum") -load("//python/private:version.bzl", "version") +The parsing and the evaluation is done by `pypackaging.bzl`, this module adds +what `rules_python` needs on top of it: -# The expression parsing and resolution for the PEP508 is below -# +* The `platform_machine` aliases, so that e.g. `arm64` and `aarch64` mean the + same thing. +* The partial evaluation, which is used to evaluate what is known when the + repositories are created (e.g. the `extra`) and to leave the rest for the + analysis phase. +""" + +load("@pypackaging.bzl", "pypackaging") -_STATE = enum( - STRING = "string", - VAR = "var", - OP = "op", - NONE = "none", -) -_BRACKETS = "()" -_OPCHARS = "<>!=~" -_QUOTES = "'\"" -_WSP = " \t" -_NON_VERSION_VAR_NAMES = [ - "implementation_name", - "os_name", - "platform_machine", - "platform_python_implementation", - "platform_release", - "platform_system", - "sys_platform", - "extra", -] _AND = "and" _OR = "or" -_NOT = "not" -_ENV_ALIASES = "_aliases" - -def tokenize(marker): - """Tokenize the input string. - - The output will have double-quoted values (i.e. the quoting will be normalized) and all of the whitespace will be trimmed. - - Args: - marker: {type}`str` The input to tokenize. - - Returns: - The {type}`str` that is the list of recognized tokens that should be parsed. - """ - if not marker: - return [] - - tokens = [] - token = "" - state = _STATE.NONE - char = "" - - # Due to the `continue` in the loop, we will be processing chars at a slower pace - for _ in range(2 * len(marker)): - if token and (state == _STATE.NONE or not marker): - if tokens and token == "in" and tokens[-1] == _NOT: - tokens[-1] += " " + token - else: - tokens.append(token) - token = "" - - if not marker: - return tokens - - char = marker[0] - if char in _BRACKETS: - state = _STATE.NONE - token = char - elif state == _STATE.STRING and char in _QUOTES: - state = _STATE.NONE - token = '"{}"'.format(token) - elif ( - (state == _STATE.VAR and not char.isalnum() and char != "_") or - (state == _STATE.OP and char not in _OPCHARS) - ): - state = _STATE.NONE - continue # Skip consuming the char below - elif state == _STATE.NONE: - # Transition from _STATE.NONE to something or stay in NONE - if char in _QUOTES: - state = _STATE.STRING - elif char.isalnum(): - state = _STATE.VAR - token += char - elif char in _OPCHARS: - state = _STATE.OP - token += char - elif char in _WSP: - state = _STATE.NONE - else: - fail("BUG: Cannot parse '{}' in {} ({})".format(char, state, marker)) - else: - token += char - # Consume the char - marker = marker[1:] - - return fail("BUG: failed to process the marker in allocated cycles: {}".format(marker)) +_PLATFORM_MACHINE_ALIASES = { + # These pairs mean the same hardware, but different values may be used + # on different host platforms. + "amd64": "x86_64", + "arm64": "aarch64", + "i386": "x86_32", + "i686": "x86_32", +} -def evaluate(marker, *, env, strict = True, **kwargs): +def evaluate(marker, *, env, strict = True): """Evaluate the marker against a given env. Args: marker: {type}`str` The string marker to evaluate. env: {type}`dict[str, str]` The environment to evaluate the marker against. strict: {type}`bool` A setting to not fail on missing values in the env. - **kwargs: Extra kwargs to be passed to the expression evaluator. Returns: The {type}`bool | str` If the marker is compatible with the given env. If strict is - `False`, then the output type is `str` which will represent the remaining - expression that has not been evaluated. - """ - tokens = tokenize(marker) - - ast = _new_expr(marker = marker, **kwargs) - for _ in range(len(tokens) * 2): - if not tokens: - break - - tokens = ast.parse(env = env, tokens = tokens, strict = strict) - - if not tokens: - return ast.value() - - fail("Could not evaluate: {}".format(marker)) - -_STRING_REPLACEMENTS = { - "!=": "neq", - "(": "_", - ")": "_", - "<": "lt", - "<=": "lteq", - "==": "eq", - "===": "eeq", - ">": "gt", - ">=": "gteq", - "not in": "not_in", - "~==": "cmp", -} - -def to_string(marker): - return "_".join([ - _STRING_REPLACEMENTS.get(t, t) - for t in tokenize(marker) - ]).replace("\"", "") - -def _and_fn(x, y): - """Our custom `and` evaluation function. - - Allow partial evaluation if one of the values is a string, return the - string value because that means that `marker_expr` was set to - `strict = False` and we are only evaluating what we can. - """ - if not (x and y): - return False - - x_is_str = type(x) == type("") - y_is_str = type(y) == type("") - if x_is_str and y_is_str: - return "{} and {}".format(x, y) - elif x_is_str: - return x - else: - return y - -def _or_fn(x, y): - """Our custom `or` evaluation function. - - Allow partial evaluation if one of the values is a string, return the - string value because that means that `marker_expr` was set to - `strict = False` and we are only evaluating what we can. - """ - x_is_str = type(x) == type("") - y_is_str = type(y) == type("") - - if x_is_str and y_is_str: - return "{} or {}".format(x, y) if x and y else "" - elif x_is_str: - return "" if y else x - elif y_is_str: - return "" if x else y - else: - return x or y - -def _not_fn(x): - """Our custom `not` evaluation function. - - Allow partial evaluation if the value is a string. + `False`, then the output type is `str` if a part of the marker could + not be evaluated and it will represent the remaining expression. """ - if type(x) == type(""): - return "not {}".format(x) - else: - return not x - -def _new_expr( - *, - marker, - and_fn = _and_fn, - or_fn = _or_fn, - not_fn = _not_fn): - # buildifier: disable=uninitialized - self = struct( - marker = marker, - tree = [], - parse = lambda **kwargs: _parse(self, **kwargs), - value = lambda: _value(self), - # This is a way for us to have a handle to the currently constructed - # expression tree branch. - current = lambda: self._current[-1] if self._current else None, - _current = [], - _and = and_fn, - _or = or_fn, - _not = not_fn, - ) - return self - -def _parse(self, *, env, tokens, strict = False): - """The parse function takes the consumed tokens and returns the remaining.""" - token, remaining = tokens[0], tokens[1:] - - if token == "(": - expr = _open_parenthesis(self) - elif token == ")": - expr = _close_parenthesis(self) - elif token == _AND: - expr = _and_expr(self) - elif token == _OR: - expr = _or_expr(self) - elif token == _NOT: - expr = _not_expr(self) - else: - expr = marker_expr(env = env, strict = strict, *tokens[:3]) - remaining = tokens[3:] - - _append(self, expr) - return remaining - -def _value(self): - """Evaluate the expression tree""" - if not self.tree: - # Basic case where no marker should evaluate to True - return True - - for _ in range(len(self.tree)): - if len(self.tree) == 1: - return self.tree[0] - - # Resolve all of the `or` expressions as it is safe to do now since all - # `and` and `not` expressions have been taken care of by now. - if getattr(self.tree[-2], "op", None) == _OR: - current = self.tree.pop() - self.tree[-1] = self.tree[-1].value(current) + tree = pypackaging.markers.parse(marker) + + # Each frame is the list that is being reduced, the index of the next + # item in it and the values of the items that have been reduced so far. + stack = [(tree, 0, [])] + + # Each step advances an index or pops a frame, so this always terminates. + for _ in range(2 * len(marker) + 2): + items, i, values = stack[-1] + + if i >= len(items): + value = _reduce(values) + stack.pop() + if not stack: + if type(value) == "bool": + return value + return pypackaging.markers.to_string([value]) + + stack[-1][2].append(value) + continue + + item = items[i] + stack[-1] = (items, i + 1, values) + + if type(item) == "list": + stack.append((item, 0, [])) + elif type(item) == "tuple": + values.append(_evaluate_item(item, env = env, strict = strict)) else: - break + values.append(item) - fail("BUG: invalid state: {}".format(self.tree)) + return fail("BUG: failed to evaluate the marker: {}".format(marker)) -def marker_expr(left, op, right, *, env, strict = True): - """Evaluate a marker expression - - Args: - left: {type}`str` the env identifier or a value quoted in `"`. - op: {type}`str` the operation to carry out. - right: {type}`str` the env identifier or a value quoted in `"`. - strict: {type}`bool` if false, only evaluates the values that are present - in the environment, otherwise returns the original expression. - env: {type}`dict[str, str]` the `env` to substitute `env` identifiers in - the ` ` expression. Note, if `env` has a key - "_aliases", then we will do normalization so that we can ensure - that e.g. `aarch64` evaluation in the `platform_machine` works the - same way irrespective if the marker uses `arm64` or `aarch64` value - in the expression. +def _evaluate_item(item, *, env, strict): + """Evaluate a single ` ` expression. Returns: - {type}`bool` if the expression evaluation result or {type}`str` if the expression - could not be evaluated. + {type}`bool` or the item itself if it uses a variable that is not in + the env and `strict` is `False`. """ - var_name = None - if right not in env and left not in env and not strict: - return "{} {} {}".format(left, op, right) - if left[0] == '"': - var_name = right - right = env[right] - left = left.strip("\"") - - if _ENV_ALIASES in env: - # Normalize the literal value using per-variable normalization - # functions. This handles platform aliases (e.g. arm64 -> aarch64) - # and PEP 685 extra name normalization (e.g. db-backend -> db_backend). - left = env.get(_ENV_ALIASES, {}).get(var_name, lambda x: x)(left) - - else: - var_name = left - left = env[left] - right = right.strip("\"") - - if _ENV_ALIASES in env: - # See the note above on normalization - right = env.get(_ENV_ALIASES, {}).get(var_name, lambda x: x)(right) - - if var_name in _NON_VERSION_VAR_NAMES: - return _env_expr(left, op, right) - elif var_name.endswith("_version"): - return _version_expr(left, op, right) - else: - # Do not fail here, just evaluate the expression to False. - return False - -def _env_expr(left, op, right): - """Evaluate a string comparison expression""" - if op == "==": - return left == right - elif op == "!=": - return left != right - elif op == "in": - return left in right - elif op == "not in": - return left not in right - elif op == "<": - return left < right - elif op == "<=": - return left <= right - elif op == ">": - return left > right - elif op == ">=": - return left >= right - else: - return fail("unsupported op: '{}' {} '{}'".format(left, op, right)) - -def _version_expr(left, op, right): - """Evaluate a version comparison expression""" - _left = version.parse(left) - _right = version.parse(right) - if _left == None or _right == None: - # Per spec, if either can't be normalized to a version, then - # fallback to simple string comparison. Usually this is `platform_version` - # or `platform_release`, which vary depending on platform. - return _env_expr(left, op, right) - - if op == "===": - return version.is_eeq(_left, _right) - elif op == "!=": - return version.is_ne(_left, _right) - elif op == "==": - return version.is_eq(_left, _right) - elif op == "<": - return version.is_lt(_left, _right) - elif op == ">": - return version.is_gt(_left, _right) - elif op == "<=": - return version.is_le(_left, _right) - elif op == ">=": - return version.is_ge(_left, _right) - elif op == "~=": - return version.is_compatible(_left, _right) - else: - return False # Let's just ignore the invalid ops - -# Code to allowing to combine expressions with logical operators - -def _append(self, value): - if value == None: - return - - current = self.current() or self - op = getattr(value, "op", None) - - if op == _NOT: - current.tree.append(value) - elif op in [_AND, _OR]: - value.append(current.tree[-1]) - current.tree[-1] = value - elif not current.tree: - current.tree.append(value) - elif hasattr(current.tree[-1], "append"): - current.tree[-1].append(value) - elif hasattr(current.tree, "_append"): - current.tree._append(value) - else: - fail("Cannot evaluate '{}' in '{}', current: {}".format(value, self.marker, current)) - -def _open_parenthesis(self): - """Add an extra node into the tree to perform evaluate inside parenthesis.""" - self._current.append(_new_expr( - marker = self.marker, - and_fn = self._and, - or_fn = self._or, - not_fn = self._not, - )) - -def _close_parenthesis(self): - """Backtrack and evaluate the expression within parenthesis.""" - value = self._current.pop().value() - if type(value) == type(""): - return "({})".format(value) - else: - return value - -def _not_expr(self): - """Add an extra node into the tree to perform an 'not' operation.""" - - def _append(value): - """Append a value to the not expression node. - - This codifies `not` precedence over `and` and performs backtracking to - evaluate any `not` statements and forward the value to the first `and` - statement if needed. - """ + lhs, op, rhs = item - current = self.current() or self - current.tree[-1] = self._not(value) + if not strict: + for side in (lhs, rhs): + if side.type == "variable" and side.value not in env: + return item - for _ in range(len(current.tree)): - if not len(current.tree) > 1: - break + if lhs.type == "variable" and lhs.value == "platform_machine": + rhs = _platform_machine(rhs) + elif rhs.type == "variable" and rhs.value == "platform_machine": + lhs = _platform_machine(lhs) - op = getattr(current.tree[-2], "op", None) - if op == None: - pass - elif op == _NOT: - value = current.tree.pop() - current.tree[-1] = self._not(value) - continue - elif op == _AND: - value = current.tree.pop() - current.tree[-1].append(value) - elif op != _OR: - fail("BUG: '{} not' compound is unsupported".format(current.tree[-1])) + return pypackaging.markers.evaluate([(lhs, op, rhs)], env) - break +def _platform_machine(value): + if value.type != "string": + return value return struct( - op = _NOT, - append = _append, + type = value.type, + value = _PLATFORM_MACHINE_ALIASES.get(value.value, value.value), ) -def _and_expr(self): - """Add an extra node into the tree to perform an 'and' operation""" - maybe_value = [None] +def _reduce(values): + """Reduce the values of a single (parenthesized) expression. - def _append(value): - """Append a value to the and expression node. + Args: + values: {type}`list` the values separated by the `and` and `or` + operators. A value is a {type}`bool`, an expression that could + not be evaluated or a list of such for a parenthesized expression. - Here we backtrack, but we only evaluate the current `and` statement - - all of the `not` statements will be by now evaluated and `or` - statements need to be evaluated later. - """ - if maybe_value[0] == None: - maybe_value[0] = value - return + Returns: + {type}`bool` or a list for what could not be evaluated. + """ - current = self.current() or self - current.tree[-1] = self._and(maybe_value[0], value) + # `and` binds tighter than `or`, so do the `and` groups first + groups = [[]] + for value in values: + if value == _OR: + groups.append([]) + elif value != _AND: + groups[-1].append(value) - return struct( - op = _AND, - append = _append, - # private fields that help debugging - _maybe_value = maybe_value, - ) + remaining = [] + for group in groups: + if False in group: + continue -def _or_expr(self): - """Add an extra node into the tree to perform an 'or' operation""" - maybe_value = [None] + group = [v for v in group if v != True] + if not group: + return True - def _append(value): - """Append a value to the or expression node. + if remaining: + remaining.append(_OR) - Here we just append the extra values to the tree and the `or` - statements will be evaluated in the _value() function. - """ - if maybe_value[0] == None: - maybe_value[0] = value - return + for i, value in enumerate(group): + if i: + remaining.append(_AND) + remaining.append(value) - current = self.current() or self - current.tree.append(value) + if not remaining: + return False - return struct( - op = _OR, - value = lambda x: self._or(maybe_value[0], x), - append = _append, - # private fields that help debugging - _maybe_value = maybe_value, - ) + if len(remaining) == 1: + # No need to keep the parentheses. + return remaining[0] + + return remaining diff --git a/tests/pypi/pep508/env_tests.bzl b/tests/pypi/pep508/env_tests.bzl index cfd94a1b01..97524c47f2 100644 --- a/tests/pypi/pep508/env_tests.bzl +++ b/tests/pypi/pep508/env_tests.bzl @@ -7,7 +7,6 @@ _tests = [] def _test_env_defaults(env): got = pep508_env(os = "exotic", arch = "exotic", python_version = "3.1.1") - got.pop("_aliases") env.expect.that_dict(got).contains_exactly({ "implementation_name": "cpython", "implementation_version": "3.1.1", @@ -26,7 +25,6 @@ _tests.append(_test_env_defaults) def _test_env_freebsd(env): got = pep508_env(os = "freebsd", arch = "arm64", python_version = "3.1.1") - got.pop("_aliases") env.expect.that_dict(got).contains_exactly({ "implementation_name": "cpython", "implementation_version": "3.1.1", @@ -45,7 +43,6 @@ _tests.append(_test_env_freebsd) def _test_env_macos(env): got = pep508_env(os = "macos", arch = "arm64", python_version = "3.1.1") - got.pop("_aliases") env.expect.that_dict(got).contains_exactly({ "implementation_name": "cpython", "implementation_version": "3.1.1", diff --git a/tests/pypi/pep508/evaluate_tests.bzl b/tests/pypi/pep508/evaluate_tests.bzl index 7c7b5d8173..89da5f8cd8 100644 --- a/tests/pypi/pep508/evaluate_tests.bzl +++ b/tests/pypi/pep508/evaluate_tests.bzl @@ -15,7 +15,7 @@ load("@rules_testing//lib:test_suite.bzl", "test_suite") load("//python/private/pypi:pep508_env.bzl", pep508_env = "env") # buildifier: disable=bzl-visibility -load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "tokenize") # buildifier: disable=bzl-visibility +load("//python/private/pypi:pep508_evaluate.bzl", "evaluate") # buildifier: disable=bzl-visibility _tests = [] @@ -25,39 +25,6 @@ def _check_evaluate(env, expr, expected, values, strict = True): values = values, ).that_bool(evaluate(expr, env = values, strict = strict)).equals(expected) -def _tokenize_tests(env): - for input, want in { - "": [], - "'osx' == os_name": ['"osx"', "==", "os_name"], - "'x' not in os_name": ['"x"', "not in", "os_name"], - "()": ["(", ")"], - "(os_name == 'osx' and not os_name == 'posix') or os_name == \"win\"": [ - "(", - "os_name", - "==", - '"osx"', - "and", - "not", - "os_name", - "==", - '"posix"', - ")", - "or", - "os_name", - "==", - '"win"', - ], - "os_name\t==\t'osx'": ["os_name", "==", '"osx"'], - "os_name == 'osx'": ["os_name", "==", '"osx"'], - "python_version <= \"1.0\"": ["python_version", "<=", '"1.0"'], - "python_version>='1.0.0'": ["python_version", ">=", '"1.0.0"'], - "python_version~='1.0.0'": ["python_version", "~=", '"1.0.0"'], - }.items(): - got = tokenize(input) - env.expect.that_collection(got).contains_exactly(want).in_order() - -_tests.append(_tokenize_tests) - def _evaluate_non_version_env_tests(env): for var_name in [ "implementation_name", @@ -100,7 +67,7 @@ def _evaluate_version_env_tests(env): for var_name in [ "python_version", "implementation_version", - "platform_version", + "platform_release", "python_full_version", ]: # Given @@ -124,7 +91,7 @@ def _evaluate_version_env_tests(env): "{} ~= '3.8.0'".format(var_name): False, "{} === '3.7.9+rc2'".format(var_name): False, "{} === '3.7.9'".format(var_name): True, - "{} == '3.7.9+rc2'".format(var_name): True, + "{} == '3.7.9+rc2'".format(var_name): False, }.items(): # buildifier: @unsorted-dict-items _check_evaluate(env, input, want, marker_env) @@ -156,28 +123,19 @@ def _logical_expression_tests(env): for input, want in { # Basic "": True, - "(())": True, - "()": True, # expr "os_name == 'fo'": False, "(os_name == 'fo')": False, "((os_name == 'fo'))": False, "((os_name == 'foo'))": True, - "not (os_name == 'fo')": True, # and "os_name == 'fo' and os_name == 'foo'": False, - # and not - "os_name == 'fo' and not os_name == 'foo'": False, - # or "os_name == 'oo' or os_name == 'foo'": True, - # or not - "os_name == 'foo' or not os_name == 'foo'": True, - # multiple or "os_name == 'oo' or os_name == 'fo' or os_name == 'foo'": True, "os_name == 'oo' or os_name == 'foo' or os_name == 'fo'": True, @@ -185,30 +143,25 @@ def _logical_expression_tests(env): # multiple and "os_name == 'foo' and os_name == 'foo' and os_name == 'fo'": False, - # x or not y and z != (x or not y), but is instead evaluated as x or (not y and z) - "os_name == 'foo' or not os_name == 'fo' and os_name == 'fo'": True, - # x or y and z != (x or y) and z, but is instead evaluated as x or (y and z) "os_name == 'foo' or os_name == 'fo' and os_name == 'fo'": True, - "not (os_name == 'foo' or os_name == 'fo' and os_name == 'fo')": False, + "(os_name == 'foo' or os_name == 'fo') and os_name == 'fo'": False, # x or y and z and w != (x or y and z) and w, but is instead evaluated as x or (y and z and w) "os_name == 'foo' or os_name == 'fo' and os_name == 'fo' and os_name == 'fo'": True, - - # not not True - "not not os_name == 'foo'": True, - "not not not os_name == 'foo'": False, }.items(): # buildifier: @unsorted-dict-items _check_evaluate(env, input, want, {"os_name": "foo"}) - if not input.strip("()"): - # These cases will just return True, because they will be evaluated - # and the brackets will be processed. + if not input: continue # Check that the non-strict eval gives us back the input when no env # is supplied. - _check_evaluate(env, input, input.replace("'", '"'), {}, strict = False) + want = input.replace("'", '"') + if " and " not in want and " or " not in want: + # The redundant parentheses are dropped + want = want.strip("()") + _check_evaluate(env, input, want, {}, strict = False) _tests.append(_logical_expression_tests) @@ -223,11 +176,11 @@ def _evaluate_partial_only_extra(env): "platform_system == 'aarch64' and os_name == 'osx' and extra == 'foo'": "platform_system == \"aarch64\" and os_name == \"osx\"", "platform_system == 'aarch64' and extra == 'foo' and os_name == 'osx'": "platform_system == \"aarch64\" and os_name == \"osx\"", "os_name == 'osx' or extra == 'bar'": "os_name == \"osx\"", - "os_name == 'osx' or extra == 'foo'": "", + "os_name == 'osx' or extra == 'foo'": True, "extra == 'bar' or os_name == 'osx'": "os_name == \"osx\"", - "extra == 'foo' or os_name == 'osx'": "", + "extra == 'foo' or os_name == 'osx'": True, "os_name == 'win' or extra == 'bar' or os_name == 'osx'": "os_name == \"win\" or os_name == \"osx\"", - "os_name == 'win' or extra == 'foo' or os_name == 'osx'": "", + "os_name == 'win' or extra == 'foo' or os_name == 'osx'": True, }.items(): # buildifier: @unsorted-dict-items got = evaluate( input, @@ -294,8 +247,9 @@ _MISC_EXPRESSIONS = [ _expr_case('python_version > "1.7.post2"', True, {"python_version": "1.7.1"}), _expr_case('python_version > "1.7.post2"', True, {"python_version": "1.7.post3"}), _expr_case('python_version > "1.7.post2"', False, {"python_version": "1.7.0"}), + # The local versions cannot be used with the ordered comparisons _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.1"}), - _expr_case('python_version > "1.7.1+local"', True, {"python_version": "1.7.2"}), + _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.2"}), # Extra cases for the '<' operator _expr_case('python_version < "1.7.1"', False, {"python_version": "1.7.2"}), _expr_case('python_version < "1.7.3"', True, {"python_version": "1.7.2"}), From 9020c926635e403b77e67789d279f99372dca20b Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:28:02 +0900 Subject: [PATCH 07/24] tests: update the lockfile of the bzlmod_lockfile integration test --- tests/integration/bzlmod_lockfile/MODULE.bazel.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock index 5fd682aaf8..b4eb5015d6 100644 --- a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock +++ b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock @@ -92,6 +92,8 @@ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/MODULE.bazel": "30595bbd1169866ae6adbf4c91ab5fb40420dae63311c6e76695c1ddc8d0aec5", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/source.json": "e84b643d154160c405139d59d92577e8864150620532397cf9eb6ee59165c534", "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", From 356cceb6df600166168a6988e5cf66675f8c7e4e Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 10:41:05 +0900 Subject: [PATCH 08/24] revert: keep normalize_name free of pypackaging.bzl It is loaded by the files that Bazel 8 autoloads, which cannot load from the pypackaging.bzl repository. --- python/private/BUILD.bazel | 11 +++++------ python/private/normalize_name.bzl | 14 +++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 9d30e138e7..7ee5ca44d1 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -966,12 +966,6 @@ bzl_library( ], ) -bzl_library( - name = "normalize_name", - srcs = ["normalize_name.bzl"], - deps = ["@pypackaging.bzl//:pypackaging"], -) - bzl_library( name = "artifacts_manifest", srcs = ["artifacts_manifest.bzl"], @@ -1007,6 +1001,11 @@ bzl_library( srcs = ["full_version.bzl"], ) +bzl_library( + name = "normalize_name", + srcs = ["normalize_name.bzl"], +) + bzl_library( name = "pbs_manifest", srcs = ["pbs_manifest.bzl"], diff --git a/python/private/normalize_name.bzl b/python/private/normalize_name.bzl index 7d3886f9ca..7898222e41 100644 --- a/python/private/normalize_name.bzl +++ b/python/private/normalize_name.bzl @@ -38,8 +38,6 @@ Also see Python spec on normalizing package names: https://packaging.python.org/en/latest/specifications/name-normalization/ """ -load("@pypackaging.bzl", "pypackaging") - def normalize_name(name): """normalize a PyPI package name and return a valid bazel label. @@ -49,4 +47,14 @@ def normalize_name(name): Returns: a normalized name as a string. """ - return pypackaging.utils.canonicalize_name(name).replace("-", "_") + name = name.replace("-", "_").replace(".", "_").lower() + if "__" not in name: + return name + + # Handle the edge-case where there are consecutive `-`, `_` or `.` characters, + # which is a valid Python package name. + return "_".join([ + part + for part in name.split("_") + if part + ]) From 69cac6c9ddb3c43cd15e57b453a125fbbd814beb Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 13:08:18 +0900 Subject: [PATCH 09/24] build: use pypackaging.bzl 0.4.0 It is aligned with packaging 26.3, is faster and officially supports WORKSPACE with Bazel 7 and 8. --- MODULE.bazel | 2 +- python/private/py_repositories.bzl | 6 +++--- tests/integration/bzlmod_lockfile/MODULE.bazel.lock | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 1d858fc36a..3a9fcd7ff5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,7 +8,7 @@ bazel_dep(name = "bazel_features", version = "1.55.0") bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "package_metadata", version = "0.0.7") bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "pypackaging.bzl", version = "0.3.0") +bazel_dep(name = "pypackaging.bzl", version = "0.4.0") bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "toml.bzl", version = "0.4.1") diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 09923dafa2..712f42c381 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -80,9 +80,9 @@ def py_repositories(transition_settings = []): ) http_archive( name = "pypackaging.bzl", - sha256 = "09570564367dfbff313950528376c9ba9ded9025cacb2c731545db19bc27e1e9", - strip_prefix = "pypackaging.bzl-0.3.0", - url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.3.0/pypackaging.bzl-v0.3.0.tar.gz", + sha256 = "d234430a5425e8b090c0071944036516a3516b41f9c9d005113fff0533f591b3", + strip_prefix = "pypackaging.bzl-0.4.0", + url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.4.0/pypackaging.bzl-v0.4.0.tar.gz", ) http_archive( name = "package_metadata", diff --git a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock index b4eb5015d6..dc845d274f 100644 --- a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock +++ b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock @@ -92,8 +92,8 @@ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", - "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/MODULE.bazel": "30595bbd1169866ae6adbf4c91ab5fb40420dae63311c6e76695c1ddc8d0aec5", - "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/source.json": "e84b643d154160c405139d59d92577e8864150620532397cf9eb6ee59165c534", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.4.0/MODULE.bazel": "5fd3c92b01d18cb6ac6fb9581b633d75e094c63b5673935b26182439a6e30a5e", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.4.0/source.json": "3d3aaa5de7e63fb1ab9953a60ddf7ade2183947003d37c1d5cc861b4f3278c5d", "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", From ee0ddc75f06fb582e8b1dd24cdfa091d11efb2b3 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 16:17:33 +0900 Subject: [PATCH 10/24] fix(pypi): accept tabs before the options and markers right after the URLs Whilst at it, really parse each requirement line once. --- python/private/pypi/parse_requirements.bzl | 13 ++++++------- python/private/pypi/pep508_requirement.bzl | 12 +++++++++--- tests/pypi/pep508/requirement_tests.bzl | 5 +++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index f82d6f850e..0ace719ac3 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -462,6 +462,9 @@ def _parse_requirements_from_req_files( all_files_parsed = {} index_url = None extra_index_urls = [] + + # The same lines are used on many platforms, so parse them once. + names = {} for file, plats in requirements_by_platform.items(): logger.trace(lambda: "Using {} for {}".format(file, plats)) contents = ctx.read(file) @@ -491,6 +494,8 @@ def _parse_requirements_from_req_files( # Pre-parse requirements once per file to avoid redundant parsing in loops parsed_reqs = [(entry, requirement(entry[1])) for entry in parse_result.requirements] + for entry, req in parsed_reqs: + names[entry[1]] = req.name for plat in plats: plat_env = platforms.get(plat) @@ -512,19 +517,13 @@ def _parse_requirements_from_req_files( reqs_by_name = {} requirements_by_platform = {} - # The same lines are used on many platforms, so parse them once. - names = {} for plat, parse_results in requirements.items(): requirements_dict = {} for entry in sorted( parse_results, key = lambda x: (len(x[1].partition("==")[0]), x), ): - req_line = entry[1] - if req_line not in names: - names[req_line] = requirement(req_line).name - - requirements_dict[names[req_line]] = entry + requirements_dict[names[entry[1]]] = entry extra_pip_args_for_plat = options[plat] diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index 9c145bcbf5..a5c86a2a38 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -29,16 +29,22 @@ def requirement(spec): """ # The options are not a part of PEP 508. - spec, _, _ = spec.partition(" --") + for sep in (" --", "\t--"): + spec, _, _ = spec.partition(sep) head, semicolon, marker = spec.partition(";") name, at, url = head.partition("@") - if at and "==" in name: + if at: # PEP 508 does not allow a version for the direct URL requirements, # but `name==version @ url` has always been accepted here, so that # the version of the distribution is known. name, _, _ = name.partition("==") - spec = name + at + url + semicolon + marker + + # PEP 508 needs a whitespace between the URL and the marker, but + # `name @ url; marker` is accepted by `pip` in the requirements files. + spec = name + at + url.rstrip() + if semicolon: + spec += " ;" + marker req = pypackaging.requirements.parse(spec) diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index 92cfa32caa..b13691bdf7 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -22,6 +22,8 @@ def _test_requirement_line_parsing(env): want = { " name1[ foo ] ": ("name1", ["foo"], ""), "Name[foo]": ("name", ["foo"], ""), + # No whitespace between the URL and the marker + "foo @ https://example.org/foo-1.0-py3-none-any.whl; os_name == 'a'": ("foo", [], "os_name == 'a'"), "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["bar", "fred"], "python_version=='2.7'"), "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], "(os_name=='a' or os_name=='b') and os_name=='c'"), "name@http://foo.com": ("name", [], ""), @@ -30,6 +32,9 @@ def _test_requirement_line_parsing(env): "name[extra]@http://foo.com": ("name", ["extra"], ""), "name[foo]": ("name", ["foo"], ""), "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], "python_version<'2.7' and platform_version=='2'"), + "name_foo==0.25\t--hash=sha256:deadbeef": ("name-foo", [], ""), + # The options may be indented with tabs in the requirements files + "name_foo==0.25 \t--hash=sha256:deadbeef": ("name-foo", [], ""), "name_foo==0.25 ; os_name=='a' --hash=sha256:deadbeef": ("name-foo", [], "os_name=='a'"), "name_foo[bar]": ("name-foo", ["bar"], ""), "name_foo[bar]==0.25": ("name-foo", ["bar"], ""), From 6bff817ca7a5422128381770dd37a72a80bbda51 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 16:18:53 +0900 Subject: [PATCH 11/24] refactor(pypi): use the partial marker evaluation of pypackaging.bzl Whilst at it, list all of the changes of the marker evaluation in the news. --- news/pypackaging-bzl.changed.md | 14 ++- python/private/pypi/pep508_evaluate.bzl | 138 ++++++++---------------- 2 files changed, 54 insertions(+), 98 deletions(-) diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md index 07e85f76eb..d282ad12b3 100644 --- a/news/pypackaging-bzl.changed.md +++ b/news/pypackaging-bzl.changed.md @@ -1,8 +1,12 @@ (pypi) The requirements and the environment markers are now handled by [`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl), which is a Starlark port of [`packaging`](https://github.com/pypa/packaging). This means -that invalid input, which was silently accepted before, is now an error and -that the environment markers are evaluated like `packaging` does it: -`platform_version` is compared as a string, the local version segments are -not ignored in `==` comparisons and the non-standard `not` operator is no -longer accepted. `WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. +that invalid input, which was silently accepted before, is now an error, +including the `Requires-Dist` lines in the `METADATA` of the wheels, and that +the environment markers are evaluated like `packaging` does it: +`platform_release` is compared as a version and `platform_version` as a +string, the ordered comparisons of the strings and of the invalid versions +are no longer lexicographic (`<` and `>` are always false, `<=` and `>=` are +the same as `==`), the local version segments are not ignored in `==` +comparisons and the non-standard `not` operator is no longer accepted. +`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index c0cbbed725..55bbf0d6a9 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -19,16 +19,13 @@ what `rules_python` needs on top of it: * The `platform_machine` aliases, so that e.g. `arm64` and `aarch64` mean the same thing. -* The partial evaluation, which is used to evaluate what is known when the - repositories are created (e.g. the `extra`) and to leave the rest for the - analysis phase. +* A single function for the full and the partial evaluation. The latter is + used to evaluate what is known when the repositories are created (e.g. the + `extra`) and to leave the rest for the analysis phase. """ load("@pypackaging.bzl", "pypackaging") -_AND = "and" -_OR = "or" - _PLATFORM_MACHINE_ALIASES = { # These pairs mean the same hardware, but different values may be used # on different host platforms. @@ -52,58 +49,59 @@ def evaluate(marker, *, env, strict = True): not be evaluated and it will represent the remaining expression. """ tree = pypackaging.markers.parse(marker) + if "platform_machine" in marker and "platform_machine" in env: + # The comparisons that are not evaluated are left as they are written. + tree = _with_platform_machine_aliases(tree, max_depth = len(marker)) - # Each frame is the list that is being reduced, the index of the next - # item in it and the values of the items that have been reduced so far. - stack = [(tree, 0, [])] - - # Each step advances an index or pops a frame, so this always terminates. - for _ in range(2 * len(marker) + 2): - items, i, values = stack[-1] - - if i >= len(items): - value = _reduce(values) - stack.pop() - if not stack: - if type(value) == "bool": - return value - return pypackaging.markers.to_string([value]) + if strict: + return pypackaging.markers.evaluate(tree, env) - stack[-1][2].append(value) - continue + result = pypackaging.markers.evaluate_partial(tree, env) + if type(result) == "bool": + return result - item = items[i] - stack[-1] = (items, i + 1, values) + return pypackaging.markers.to_string(result) - if type(item) == "list": - stack.append((item, 0, [])) - elif type(item) == "tuple": - values.append(_evaluate_item(item, env = env, strict = strict)) - else: - values.append(item) +def _with_platform_machine_aliases(tree, *, max_depth): + """Use the canonical names in the comparisons with `platform_machine`. - return fail("BUG: failed to evaluate the marker: {}".format(marker)) - -def _evaluate_item(item, *, env, strict): - """Evaluate a single ` ` expression. + Args: + tree: {type}`list` the parsed marker. + max_depth: {type}`int` the upper bound for the number of the + parenthesized expressions in the marker. Returns: - {type}`bool` or the item itself if it uses a variable that is not in - the env and `strict` is `False`. + {type}`list` a copy of the parsed marker. """ + result = [] + + # The pairs of the list to copy and the list to copy it to. + todo = [(tree, result)] + for _ in range(max_depth + 1): + if not todo: + break + + src, dst = todo.pop() + for item in src: + if type(item) == "list": + nested = [] + dst.append(nested) + todo.append((item, nested)) + elif type(item) == "tuple": + dst.append(_with_platform_machine_alias(item)) + else: + dst.append(item) + + return result + +def _with_platform_machine_alias(item): lhs, op, rhs = item - - if not strict: - for side in (lhs, rhs): - if side.type == "variable" and side.value not in env: - return item - if lhs.type == "variable" and lhs.value == "platform_machine": - rhs = _platform_machine(rhs) + return (lhs, op, _platform_machine(rhs)) elif rhs.type == "variable" and rhs.value == "platform_machine": - lhs = _platform_machine(lhs) - - return pypackaging.markers.evaluate([(lhs, op, rhs)], env) + return (_platform_machine(lhs), op, rhs) + else: + return item def _platform_machine(value): if value.type != "string": @@ -113,49 +111,3 @@ def _platform_machine(value): type = value.type, value = _PLATFORM_MACHINE_ALIASES.get(value.value, value.value), ) - -def _reduce(values): - """Reduce the values of a single (parenthesized) expression. - - Args: - values: {type}`list` the values separated by the `and` and `or` - operators. A value is a {type}`bool`, an expression that could - not be evaluated or a list of such for a parenthesized expression. - - Returns: - {type}`bool` or a list for what could not be evaluated. - """ - - # `and` binds tighter than `or`, so do the `and` groups first - groups = [[]] - for value in values: - if value == _OR: - groups.append([]) - elif value != _AND: - groups[-1].append(value) - - remaining = [] - for group in groups: - if False in group: - continue - - group = [v for v in group if v != True] - if not group: - return True - - if remaining: - remaining.append(_OR) - - for i, value in enumerate(group): - if i: - remaining.append(_AND) - remaining.append(value) - - if not remaining: - return False - - if len(remaining) == 1: - # No need to keep the parentheses. - return remaining[0] - - return remaining From 2390c98f945046f8b7eccc007bfdcf780e48c9f3 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:48:58 +0900 Subject: [PATCH 12/24] build: add pypackaging.bzl 0.3.0 as a dependency We have been maintaining our own Starlark implementations of PEP 440 versions and PEP 508 requirements and environment markers. `pypackaging.bzl` is a Starlark port of `packaging` that is tested against the upstream test-suite, so add it as a dependency in order to start using it instead. `WORKSPACE` users get the new dependency from `py_repositories`. Our own `WORKSPACE` file now calls it before the internal setup, which loads the repository rules that are going to use the new dependency. --- BUILD.bazel | 3 ++- MODULE.bazel | 1 + WORKSPACE | 9 ++++++--- downloader_config.cfg | 2 ++ gazelle/downloader_config.cfg | 2 ++ python/private/py_repositories.bzl | 6 ++++++ sphinxdocs/downloader_config.cfg | 2 ++ 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 9e5c70b732..ae9c87d1bf 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -27,7 +27,8 @@ load("@package_metadata//rules:package_metadata.bzl", "package_metadata") # gazelle:resolve starlark @bazel_tools//tools/build_defs/repo:http.bzl //python/private:bazel_tools # gazelle:resolve starlark @bazel_tools//tools/build_defs/repo:utils.bzl //python/private:bazel_tools -# Prevent Gazelle from incorrectly stripping the .bzl suffix from the toml.bzl repo name +# Prevent Gazelle from incorrectly stripping the .bzl suffix from the repo names +# gazelle:resolve starlark @pypackaging.bzl//:pypackaging.bzl @pypackaging.bzl//:pypackaging # gazelle:resolve starlark @toml.bzl//:toml.bzl @toml.bzl//:toml # Override Gazelle's incorrect default resolution for platforms host constraints Starlark library diff --git a/MODULE.bazel b/MODULE.bazel index 98ae8114b5..45e18a03f4 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,6 +8,7 @@ bazel_dep(name = "bazel_features", version = "1.55.0") bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "package_metadata", version = "0.0.13") bazel_dep(name = "platforms", version = "0.0.11") +bazel_dep(name = "pypackaging.bzl", version = "0.3.0") bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "toml.bzl", version = "0.4.1") diff --git a/WORKSPACE b/WORKSPACE index 631b94118d..f282982d82 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -61,14 +61,17 @@ load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_i stardoc_pinned_maven_install() +load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") + +# This needs to be called before the internal setup, because the repository +# rules that it loads use the dependencies defined here. +py_repositories() + load("//:internal_dev_setup.bzl", "rules_python_internal_setup") rules_python_internal_setup() load("@pythons_hub//:versions.bzl", "PYTHON_VERSIONS") -load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") - -py_repositories() python_register_multi_toolchains( name = "python", diff --git a/downloader_config.cfg b/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/downloader_config.cfg +++ b/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end diff --git a/gazelle/downloader_config.cfg b/gazelle/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/gazelle/downloader_config.cfg +++ b/gazelle/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 5353b8b8c5..f92152a3e6 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -78,6 +78,12 @@ def py_repositories(transition_settings = []): strip_prefix = "toml.bzl-0.4.0", url = "https://github.com/jvolkman/toml.bzl/releases/download/v0.4.0/toml.bzl-v0.4.0.tar.gz", ) + http_archive( + name = "pypackaging.bzl", + sha256 = "09570564367dfbff313950528376c9ba9ded9025cacb2c731545db19bc27e1e9", + strip_prefix = "pypackaging.bzl-0.3.0", + url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.3.0/pypackaging.bzl-v0.3.0.tar.gz", + ) http_archive( name = "package_metadata", sha256 = "755bd6c8a3751982e2555d96c913ec070954ca9d01f935563392255da4ebad72", diff --git a/sphinxdocs/downloader_config.cfg b/sphinxdocs/downloader_config.cfg index 8bde140608..d445f15ff1 100644 --- a/sphinxdocs/downloader_config.cfg +++ b/sphinxdocs/downloader_config.cfg @@ -20,6 +20,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) github.com/bazelbuild/rules_swi rewrite ^github\.com/bazelbuild/rules_testing/(.*) github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) github.com/protocolbuffers/protobuf/$1 # keep-sorted end @@ -48,6 +49,7 @@ rewrite ^github\.com/bazelbuild/rules_swift/(.*) mirror.bazel.build/github.com/b rewrite ^github\.com/bazelbuild/rules_testing/(.*) mirror.bazel.build/github.com/bazelbuild/rules_testing/$1 rewrite ^github\.com/bazelbuild/stardoc/(.*) mirror.bazel.build/github.com/bazelbuild/stardoc/$1 rewrite ^github\.com/google/googletest/(.*) mirror.bazel.build/github.com/google/googletest/$1 +rewrite ^github\.com/jvolkman/pypackaging\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/pypackaging.bzl/$1 rewrite ^github\.com/jvolkman/toml\.bzl/(.*) mirror.bazel.build/github.com/jvolkman/toml.bzl/$1 rewrite ^github\.com/protocolbuffers/protobuf/(.*) mirror.bazel.build/github.com/protocolbuffers/protobuf/$1 # keep-sorted end From 918e6c6542cce6dfea086994fce5299cac505a5f Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:28:02 +0900 Subject: [PATCH 13/24] tests: update the lockfile of the bzlmod_lockfile integration test --- tests/integration/bzlmod_lockfile/MODULE.bazel.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock index 2f3c632adb..996ddea575 100644 --- a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock +++ b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock @@ -93,6 +93,8 @@ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/MODULE.bazel": "30595bbd1169866ae6adbf4c91ab5fb40420dae63311c6e76695c1ddc8d0aec5", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/source.json": "e84b643d154160c405139d59d92577e8864150620532397cf9eb6ee59165c534", "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", From 910bc285896b55fa66d844a2e12fb520009ebe10 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 13:08:18 +0900 Subject: [PATCH 14/24] build: use pypackaging.bzl 0.4.0 It is aligned with packaging 26.3, is faster and officially supports WORKSPACE with Bazel 7 and 8. --- MODULE.bazel | 2 +- python/private/py_repositories.bzl | 6 +++--- tests/integration/bzlmod_lockfile/MODULE.bazel.lock | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 45e18a03f4..2fea2d486c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,7 +8,7 @@ bazel_dep(name = "bazel_features", version = "1.55.0") bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "package_metadata", version = "0.0.13") bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "pypackaging.bzl", version = "0.3.0") +bazel_dep(name = "pypackaging.bzl", version = "0.4.0") bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "toml.bzl", version = "0.4.1") diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index f92152a3e6..5eeaf4415f 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -80,9 +80,9 @@ def py_repositories(transition_settings = []): ) http_archive( name = "pypackaging.bzl", - sha256 = "09570564367dfbff313950528376c9ba9ded9025cacb2c731545db19bc27e1e9", - strip_prefix = "pypackaging.bzl-0.3.0", - url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.3.0/pypackaging.bzl-v0.3.0.tar.gz", + sha256 = "d234430a5425e8b090c0071944036516a3516b41f9c9d005113fff0533f591b3", + strip_prefix = "pypackaging.bzl-0.4.0", + url = "https://github.com/jvolkman/pypackaging.bzl/releases/download/v0.4.0/pypackaging.bzl-v0.4.0.tar.gz", ) http_archive( name = "package_metadata", diff --git a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock index 996ddea575..37e0f8cb6c 100644 --- a/tests/integration/bzlmod_lockfile/MODULE.bazel.lock +++ b/tests/integration/bzlmod_lockfile/MODULE.bazel.lock @@ -93,8 +93,8 @@ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", - "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/MODULE.bazel": "30595bbd1169866ae6adbf4c91ab5fb40420dae63311c6e76695c1ddc8d0aec5", - "https://bcr.bazel.build/modules/pypackaging.bzl/0.3.0/source.json": "e84b643d154160c405139d59d92577e8864150620532397cf9eb6ee59165c534", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.4.0/MODULE.bazel": "5fd3c92b01d18cb6ac6fb9581b633d75e094c63b5673935b26182439a6e30a5e", + "https://bcr.bazel.build/modules/pypackaging.bzl/0.4.0/source.json": "3d3aaa5de7e63fb1ab9953a60ddf7ade2183947003d37c1d5cc861b4f3278c5d", "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", From d0a23822e550e00e6bd738d8c3d9c6f6ab2c1182 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:30:22 +0900 Subject: [PATCH 15/24] refactor: normalize the names with pypackaging.bzl Use `pypackaging.utils.canonicalize_name` instead of the hand written loop. The result is the same, we only keep the conversion of the dashes to underscores so that the name can be used in the labels. --- python/private/BUILD.bazel | 11 ++++++----- python/private/normalize_name.bzl | 14 +++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 4360048304..067c8f29c0 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -997,6 +997,12 @@ bzl_library( ], ) +bzl_library( + name = "normalize_name", + srcs = ["normalize_name.bzl"], + deps = ["@pypackaging.bzl//:pypackaging"], +) + bzl_library( name = "artifacts_manifest", srcs = ["artifacts_manifest.bzl"], @@ -1032,11 +1038,6 @@ bzl_library( srcs = ["full_version.bzl"], ) -bzl_library( - name = "normalize_name", - srcs = ["normalize_name.bzl"], -) - bzl_library( name = "pbs_manifest", srcs = ["pbs_manifest.bzl"], diff --git a/python/private/normalize_name.bzl b/python/private/normalize_name.bzl index 7898222e41..7d3886f9ca 100644 --- a/python/private/normalize_name.bzl +++ b/python/private/normalize_name.bzl @@ -38,6 +38,8 @@ Also see Python spec on normalizing package names: https://packaging.python.org/en/latest/specifications/name-normalization/ """ +load("@pypackaging.bzl", "pypackaging") + def normalize_name(name): """normalize a PyPI package name and return a valid bazel label. @@ -47,14 +49,4 @@ def normalize_name(name): Returns: a normalized name as a string. """ - name = name.replace("-", "_").replace(".", "_").lower() - if "__" not in name: - return name - - # Handle the edge-case where there are consecutive `-`, `_` or `.` characters, - # which is a valid Python package name. - return "_".join([ - part - for part in name.split("_") - if part - ]) + return pypackaging.utils.canonicalize_name(name).replace("-", "_") From 3f1bdcaa0bf8a01a432f94dac5c450304b0d7b97 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:31:39 +0900 Subject: [PATCH 16/24] refactor(pypi): parse the requirements with pypackaging.bzl Use `pypackaging.requirements.parse` instead of the hand written partitioning of the requirement lines. The extras are now sorted and the unused `version` field is dropped. `name==version @ url` lines are not valid as per PEP 508, but they are still accepted because they are used in the requirements files. Whilst at it, parse each requirement line once instead of once per platform. --- news/pypackaging-bzl.changed.md | 5 +++ python/private/pypi/BUILD.bazel | 2 +- python/private/pypi/parse_requirements.bzl | 8 +++- python/private/pypi/pep508_requirement.bzl | 50 +++++++++------------- tests/pypi/pep508/requirement_tests.bzl | 29 +++++++------ 5 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 news/pypackaging-bzl.changed.md diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md new file mode 100644 index 0000000000..b233f37b2d --- /dev/null +++ b/news/pypackaging-bzl.changed.md @@ -0,0 +1,5 @@ +(pypi) The requirements are now parsed by +[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl), which is a +Starlark port of [`packaging`](https://github.com/pypa/packaging). This means +that invalid input, which was silently accepted before, is now an error. +`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index c5331fd899..a8050dcef2 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -312,7 +312,7 @@ bzl_library( bzl_library( name = "pep508_requirement", srcs = ["pep508_requirement.bzl"], - deps = ["//python/private:normalize_name"], + deps = ["@pypackaging.bzl//:pypackaging"], ) bzl_library( diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 2d8c4b4774..f82d6f850e 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -511,6 +511,9 @@ def _parse_requirements_from_req_files( reqs_by_name = {} requirements_by_platform = {} + + # The same lines are used on many platforms, so parse them once. + names = {} for plat, parse_results in requirements.items(): requirements_dict = {} for entry in sorted( @@ -518,9 +521,10 @@ def _parse_requirements_from_req_files( key = lambda x: (len(x[1].partition("==")[0]), x), ): req_line = entry[1] - req = requirement(req_line) + if req_line not in names: + names[req_line] = requirement(req_line).name - requirements_dict[req.name] = entry + requirements_dict[names[req_line]] = entry extra_pip_args_for_plat = options[plat] diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index 7552642572..9c145bcbf5 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -15,44 +15,36 @@ """This module is for parsing PEP508 requires-dist and requirements lines. """ -load("//python/private:normalize_name.bzl", "normalize_name") - -_STRIP = ["(", " ", ">", "=", "<", "~", "!", "@"] +load("@pypackaging.bzl", "pypackaging") def requirement(spec): """Parse a PEP508 requirement line Args: - spec: {type}`str` requirement line that will be parsed. + spec: {type}`str` requirement line that will be parsed. The options + of a `requirements.txt` line, e.g. `--hash`, are ignored. Returns: A struct with the information. """ - spec = spec.strip() - requires, _, maybe_hashes = spec.partition(";") - - version_start = requires.find("==") - version = None - if version_start != -1: - # Extract everything after '==' until the next space or end of the string - version, _, _ = requires[version_start + 2:].partition(" ") - - # Remove any trailing characters from the version string - version = version.strip(" ") - - marker, _, _ = maybe_hashes.partition("--hash") - requires, _, extras_unparsed = requires.partition("[") - extras_unparsed, _, _ = extras_unparsed.partition("]") - for char in _STRIP: - requires, _, _ = requires.partition(char) - extras = [normalize_name(e) for e in extras_unparsed.replace(" ", "").split(",") if e] - name = requires.strip(" ") - name = normalize_name(name) + + # The options are not a part of PEP 508. + spec, _, _ = spec.partition(" --") + + head, semicolon, marker = spec.partition(";") + name, at, url = head.partition("@") + if at and "==" in name: + # PEP 508 does not allow a version for the direct URL requirements, + # but `name==version @ url` has always been accepted here, so that + # the version of the distribution is known. + name, _, _ = name.partition("==") + spec = name + at + url + semicolon + marker + + req = pypackaging.requirements.parse(spec) return struct( - name = name.replace("_", "-"), - name_ = name, - marker = marker.strip(" "), - extras = extras, - version = version, + name = req.name, + name_ = req.name.replace("-", "_"), + marker = req.marker_str or "", + extras = [e.replace("-", "_") for e in req.extras], ) diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index 2ce45922da..92cfa32caa 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -20,22 +20,25 @@ _tests = [] def _test_requirement_line_parsing(env): want = { - " name1[ foo ] ": ("name1", ["foo"], None, ""), - "Name[foo]": ("name", ["foo"], None, ""), - "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["fred", "bar"], None, "python_version=='2.7'"), - "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], None, "(os_name=='a' or os_name=='b') and os_name=='c'"), - "name@http://foo.com": ("name", [], None, ""), - "name[ Foo123 ]": ("name", ["foo123"], None, ""), - "name[extra-one,extra-two.three]==1.0": ("name", ["extra_one", "extra_two_three"], "1.0", ""), - "name[extra]@http://foo.com": ("name", ["extra"], None, ""), - "name[foo]": ("name", ["foo"], None, ""), - "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], None, "python_version<'2.7' and platform_version=='2'"), - "name_foo[bar]": ("name-foo", ["bar"], None, ""), - "name_foo[bar]==0.25": ("name-foo", ["bar"], "0.25", ""), + " name1[ foo ] ": ("name1", ["foo"], ""), + "Name[foo]": ("name", ["foo"], ""), + "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["bar", "fred"], "python_version=='2.7'"), + "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], "(os_name=='a' or os_name=='b') and os_name=='c'"), + "name@http://foo.com": ("name", [], ""), + "name[ Foo123 ]": ("name", ["foo123"], ""), + "name[extra-one,extra-two.three]==1.0": ("name", ["extra_one", "extra_two_three"], ""), + "name[extra]@http://foo.com": ("name", ["extra"], ""), + "name[foo]": ("name", ["foo"], ""), + "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], "python_version<'2.7' and platform_version=='2'"), + "name_foo==0.25 ; os_name=='a' --hash=sha256:deadbeef": ("name-foo", [], "os_name=='a'"), + "name_foo[bar]": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25 --hash=sha256:deadbeef": ("name-foo", ["bar"], ""), + "name_foo[bar]==0.25 @ http://foo.com ; os_name=='a'": ("name-foo", ["bar"], "os_name=='a'"), } got = { - i: (parsed.name, parsed.extras, parsed.version, parsed.marker) + i: (parsed.name, parsed.extras, parsed.marker) for i, parsed in {case: requirement(case) for case in want}.items() } env.expect.that_dict(got).contains_exactly(want) From 470aa71059447e6c81e686713a9c92194d26ac80 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 10:41:05 +0900 Subject: [PATCH 17/24] revert: keep normalize_name free of pypackaging.bzl It is loaded by the files that Bazel 8 autoloads, which cannot load from the pypackaging.bzl repository. --- python/private/BUILD.bazel | 11 +++++------ python/private/normalize_name.bzl | 14 +++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/python/private/BUILD.bazel b/python/private/BUILD.bazel index 067c8f29c0..4360048304 100644 --- a/python/private/BUILD.bazel +++ b/python/private/BUILD.bazel @@ -997,12 +997,6 @@ bzl_library( ], ) -bzl_library( - name = "normalize_name", - srcs = ["normalize_name.bzl"], - deps = ["@pypackaging.bzl//:pypackaging"], -) - bzl_library( name = "artifacts_manifest", srcs = ["artifacts_manifest.bzl"], @@ -1038,6 +1032,11 @@ bzl_library( srcs = ["full_version.bzl"], ) +bzl_library( + name = "normalize_name", + srcs = ["normalize_name.bzl"], +) + bzl_library( name = "pbs_manifest", srcs = ["pbs_manifest.bzl"], diff --git a/python/private/normalize_name.bzl b/python/private/normalize_name.bzl index 7d3886f9ca..7898222e41 100644 --- a/python/private/normalize_name.bzl +++ b/python/private/normalize_name.bzl @@ -38,8 +38,6 @@ Also see Python spec on normalizing package names: https://packaging.python.org/en/latest/specifications/name-normalization/ """ -load("@pypackaging.bzl", "pypackaging") - def normalize_name(name): """normalize a PyPI package name and return a valid bazel label. @@ -49,4 +47,14 @@ def normalize_name(name): Returns: a normalized name as a string. """ - return pypackaging.utils.canonicalize_name(name).replace("-", "_") + name = name.replace("-", "_").replace(".", "_").lower() + if "__" not in name: + return name + + # Handle the edge-case where there are consecutive `-`, `_` or `.` characters, + # which is a valid Python package name. + return "_".join([ + part + for part in name.split("_") + if part + ]) From 80f5be20fa20082cfeef164147470f2df0d7f58d Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sun, 22 Nov 2026 16:17:33 +0900 Subject: [PATCH 18/24] fix(pypi): accept tabs before the options and markers right after the URLs Whilst at it, really parse each requirement line once. --- python/private/pypi/parse_requirements.bzl | 13 ++++++------- python/private/pypi/pep508_requirement.bzl | 12 +++++++++--- tests/pypi/pep508/requirement_tests.bzl | 5 +++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index f82d6f850e..0ace719ac3 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -462,6 +462,9 @@ def _parse_requirements_from_req_files( all_files_parsed = {} index_url = None extra_index_urls = [] + + # The same lines are used on many platforms, so parse them once. + names = {} for file, plats in requirements_by_platform.items(): logger.trace(lambda: "Using {} for {}".format(file, plats)) contents = ctx.read(file) @@ -491,6 +494,8 @@ def _parse_requirements_from_req_files( # Pre-parse requirements once per file to avoid redundant parsing in loops parsed_reqs = [(entry, requirement(entry[1])) for entry in parse_result.requirements] + for entry, req in parsed_reqs: + names[entry[1]] = req.name for plat in plats: plat_env = platforms.get(plat) @@ -512,19 +517,13 @@ def _parse_requirements_from_req_files( reqs_by_name = {} requirements_by_platform = {} - # The same lines are used on many platforms, so parse them once. - names = {} for plat, parse_results in requirements.items(): requirements_dict = {} for entry in sorted( parse_results, key = lambda x: (len(x[1].partition("==")[0]), x), ): - req_line = entry[1] - if req_line not in names: - names[req_line] = requirement(req_line).name - - requirements_dict[names[req_line]] = entry + requirements_dict[names[entry[1]]] = entry extra_pip_args_for_plat = options[plat] diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index 9c145bcbf5..a5c86a2a38 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -29,16 +29,22 @@ def requirement(spec): """ # The options are not a part of PEP 508. - spec, _, _ = spec.partition(" --") + for sep in (" --", "\t--"): + spec, _, _ = spec.partition(sep) head, semicolon, marker = spec.partition(";") name, at, url = head.partition("@") - if at and "==" in name: + if at: # PEP 508 does not allow a version for the direct URL requirements, # but `name==version @ url` has always been accepted here, so that # the version of the distribution is known. name, _, _ = name.partition("==") - spec = name + at + url + semicolon + marker + + # PEP 508 needs a whitespace between the URL and the marker, but + # `name @ url; marker` is accepted by `pip` in the requirements files. + spec = name + at + url.rstrip() + if semicolon: + spec += " ;" + marker req = pypackaging.requirements.parse(spec) diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index 92cfa32caa..b13691bdf7 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -22,6 +22,8 @@ def _test_requirement_line_parsing(env): want = { " name1[ foo ] ": ("name1", ["foo"], ""), "Name[foo]": ("name", ["foo"], ""), + # No whitespace between the URL and the marker + "foo @ https://example.org/foo-1.0-py3-none-any.whl; os_name == 'a'": ("foo", [], "os_name == 'a'"), "name [fred,bar] @ http://foo.com ; python_version=='2.7'": ("name", ["bar", "fred"], "python_version=='2.7'"), "name; (os_name=='a' or os_name=='b') and os_name=='c'": ("name", [], "(os_name=='a' or os_name=='b') and os_name=='c'"), "name@http://foo.com": ("name", [], ""), @@ -30,6 +32,9 @@ def _test_requirement_line_parsing(env): "name[extra]@http://foo.com": ("name", ["extra"], ""), "name[foo]": ("name", ["foo"], ""), "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], "python_version<'2.7' and platform_version=='2'"), + "name_foo==0.25\t--hash=sha256:deadbeef": ("name-foo", [], ""), + # The options may be indented with tabs in the requirements files + "name_foo==0.25 \t--hash=sha256:deadbeef": ("name-foo", [], ""), "name_foo==0.25 ; os_name=='a' --hash=sha256:deadbeef": ("name-foo", [], "os_name=='a'"), "name_foo[bar]": ("name-foo", ["bar"], ""), "name_foo[bar]==0.25": ("name-foo", ["bar"], ""), From c07b4faa632616be10a87b42c717f9843b1f438c Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sun, 22 Nov 2026 20:33:17 -0800 Subject: [PATCH 19/24] refactor(pypi): cache parsed requirements across files and polish docs Avoid re-parsing shared requirement lines across per-platform files and align the Starlark structs, tests, and news entry with project style. Cache `requirement()` structs in a single dict across files in `parse_requirements.bzl`, document `requirement()` return fields, use an explicit loop in `requirement_tests.bzl`, and cross-reference `py_repositories` in the tightened news entry. --- news/pypackaging-bzl.changed.md | 10 ++++----- python/private/pypi/parse_requirements.bzl | 24 ++++++++++++---------- python/private/pypi/pep508_requirement.bzl | 4 ++++ tests/pypi/pep508/requirement_tests.bzl | 8 ++++---- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md index b233f37b2d..5248d98ad0 100644 --- a/news/pypackaging-bzl.changed.md +++ b/news/pypackaging-bzl.changed.md @@ -1,5 +1,5 @@ -(pypi) The requirements are now parsed by -[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl), which is a -Starlark port of [`packaging`](https://github.com/pypa/packaging). This means -that invalid input, which was silently accepted before, is now an error. -`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. +(pypi) Invalid PEP 508 requirements now fail instead of being silently accepted, +as requirements are now parsed by +[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl) (a Starlark +port of [`packaging`](https://github.com/pypa/packaging)). `WORKSPACE` users +get `pypackaging.bzl` from {obj}`py_repositories`. diff --git a/python/private/pypi/parse_requirements.bzl b/python/private/pypi/parse_requirements.bzl index 0ace719ac3..dfc4501c76 100644 --- a/python/private/pypi/parse_requirements.bzl +++ b/python/private/pypi/parse_requirements.bzl @@ -464,7 +464,7 @@ def _parse_requirements_from_req_files( extra_index_urls = [] # The same lines are used on many platforms, so parse them once. - names = {} + parsed_reqs = {} for file, plats in requirements_by_platform.items(): logger.trace(lambda: "Using {} for {}".format(file, plats)) contents = ctx.read(file) @@ -492,19 +492,21 @@ def _parse_requirements_from_req_files( # (3.0). get_index_urls = None - # Pre-parse requirements once per file to avoid redundant parsing in loops - parsed_reqs = [(entry, requirement(entry[1])) for entry in parse_result.requirements] - for entry, req in parsed_reqs: - names[entry[1]] = req.name + for _, req_line in parse_result.requirements: + if req_line not in parsed_reqs: + parsed_reqs[req_line] = requirement(req_line) for plat in plats: plat_env = platforms.get(plat) - requirements[plat] = [ - entry - for entry, req in parsed_reqs - if not req.marker or (plat_env and evaluate(req.marker, env = plat_env.env)) - ] + plat_reqs = [] + for entry in parse_result.requirements: + marker = parsed_reqs[entry[1]].marker + if not marker or ( + plat_env and evaluate(marker, env = plat_env.env) + ): + plat_reqs.append(entry) + requirements[plat] = plat_reqs options[plat] = pip_args @@ -523,7 +525,7 @@ def _parse_requirements_from_req_files( parse_results, key = lambda x: (len(x[1].partition("==")[0]), x), ): - requirements_dict[names[entry[1]]] = entry + requirements_dict[parsed_reqs[entry[1]].name] = entry extra_pip_args_for_plat = options[plat] diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index a5c86a2a38..7dab8caf41 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -49,8 +49,12 @@ def requirement(spec): req = pypackaging.requirements.parse(spec) return struct( + # str: normalized PEP 503 package name using `-` separators. name = req.name, + # str: normalized package name using `_` separators for Bazel labels. name_ = req.name.replace("-", "_"), + # str: PEP 508 environment marker expression, or `""` if absent. marker = req.marker_str or "", + # list[str]: sorted normalized extra names using `_` separators. extras = [e.replace("-", "_") for e in req.extras], ) diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index b13691bdf7..2660886d57 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -42,10 +42,10 @@ def _test_requirement_line_parsing(env): "name_foo[bar]==0.25 @ http://foo.com ; os_name=='a'": ("name-foo", ["bar"], "os_name=='a'"), } - got = { - i: (parsed.name, parsed.extras, parsed.marker) - for i, parsed in {case: requirement(case) for case in want}.items() - } + got = {} + for case in want: + parsed = requirement(case) + got[case] = (parsed.name, parsed.extras, parsed.marker) env.expect.that_dict(got).contains_exactly(want) _tests.append(_test_requirement_line_parsing) From 744f30491ac6c06da65eac1d41e099854d7b7dc0 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:55:45 +0900 Subject: [PATCH 20/24] fix(pypi): use the platform_machine aliases for the value in the env --- python/private/pypi/pep508_evaluate.bzl | 6 ++++++ tests/pypi/pep508/evaluate_tests.bzl | 26 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index 55bbf0d6a9..58b9290e22 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -53,6 +53,12 @@ def evaluate(marker, *, env, strict = True): # The comparisons that are not evaluated are left as they are written. tree = _with_platform_machine_aliases(tree, max_depth = len(marker)) + # The value in the env may be an alias as well. + machine = env["platform_machine"] + env = env | { + "platform_machine": _PLATFORM_MACHINE_ALIASES.get(machine, machine), + } + if strict: return pypackaging.markers.evaluate(tree, env) diff --git a/tests/pypi/pep508/evaluate_tests.bzl b/tests/pypi/pep508/evaluate_tests.bzl index 89da5f8cd8..88897945e8 100644 --- a/tests/pypi/pep508/evaluate_tests.bzl +++ b/tests/pypi/pep508/evaluate_tests.bzl @@ -230,6 +230,32 @@ def _evaluate_with_aliases(env): _tests.append(_evaluate_with_aliases) +def _evaluate_with_aliases_in_env(env): + # The `platform_machine` of the env may be an alias as well, e.g. when it + # comes from the host platform. + for machine, tests in { + "amd64": { + "platform_machine != 'amd64'": False, + "platform_machine == 'amd64'": True, + "platform_machine == 'arm64'": False, + "platform_machine == 'x86_64'": True, + }, + "arm64": { + "'arm64' == platform_machine": True, + "platform_machine != 'arm64'": False, + "platform_machine == 'aarch64'": True, + "platform_machine == 'arm64'": True, + "platform_machine == 'x86_64'": False, + }, + }.items(): + for input, want in tests.items(): + _check_evaluate(env, input, want, {"platform_machine": machine}) + + # The partial evaluation gives the same result. + _check_evaluate(env, input, want, {"platform_machine": machine}, strict = False) + +_tests.append(_evaluate_with_aliases_in_env) + def _expr_case(expr, want, env): return struct(expr = expr.strip(), want = want, env = env) From 37776685a21ec5b95efb44777871ea70a3a57724 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:55:49 +0900 Subject: [PATCH 21/24] refactor(pypi): use the types helpers and keep the platform_machine aliases sorted --- news/pypackaging-bzl.changed.md | 2 +- python/private/pypi/BUILD.bazel | 5 ++++- python/private/pypi/pep508_evaluate.bzl | 13 ++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md index d282ad12b3..b4b26c3e79 100644 --- a/news/pypackaging-bzl.changed.md +++ b/news/pypackaging-bzl.changed.md @@ -9,4 +9,4 @@ string, the ordered comparisons of the strings and of the invalid versions are no longer lexicographic (`<` and `>` are always false, `<=` and `>=` are the same as `==`), the local version segments are not ignored in `==` comparisons and the non-standard `not` operator is no longer accepted. -`WORKSPACE` users get `pypackaging.bzl` from `py_repositories`. +`WORKSPACE` users get `pypackaging.bzl` from {obj}`py_repositories`. diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel index eeea68a5a4..ee23104512 100644 --- a/python/private/pypi/BUILD.bazel +++ b/python/private/pypi/BUILD.bazel @@ -299,7 +299,10 @@ bzl_library( bzl_library( name = "pep508_evaluate", srcs = ["pep508_evaluate.bzl"], - deps = ["@pypackaging.bzl//:pypackaging"], + deps = [ + "@bazel_skylib//lib:types", + "@pypackaging.bzl//:pypackaging", + ], ) bzl_library( diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index 58b9290e22..d7fcc0ecc3 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -24,15 +24,18 @@ what `rules_python` needs on top of it: `extra`) and to leave the rest for the analysis phase. """ +load("@bazel_skylib//lib:types.bzl", "types") load("@pypackaging.bzl", "pypackaging") +# These pairs mean the same hardware, but different values may be used on +# different host platforms. _PLATFORM_MACHINE_ALIASES = { - # These pairs mean the same hardware, but different values may be used - # on different host platforms. + # keep-sorted start "amd64": "x86_64", "arm64": "aarch64", "i386": "x86_32", "i686": "x86_32", + # keep-sorted end } def evaluate(marker, *, env, strict = True): @@ -63,7 +66,7 @@ def evaluate(marker, *, env, strict = True): return pypackaging.markers.evaluate(tree, env) result = pypackaging.markers.evaluate_partial(tree, env) - if type(result) == "bool": + if types.is_bool(result): return result return pypackaging.markers.to_string(result) @@ -89,11 +92,11 @@ def _with_platform_machine_aliases(tree, *, max_depth): src, dst = todo.pop() for item in src: - if type(item) == "list": + if types.is_list(item): nested = [] dst.append(nested) todo.append((item, nested)) - elif type(item) == "tuple": + elif types.is_tuple(item): dst.append(_with_platform_machine_alias(item)) else: dst.append(item) From 476e5d6b20ba2f34fad17ea53946b06fd1976140 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:57:43 +0900 Subject: [PATCH 22/24] fix(pypi): only strip the options outside of the quoted strings of the requirement lines --- python/private/pypi/pep508_requirement.bzl | 28 +++++++++++++++++++--- tests/pypi/pep508/requirement_tests.bzl | 5 ++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/python/private/pypi/pep508_requirement.bzl b/python/private/pypi/pep508_requirement.bzl index 7dab8caf41..6798e06bd6 100644 --- a/python/private/pypi/pep508_requirement.bzl +++ b/python/private/pypi/pep508_requirement.bzl @@ -28,9 +28,7 @@ def requirement(spec): A struct with the information. """ - # The options are not a part of PEP 508. - for sep in (" --", "\t--"): - spec, _, _ = spec.partition(sep) + spec = _strip_options(spec) head, semicolon, marker = spec.partition(";") name, at, url = head.partition("@") @@ -58,3 +56,27 @@ def requirement(spec): # list[str]: sorted normalized extra names using `_` separators. extras = [e.replace("-", "_") for e in req.extras], ) + +def _strip_options(line): + """Remove the `requirements.txt` options, which are not a part of PEP 508. + + The options, e.g. `--hash=sha256:...` or `-C key=value`, start with a `-` + that follows a whitespace. The quoted strings of the markers are skipped, + because they may have such text as well. + """ + if " -" not in line and "\t-" not in line: + return line + + quote = None + prev = "" + for i, c in enumerate(line.elems()): + if quote: + if c == quote: + quote = None + elif c in ("\"", "'"): + quote = c + elif c == "-" and prev in (" ", "\t"): + return line[:i] + prev = c + + return line diff --git a/tests/pypi/pep508/requirement_tests.bzl b/tests/pypi/pep508/requirement_tests.bzl index 2660886d57..fd81a321cb 100644 --- a/tests/pypi/pep508/requirement_tests.bzl +++ b/tests/pypi/pep508/requirement_tests.bzl @@ -32,9 +32,14 @@ def _test_requirement_line_parsing(env): "name[extra]@http://foo.com": ("name", ["extra"], ""), "name[foo]": ("name", ["foo"], ""), "name[quux, strange];python_version<'2.7' and platform_version=='2'": ("name", ["quux", "strange"], "python_version<'2.7' and platform_version=='2'"), + "name_foo; platform_release != \"custom -x\"": ("name-foo", [], "platform_release != \"custom -x\""), + # The text that looks like an option in a quoted marker value is kept + "name_foo; platform_release != 'custom -- kernel' --hash=sha256:deadbeef": ("name-foo", [], "platform_release != 'custom -- kernel'"), "name_foo==0.25\t--hash=sha256:deadbeef": ("name-foo", [], ""), # The options may be indented with tabs in the requirements files "name_foo==0.25 \t--hash=sha256:deadbeef": ("name-foo", [], ""), + # The short options, e.g. `-C` for `--config-settings` + "name_foo==0.25 -Ckey=value --hash=sha256:deadbeef": ("name-foo", [], ""), "name_foo==0.25 ; os_name=='a' --hash=sha256:deadbeef": ("name-foo", [], "os_name=='a'"), "name_foo[bar]": ("name-foo", ["bar"], ""), "name_foo[bar]==0.25": ("name-foo", ["bar"], ""), From 95280402108bb849f719b439a16d91701ab4fd96 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Mon, 23 Nov 2026 16:58:44 -0800 Subject: [PATCH 23/24] refactor(pypi): document and wrap pep508_evaluate helpers Align the new marker evaluator helpers and tests with Starlark style conventions so docstrings, struct fields, and line lengths remain consistent. Wrap added lines to 80 columns, parameterize container types, flatten early-return guards, and document private helper arguments, return values, and struct fields. --- python/private/pypi/pep508_evaluate.bzl | 42 +++++++++++++++++++------ tests/pypi/pep508/evaluate_tests.bzl | 14 +++++++-- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl index d7fcc0ecc3..9dede95952 100644 --- a/python/private/pypi/pep508_evaluate.bzl +++ b/python/private/pypi/pep508_evaluate.bzl @@ -43,13 +43,15 @@ def evaluate(marker, *, env, strict = True): Args: marker: {type}`str` The string marker to evaluate. - env: {type}`dict[str, str]` The environment to evaluate the marker against. + env: {type}`dict[str, str]` The environment to evaluate the marker + against. strict: {type}`bool` A setting to not fail on missing values in the env. Returns: - The {type}`bool | str` If the marker is compatible with the given env. If strict is - `False`, then the output type is `str` if a part of the marker could - not be evaluated and it will represent the remaining expression. + The {type}`bool | str` If the marker is compatible with the given env. + If `strict` is `False`, then the output type is `str` if a part of the + marker could not be evaluated and it will represent the remaining + expression. """ tree = pypackaging.markers.parse(marker) if "platform_machine" in marker and "platform_machine" in env: @@ -75,12 +77,12 @@ def _with_platform_machine_aliases(tree, *, max_depth): """Use the canonical names in the comparisons with `platform_machine`. Args: - tree: {type}`list` the parsed marker. + tree: {type}`list[tuple | list | str]` the parsed marker. max_depth: {type}`int` the upper bound for the number of the parenthesized expressions in the marker. Returns: - {type}`list` a copy of the parsed marker. + {type}`list[tuple | list | str]` a copy of the parsed marker. """ result = [] @@ -104,19 +106,41 @@ def _with_platform_machine_aliases(tree, *, max_depth): return result def _with_platform_machine_alias(item): + """Normalize literal operands compared against `platform_machine`. + + Args: + item: {type}`tuple[struct, str, struct]` a parsed `(lhs, op, rhs)` + comparison tuple. + + Returns: + {type}`tuple[struct, str, struct]` the comparison tuple with any + aliased `platform_machine` string operand replaced by its canonical + name. + """ lhs, op, rhs = item if lhs.type == "variable" and lhs.value == "platform_machine": return (lhs, op, _platform_machine(rhs)) - elif rhs.type == "variable" and rhs.value == "platform_machine": + if rhs.type == "variable" and rhs.value == "platform_machine": return (_platform_machine(lhs), op, rhs) - else: - return item + return item def _platform_machine(value): + """Return a copy of a string AST node with its canonical machine name. + + Args: + value: {type}`struct` a parsed marker operand node (`type` and + `value`). + + Returns: + {type}`struct` the operand node with `value` mapped through + `_PLATFORM_MACHINE_ALIASES` when `value` is a string node. + """ if value.type != "string": return value return struct( + # str: AST node kind ("string"). type = value.type, + # str: canonicalized machine architecture name. value = _PLATFORM_MACHINE_ALIASES.get(value.value, value.value), ) diff --git a/tests/pypi/pep508/evaluate_tests.bzl b/tests/pypi/pep508/evaluate_tests.bzl index 88897945e8..3b62cac715 100644 --- a/tests/pypi/pep508/evaluate_tests.bzl +++ b/tests/pypi/pep508/evaluate_tests.bzl @@ -252,7 +252,13 @@ def _evaluate_with_aliases_in_env(env): _check_evaluate(env, input, want, {"platform_machine": machine}) # The partial evaluation gives the same result. - _check_evaluate(env, input, want, {"platform_machine": machine}, strict = False) + _check_evaluate( + env, + input, + want, + {"platform_machine": machine}, + strict = False, + ) _tests.append(_evaluate_with_aliases_in_env) @@ -275,7 +281,11 @@ _MISC_EXPRESSIONS = [ _expr_case('python_version > "1.7.post2"', False, {"python_version": "1.7.0"}), # The local versions cannot be used with the ordered comparisons _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.1"}), - _expr_case('python_version > "1.7.1+local"', False, {"python_version": "1.7.2"}), + _expr_case( + 'python_version > "1.7.1+local"', + False, + {"python_version": "1.7.2"}, + ), # Extra cases for the '<' operator _expr_case('python_version < "1.7.1"', False, {"python_version": "1.7.2"}), _expr_case('python_version < "1.7.3"', True, {"python_version": "1.7.2"}), From 634d30ef77f17c87e1cbcde1684bd22a54430b31 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Mon, 23 Nov 2026 20:46:20 -0800 Subject: [PATCH 24/24] docs(pypi): condense pypackaging-bzl news entry Keep `CHANGELOG.md` skimmable and accurate by trimming the news entry under the 30-word ceiling and dropping the inaccurate string-ordering example and `WORKSPACE` setup mechanics. --- news/pypackaging-bzl.changed.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/news/pypackaging-bzl.changed.md b/news/pypackaging-bzl.changed.md index 25405ce6e7..34893956ea 100644 --- a/news/pypackaging-bzl.changed.md +++ b/news/pypackaging-bzl.changed.md @@ -1,7 +1,3 @@ -(pypi) Invalid PEP 508 requirements and environment markers now fail instead of -being silently accepted, as they are now parsed by -[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl) (a Starlark -port of [`packaging`](https://github.com/pypa/packaging)). The markers are -evaluated like `packaging` does it, e.g. `platform_release` is compared as a -version and the ordered comparisons of strings are always false. `WORKSPACE` -users get `pypackaging.bzl` from {obj}`py_repositories`. +(pypi) PEP 508 requirements and environment markers now match +[`packaging`](https://github.com/pypa/packaging) and reject invalid syntax via +[`pypackaging.bzl`](https://github.com/jvolkman/pypackaging.bzl).