-
-
Notifications
You must be signed in to change notification settings - Fork 645
Description
🐞 bug report
Affected Rule
The error is in pypi module extension when using the override tag class. See attached patch for location.
The issue is caused by the rule:Non-root modules are failing to load.
Is this a regression?
This has never worked since the introduction of bzlmod.
Description
I have a Bazel module that I use in two different setup, where it in the first scenario acts as the root module and in the second scenario it is exported and used as a non-root module. The module is using rules_python and needs to apply a pip patch using the override tag class. However, in the current implementation, rules_python does not allow any calls to override when non-root, leading to a failure. Since there is no support for selects of if-cases within the MODULE.bazel file, this behavior prevents the second setup described above.
It would be beneficial if rules_python would trigger a warning instead of failing, to support the above use cases.
🔬 Minimal Reproduction
Add the following code to a non root module:
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.override()
🔥 Exception or Error
The module extension calls: fail("overrides are only supported in root modules")
🌍 Your Environment
Ubuntu 22.04
Bazel 8.0.0
rules_python 1.0.0
non_root_override.patch.txt