Skip to content

Regression in generate whl BUILD in 1.4.0-rc0 and later #2835

@emirisman

Description

@emirisman

🐞 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

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",
),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: pippip/pypi integration

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy