-
-
Notifications
You must be signed in to change notification settings - Fork 677
Closed
Labels
Description
🐞 bug report
Affected Rule
python.toolchain
Is this a regression?
Exists as far back as 0.25.0, not sure before that.
Description
If an intermediate module registers the same python version as rules_python's default, then it prevents a default toolchain from being identified.
🔬 Minimal Reproduction
The basic repro is to have an earlier module register the same version as what rules_python sets as the default.
# root MODULE
bazel_dep(name="rules_python")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
# Two must be registered; one is always treated as is_default=True
python.toolchain(python_version="3.11", is_default=False)
python.toolchain(python_version="3.10", is_default=False)
# rules_python MODULE
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version="3.11", is_default=True)
The error/output is:
... python/extensions/python.bzl:44:10: WARNING: Ignoring toolchain 'python_3_11' from module 'rules_python': Toolchain 'python_3_11' from module 'middle' already registered Python version 3.11 and has precedence
ERROR: Traceback (most recent call last):
File ".../python/extensions/python.bzl", line 140, column 13, in _python_impl
fail("No default Python toolchain configured. Is rules_python missing `is_default=True`?")
Anything else relevant?
Blocking rules_proto_grpc getting onto bcr, but also would affect other intermediate modules
Reactions are currently unavailable