Skip to content

Unable to specify base_url in python.toolchain() when using bzlmodΒ #1172

@vadikmironov

Description

@vadikmironov

🐞 bug report

Affected Rule

The issue is caused by the rule: python:extensions.bzl

Is this a regression?

Yes, the previous version in which this bug was not present was: works fine without bzlmod

Description

While trying to prepare my test repo for bzlmod switch, I've noticed that it seems to be no longer possible to override base_url location for python toolchains. This is a super useful feature for someone working behind a corporate firewall and maintaining a mirror of python-build-standalone artefacts.

πŸ”¬ Minimal Reproduction

Following example is perfectly valid when using WORKSPACE.bazel:

load("@rules_python//python:repositories.bzl", "python_register_toolchains")
python_register_toolchains(
    name = "python3_8_13",
    python_version = "3.8",
    base_url = "https://github.com/indygreg/python-build-standalone/releases/download",
)

but when defining a toolchain in bzlmod, there is simply no parameter to pass base_url value:

python = use_extension("@rules_python//python:extensions.bzl", "python")
python.toolchain(
    name = "python3_8_13",
    python_version = "3.8",
)

πŸ”₯ Exception or Error



None

🌍 Your Environment

Operating System:

  
Linux
  

Output of bazel version:

  
Bazelisk version: v1.16.0
Build label: 6.1.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Mar 15 15:44:56 2023 (1678895096)
Build timestamp: 1678895096
Build timestamp as int: 1678895096
  

Rules_python version:

  
bazel_dep(name = "rules_python", version = "0.20.0")
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions