From 7c909950a654a96aa34bc65cc4317c1e1fba36da Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 19:30:34 +0900 Subject: [PATCH 01/10] feat(pip.parse): limit the target platforms we parse requirements for Up until now the users can configure which requirements files to be used for specific platforms, however, what they cannot configure is what target platforms should actually be set up. The difference in the problems is: 1. I want my `bazel build` to work on `osx aarch64` and `linux x86_64`. 1. I want my `bazel build` to build for `linux x86_64` on `osx aarch64`. With the newly introduced `target_platforms` attribute users can finally specify their target platforms. To ensure that this also allows users to specify that they want to support `freethreaded` and `non-freethreaded` platforms at the same time we support `{os}` and `{arch}` templating in the strings. This should fix the `genquery` usage pattern breakage when we previously enabled `RULES_PYTHON_ENABLE_PIPSTAR=1`. Work towards #2949 --- CHANGELOG.md | 8 ++ python/private/pypi/extension.bzl | 19 +++++ python/private/pypi/hub_builder.bzl | 49 +++++++----- .../pypi/requirements_files_by_platform.bzl | 2 +- tests/pypi/extension/pip_parse.bzl | 3 + tests/pypi/hub_builder/hub_builder_tests.bzl | 74 ++++++++++++++++++- 6 files changed, 134 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9776a7f4c2..a41ac20103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,14 @@ END_UNRELEASED_TEMPLATE {#v0-0-0-added} ### Added * (toolchains) `3.9.25` Python toolchain from [20251031] release. +* (pypi) API to tell `pip.parse` which platforms users care about. This is very useful to ensure + that when users do `bazel query` for their deps, they don't have to download all of the + dependencies for all of the available wheels. Torch wheels can be up of 1GB and it takes a lot + of time to download those, which is unnecessary if only the host platform builds are necessary + to be performed. This is mainly for backwards/forwards compatibility whilst rolling out + `RULES_PYTHON_ENABLE_PIPSTAR=1` by default. Users of `experimental_index_url` that perform + cross-builds should add {obj}`target_platforms` to their `pip.parse` invocations, which will + become mandatory if any cross-builds are required from the next release. [20251031]: https://github.com/astral-sh/python-build-standalone/releases/tag/20251031 {#v1-7-0} diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index be1a8e4d03..6d435d174c 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -667,6 +667,25 @@ EXPERIMENTAL: this may be removed without notice. :::{versionadded} 1.4.0 ::: +""", + ), + "target_platforms": attr.string_list( + default = ["{host}"], + doc = """\ +The list of platforms for which we would evaluate the requirements files. If you need to be able to +only evaluate for a particular platform (e.g. "linux_x86_64"), then put it in here. + +If you want `freethreaded` variant, then you can use `_freethreaded` suffix as `rules_python` is +defining target platforms for these variants in its `MODULE.bazel` file. The identifiers for this +function in general are the same as used in the {obj}`pip.default.platform` attribute. + +If you only care for the host platform and do not have a usecase to cross-build, then you can put in +a string `"{os}_{arch}"` as the value here. You could also use `"{os}_{arch}_freethreaded"` as well. + +EXPERIMENTAL: this may be removed without notice. + +:::{versionadded} VERSION_NEXT_FEATURE +::: """, ), "whl_modifications": attr.label_keyed_string_dict( diff --git a/python/private/pypi/hub_builder.bzl b/python/private/pypi/hub_builder.bzl index 1378e2f122..ec60d1f442 100644 --- a/python/private/pypi/hub_builder.bzl +++ b/python/private/pypi/hub_builder.bzl @@ -135,11 +135,15 @@ def _pip_parse(self, module_ctx, pip_attr): )) return + default_cross_setup = _set_get_index_urls(self, pip_attr) self._platforms[python_version] = _platforms( + module_ctx, python_version = full_python_version, config = self._config, + # FIXME @aignas 2025-12-06: should we have this behaviour? + # TODO @aignas 2025-12-06: use target_platforms always even when the get_index_urls is set. + target_platforms = [] if default_cross_setup else pip_attr.target_platforms, ) - _set_get_index_urls(self, pip_attr) _add_group_map(self, pip_attr.experimental_requirement_cycles) _add_extra_aliases(self, pip_attr.extra_hub_aliases) _create_whl_repos( @@ -249,7 +253,7 @@ def _set_get_index_urls(self, pip_attr): # parallel_download is set to True by default, so we are not checking/validating it # here - return + return False python_version = pip_attr.python_version self._use_downloader.setdefault(python_version, {}).update({ @@ -275,6 +279,7 @@ def _set_get_index_urls(self, pip_attr): cache = self._simpleapi_cache, parallel_download = pip_attr.parallel_download, ) + return True def _detect_interpreter(self, pip_attr): python_interpreter_target = pip_attr.python_interpreter_target @@ -301,14 +306,22 @@ def _detect_interpreter(self, pip_attr): path = pip_attr.python_interpreter, ) -def _platforms(*, python_version, config): +def _platforms(module_ctx, *, python_version, config, target_platforms): platforms = {} python_version = version.parse( python_version, strict = True, ) + target_platforms = sorted({ + p.format(os = module_ctx.os.name, arch = module_ctx.os.arch): None + for p in target_platforms + }) + for platform, values in config.platforms.items(): + if target_platforms and platform not in target_platforms: + continue + # TODO @aignas 2025-07-07: this is probably doing the parsing of the version too # many times. abi = "{}{}{}.{}".format( @@ -400,22 +413,24 @@ def _create_whl_repos( """ logger = self._logger platforms = self._platforms[pip_attr.python_version] + requirements_by_platform = requirements_files_by_platform( + requirements_by_platform = pip_attr.requirements_by_platform, + requirements_linux = pip_attr.requirements_linux, + requirements_lock = pip_attr.requirements_lock, + requirements_osx = pip_attr.requirements_darwin, + requirements_windows = pip_attr.requirements_windows, + extra_pip_args = pip_attr.extra_pip_args, + platforms = sorted(platforms), # here we only need keys + python_version = full_version( + version = pip_attr.python_version, + minor_mapping = self._minor_mapping, + ), + logger = logger, + ) + requirements_by_platform = parse_requirements( module_ctx, - requirements_by_platform = requirements_files_by_platform( - requirements_by_platform = pip_attr.requirements_by_platform, - requirements_linux = pip_attr.requirements_linux, - requirements_lock = pip_attr.requirements_lock, - requirements_osx = pip_attr.requirements_darwin, - requirements_windows = pip_attr.requirements_windows, - extra_pip_args = pip_attr.extra_pip_args, - platforms = sorted(platforms), # here we only need keys - python_version = full_version( - version = pip_attr.python_version, - minor_mapping = self._minor_mapping, - ), - logger = logger, - ), + requirements_by_platform = requirements_by_platform, platforms = platforms, extra_pip_args = pip_attr.extra_pip_args, get_index_urls = self._get_index_urls.get(pip_attr.python_version), diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index 356bd4416e..ebde43b312 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -227,7 +227,7 @@ def requirements_files_by_platform( configured_platforms[p] = file elif logger: - logger.warn(lambda: "File {} will be ignored because there are no configured platforms: {}".format( + logger.debug(lambda: "File {} will be ignored because there are no configured platforms: {}".format( file, default_platforms, )) diff --git a/tests/pypi/extension/pip_parse.bzl b/tests/pypi/extension/pip_parse.bzl index 21569cf04e..edac12e344 100644 --- a/tests/pypi/extension/pip_parse.bzl +++ b/tests/pypi/extension/pip_parse.bzl @@ -27,6 +27,7 @@ def pip_parse( requirements_linux = None, requirements_lock = None, requirements_windows = None, + target_platforms = [], simpleapi_skip = [], timeout = 600, whl_modifications = {}, @@ -41,7 +42,9 @@ def pip_parse( envsubst = envsubst, experimental_index_url = experimental_index_url, experimental_requirement_cycles = experimental_requirement_cycles, + # TODO @aignas 2025-12-02: decide on a single attr - should we reuse this? experimental_target_platforms = experimental_target_platforms, + target_platforms = target_platforms, extra_hub_aliases = extra_hub_aliases, extra_pip_args = extra_pip_args, hub_name = hub_name, diff --git a/tests/pypi/hub_builder/hub_builder_tests.bzl b/tests/pypi/hub_builder/hub_builder_tests.bzl index 414ad1250e..ce6bbd8073 100644 --- a/tests/pypi/hub_builder/hub_builder_tests.bzl +++ b/tests/pypi/hub_builder/hub_builder_tests.bzl @@ -25,12 +25,12 @@ load("//tests/pypi/extension:pip_parse.bzl", _parse = "pip_parse") _tests = [] -def _mock_mctx(environ = {}, read = None): +def _mock_mctx(os = "unittest", arch = "exotic", environ = {}, read = None): return struct( os = struct( environ = environ, - name = "unittest", - arch = "exotic", + name = os, + arch = arch, ), read = read or (lambda _: """\ simple==0.0.1 \ @@ -1221,6 +1221,74 @@ optimum[onnxruntime-gpu]==1.17.1 ; sys_platform == 'linux' _tests.append(_test_pipstar_platforms) +def _test_pipstar_platforms_limit(env): + builder = hub_builder( + env, + enable_pipstar = True, + debug = True, + config = struct( + enable_pipstar = True, + netrc = None, + auth_patterns = {}, + platforms = { + "my{}{}".format(os, cpu): _plat( + name = "my{}{}".format(os, cpu), + os_name = os, + arch_name = cpu, + marker = "python_version ~= \"3.13\"", + config_settings = [ + "@platforms//os:{}".format(os), + "@platforms//cpu:{}".format(cpu), + ], + ) + for os, cpu in [ + ("linux", "x86_64"), + ("osx", "aarch64"), + ] + }, + ), + ) + builder.pip_parse( + _mock_mctx( + os = "linux", + arch = "x86_64", + read = lambda x: { + "universal.txt": """\ +optimum[onnxruntime]==1.17.1 ; sys_platform == 'darwin' +optimum[onnxruntime-gpu]==1.17.1 ; sys_platform == 'linux' +""", + }[x], + ), + _parse( + hub_name = "pypi", + python_version = "3.15", + requirements_lock = "universal.txt", + target_platforms = ["my{os}{arch}"], + ), + ) + pypi = builder.build() + + pypi.exposed_packages().contains_exactly(["optimum"]) + pypi.group_map().contains_exactly({}) + pypi.whl_map().contains_exactly({ + "optimum": { + "pypi_315_optimum": [ + whl_config_setting(version = "3.15"), + ], + }, + }) + pypi.whl_libraries().contains_exactly({ + "pypi_315_optimum": { + "config_load": "@pypi//:config.bzl", + "dep_template": "@pypi//{name}:{target}", + "python_interpreter_target": "unit_test_interpreter_target", + "requirement": "optimum[onnxruntime-gpu]==1.17.1", + }, + }) + pypi.extra_aliases().contains_exactly({}) + +_tests.append(_test_pipstar_platforms_limit) + def hub_builder_test_suite(name): """Create the test suite. From 66c6b98f6e22f8826d72b86dfb5ced8b06592725 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 19:39:52 +0900 Subject: [PATCH 02/10] fixup --- python/private/pypi/extension.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index 6d435d174c..fc13188391 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -670,7 +670,7 @@ EXPERIMENTAL: this may be removed without notice. """, ), "target_platforms": attr.string_list( - default = ["{host}"], + default = ["{os}_{arch}"], doc = """\ The list of platforms for which we would evaluate the requirements files. If you need to be able to only evaluate for a particular platform (e.g. "linux_x86_64"), then put it in here. From 159c4323586971b79c269e760adfc48f729a693e Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:16:53 +0900 Subject: [PATCH 03/10] make the diff smaller --- python/private/pypi/hub_builder.bzl | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/python/private/pypi/hub_builder.bzl b/python/private/pypi/hub_builder.bzl index ec60d1f442..6eb4e37fa8 100644 --- a/python/private/pypi/hub_builder.bzl +++ b/python/private/pypi/hub_builder.bzl @@ -413,24 +413,22 @@ def _create_whl_repos( """ logger = self._logger platforms = self._platforms[pip_attr.python_version] - requirements_by_platform = requirements_files_by_platform( - requirements_by_platform = pip_attr.requirements_by_platform, - requirements_linux = pip_attr.requirements_linux, - requirements_lock = pip_attr.requirements_lock, - requirements_osx = pip_attr.requirements_darwin, - requirements_windows = pip_attr.requirements_windows, - extra_pip_args = pip_attr.extra_pip_args, - platforms = sorted(platforms), # here we only need keys - python_version = full_version( - version = pip_attr.python_version, - minor_mapping = self._minor_mapping, - ), - logger = logger, - ) - requirements_by_platform = parse_requirements( module_ctx, - requirements_by_platform = requirements_by_platform, + requirements_by_platform = requirements_files_by_platform( + requirements_by_platform = pip_attr.requirements_by_platform, + requirements_linux = pip_attr.requirements_linux, + requirements_lock = pip_attr.requirements_lock, + requirements_osx = pip_attr.requirements_darwin, + requirements_windows = pip_attr.requirements_windows, + extra_pip_args = pip_attr.extra_pip_args, + platforms = sorted(platforms), # here we only need keys + python_version = full_version( + version = pip_attr.python_version, + minor_mapping = self._minor_mapping, + ), + logger = logger, + ), platforms = platforms, extra_pip_args = pip_attr.extra_pip_args, get_index_urls = self._get_index_urls.get(pip_attr.python_version), From a4298ad00c3a7b49d03943a70bfffc792e8df238 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:24:02 +0900 Subject: [PATCH 04/10] add a better log message and normalize os and arch values --- python/private/pypi/hub_builder.bzl | 6 +++++- python/private/pypi/requirements_files_by_platform.bzl | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/private/pypi/hub_builder.bzl b/python/private/pypi/hub_builder.bzl index 6eb4e37fa8..3a1a3b07fe 100644 --- a/python/private/pypi/hub_builder.bzl +++ b/python/private/pypi/hub_builder.bzl @@ -2,6 +2,7 @@ load("//python/private:full_version.bzl", "full_version") load("//python/private:normalize_name.bzl", "normalize_name") +load("//python/private:repo_utils.bzl", "repo_utils") load("//python/private:version.bzl", "version") load("//python/private:version_label.bzl", "version_label") load(":attrs.bzl", "use_isolated") @@ -314,7 +315,10 @@ def _platforms(module_ctx, *, python_version, config, target_platforms): ) target_platforms = sorted({ - p.format(os = module_ctx.os.name, arch = module_ctx.os.arch): None + p.format( + os = repo_utils.get_platforms_os_name(module_ctx), + arch = repo_utils.get_platforms_cpu_name(module_ctx), + ): None for p in target_platforms }) diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index ebde43b312..d77a4e8ced 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -142,6 +142,7 @@ def requirements_files_by_platform( if logger: logger.debug(lambda: "Platforms from pip args: {}".format(platforms_from_args)) + input_platforms = platforms default_platforms = platforms if platforms_from_args: @@ -227,9 +228,10 @@ def requirements_files_by_platform( configured_platforms[p] = file elif logger: - logger.debug(lambda: "File {} will be ignored because there are no configured platforms: {}".format( + logger.info(lambda: "File {} will be ignored because there are no configured platforms: {} out of {}".format( file, default_platforms, + input_platforms, )) continue From f7ee70f1f6a23bb91144e32cd721963c2d08da23 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:24:48 +0900 Subject: [PATCH 05/10] improve the test --- tests/pypi/hub_builder/hub_builder_tests.bzl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/pypi/hub_builder/hub_builder_tests.bzl b/tests/pypi/hub_builder/hub_builder_tests.bzl index ce6bbd8073..59457b4d89 100644 --- a/tests/pypi/hub_builder/hub_builder_tests.bzl +++ b/tests/pypi/hub_builder/hub_builder_tests.bzl @@ -1225,7 +1225,6 @@ def _test_pipstar_platforms_limit(env): builder = hub_builder( env, enable_pipstar = True, - debug = True, config = struct( enable_pipstar = True, netrc = None, @@ -1251,7 +1250,7 @@ def _test_pipstar_platforms_limit(env): builder.pip_parse( _mock_mctx( os = "linux", - arch = "x86_64", + arch = "amd64", read = lambda x: { "universal.txt": """\ optimum[onnxruntime]==1.17.1 ; sys_platform == 'darwin' From dd3a0f6f371ac9a1ef034018c0d1a0ed5208b976 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:32:43 +0900 Subject: [PATCH 06/10] fixup the example failures --- python/private/pypi/requirements_files_by_platform.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index d77a4e8ced..28556ec175 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -175,6 +175,8 @@ def requirements_files_by_platform( platform for filter_or_platform in specifier.split(",") for platform in (_default_platforms(filter = filter_or_platform, platforms = platforms) if filter_or_platform.endswith("*") else [filter_or_platform]) + # TODO @aignas 2025-12-06: add a test + if platform in input_platforms ] for file, specifier in requirements_by_platform.items() }.items() From aad3290cd3da6a94dbca32532af6df600cf00a53 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:38:31 +0900 Subject: [PATCH 07/10] fix unit tests --- .../pypi/requirements_files_by_platform.bzl | 1 - .../requirements_files_by_platform_tests.bzl | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index 28556ec175..2d5719b321 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -175,7 +175,6 @@ def requirements_files_by_platform( platform for filter_or_platform in specifier.split(",") for platform in (_default_platforms(filter = filter_or_platform, platforms = platforms) if filter_or_platform.endswith("*") else [filter_or_platform]) - # TODO @aignas 2025-12-06: add a test if platform in input_platforms ] for file, specifier in requirements_by_platform.items() diff --git a/tests/pypi/requirements_files_by_platform/requirements_files_by_platform_tests.bzl b/tests/pypi/requirements_files_by_platform/requirements_files_by_platform_tests.bzl index 6688d72ffe..d6aaf3ca99 100644 --- a/tests/pypi/requirements_files_by_platform/requirements_files_by_platform_tests.bzl +++ b/tests/pypi/requirements_files_by_platform/requirements_files_by_platform_tests.bzl @@ -115,6 +115,12 @@ def _test_simple_limited(env): }, platforms = ["linux_x86_64", "osx_x86_64"], ), + requirements_files_by_platform( + requirements_by_platform = { + "requirements_lock": "linux_x86_64,osx_aarch64,osx_x86_64", + }, + platforms = ["linux_x86_64", "osx_x86_64", "windows_x86_64"], + ), ]: env.expect.that_dict(got).contains_exactly({ "requirements_lock": [ @@ -219,6 +225,17 @@ def _test_os_arch_requirements_with_default(env): "requirements_linux": "linux_x86_64,linux_aarch64", }, requirements_lock = "requirements_lock", + platforms = [ + "linux_super_exotic", + "linux_x86_64", + "linux_aarch64", + "linux_arm", + "linux_ppc", + "linux_s390x", + "osx_aarch64", + "osx_x86_64", + "windows_x86_64", + ], ) env.expect.that_dict(got).contains_exactly({ "requirements_exotic": ["linux_super_exotic"], From ac76fdac27f6a1a6ea5097fb23cc1d1da183495e Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:57:49 +0900 Subject: [PATCH 08/10] wip --- python/private/pypi/requirements_files_by_platform.bzl | 4 ++-- tests/pypi/hub_builder/hub_builder_tests.bzl | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index 2d5719b321..a4a3b3750f 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -140,7 +140,7 @@ def requirements_files_by_platform( platforms_from_args = _platforms_from_args(extra_pip_args) if logger: - logger.debug(lambda: "Platforms from pip args: {}".format(platforms_from_args)) + logger.debug(lambda: "Platforms from pip args: {} (from {})".format(platforms_from_args, extra_pip_args)) input_platforms = platforms default_platforms = platforms @@ -175,7 +175,7 @@ def requirements_files_by_platform( platform for filter_or_platform in specifier.split(",") for platform in (_default_platforms(filter = filter_or_platform, platforms = platforms) if filter_or_platform.endswith("*") else [filter_or_platform]) - if platform in input_platforms + if _platform(platform, python_version) in input_platforms ] for file, specifier in requirements_by_platform.items() }.items() diff --git a/tests/pypi/hub_builder/hub_builder_tests.bzl b/tests/pypi/hub_builder/hub_builder_tests.bzl index 59457b4d89..e267f4ca34 100644 --- a/tests/pypi/hub_builder/hub_builder_tests.bzl +++ b/tests/pypi/hub_builder/hub_builder_tests.bzl @@ -723,6 +723,10 @@ simple==0.0.3 \ "requirements.linux_x86_64.txt": "linux_x86_64", "requirements.osx_aarch64.txt": "osx_aarch64", }, + target_platforms = [ + "linux_x86_64", + "osx_aarch64", + ], ), ) pypi = builder.build() From 72d7627e2feea9f2c0fa87ff9522cba96a5897d4 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Sat, 6 Dec 2025 22:08:21 +0900 Subject: [PATCH 09/10] fixup --- python/private/pypi/requirements_files_by_platform.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/private/pypi/requirements_files_by_platform.bzl b/python/private/pypi/requirements_files_by_platform.bzl index a4a3b3750f..2027b41594 100644 --- a/python/private/pypi/requirements_files_by_platform.bzl +++ b/python/private/pypi/requirements_files_by_platform.bzl @@ -143,7 +143,7 @@ def requirements_files_by_platform( logger.debug(lambda: "Platforms from pip args: {} (from {})".format(platforms_from_args, extra_pip_args)) input_platforms = platforms - default_platforms = platforms + default_platforms = [_platform(p, python_version) for p in platforms] if platforms_from_args: lock_files = [ @@ -175,7 +175,7 @@ def requirements_files_by_platform( platform for filter_or_platform in specifier.split(",") for platform in (_default_platforms(filter = filter_or_platform, platforms = platforms) if filter_or_platform.endswith("*") else [filter_or_platform]) - if _platform(platform, python_version) in input_platforms + if _platform(platform, python_version) in default_platforms ] for file, specifier in requirements_by_platform.items() }.items() From fdd031a517ae08d22cd511d1dc45d9e82d9f25fe Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sat, 6 Dec 2025 16:02:01 -0800 Subject: [PATCH 10/10] use include directive for experimental api doc --- python/private/pypi/extension.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index fc13188391..eaa6c0d428 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -682,7 +682,8 @@ function in general are the same as used in the {obj}`pip.default.platform` attr If you only care for the host platform and do not have a usecase to cross-build, then you can put in a string `"{os}_{arch}"` as the value here. You could also use `"{os}_{arch}_freethreaded"` as well. -EXPERIMENTAL: this may be removed without notice. +:::{include} /_includes/experimental_api.md +::: :::{versionadded} VERSION_NEXT_FEATURE :::