-
-
Notifications
You must be signed in to change notification settings - Fork 610
Labels
type: pippip/pypi integrationpip/pypi integration
Description
🐞 bug report
Affected Rule
generate_whl_library_build_bazel
Is this a regression?
Yes, the exact same configuration works in rules_python 1.3.0.
Description
The whl library BUILD generation has broken templating in rules_python 1.4.0-rc0 and later, leading to templating such as:
external/pip/aiocsv/BUILD.bazel:5:12: error loading package '@@pip_aiocsv//': Unable to find package for @@pip_//:config.bzl: The repository '@@pip_' could not be resolved: Repository '@@pip_' is not defined. and referenced by '@@pip//aiocsv:whl'
Resulting BUILD file:
load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets_from_requires")
load("@pip_//:config.bzl", "target_platforms")
...
notice the templating error at second load
🔬 Minimal Reproduction
Bazel 7.6.1, bzlmod enabled, but rules_python still used via WORKSPACE.
🔥 Exception or Error
external/pip/aiocsv/BUILD.bazel:5:12: error loading package '@@pip_aiocsv//': Unable to find package for @@pip_//:config.bzl: The repository '@@pip_' could not be resolved: Repository '@@pip_' is not defined. and referenced by '@@pip//aiocsv:whl'
🌍 Your Environment
Operating System:
observed both on macOS and Linux
Output of bazel version
:
Bazelisk version: 1.26.0
Build label: 7.6.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Mar 31 17:11:07 2025 (1743441067)
Build timestamp: 1743441067
Build timestamp as int: 1743441067
Rules_python version:
1.4.0-rc0 and later
Anything else relevant?
Looks like this was introduced in #2781
rules_python/python/private/pypi/generate_whl_library_build_bazel.bzl
Lines 62 to 72 in 9e613d5
loads = [ | |
"""load("@rules_python//python/private/pypi:whl_library_targets.bzl", "whl_library_targets_from_requires")""", | |
] | |
if not kwargs.setdefault("target_platforms", None): | |
dep_template = kwargs["dep_template"] | |
loads.append( | |
"load(\"{}\", \"{}\")".format( | |
dep_template.format(name = "", target = "config.bzl"), | |
"target_platforms", | |
), | |
) |
maximzubkovmaximzubkovmaximzubkov
Metadata
Metadata
Assignees
Labels
type: pippip/pypi integrationpip/pypi integration