-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rules_python broken with Bazel 8 on BCR #2361
Comments
I will try to make it easier to set up the environment for reproducing BCR presubmit failures. But for now, yes, you need to run rules_python/.bcr/presubmit.yml Lines 15 to 16 in 7c5e7cf
|
Luckily, it doesn't look specific to BCR. In rules_python from head:
Will result in the same error as reported. |
tldr: I think we need to change our bzlmod example to not restrict python versions. Restricting the versions is tenenable with a small constrained dep footprint, but the example isn't that. So in the bzlmod example, we intentionally restrict the python versions available to 3.9, 3.10, and 3.11. This is mostly just for demonstration purposes of this version-restriction feature. The examples works with bazel 7, but fails under bazel 8. So, this would imply there's a bug with bazel 7 that got fixed in bazel 8. But...that seems like a weird bug -- failing to traverse the module graph? That would be hard to go unnoticed. Hm, it looks like different modules are being used under bazel7 vs bazel 8 Modules and py versions that python.toolchain sees Bazel 8:
Bazel 7:
Huh. Weird. example_bzlmod is the root module. other_module is one setup for the test. It's almost as if Bazel 7 was only looking at...things defined in the example's module file? and bazel 8 is now (what appears to be properly) traversing the module graph. Looking at If I bump the protobuf version, I bet it'll fail in 7.x...ah yup. |
Yeah, it might be module updates in https://cs.opensource.google/bazel/bazel/+/master:src/MODULE.tools. We had to include some new modules to support auto load |
As a side note, I'm thinking the restriction logic we have in the module-phase is overly-eager about its enforcement. The intent is to allow the root module to prevent certain python versions from being used, but I don't think e.g. python 3.8 is actually being used in the build. It's just that e.g. protobuf needs to register something for 3.8 just in case it is used. Instead of failing at the most phase, we could probably let it fail later, at the build phase -- e.g. don't register a 3.8 toolchain, or register a failing toolchain for 3.8, or something like that. |
Under Bazel 8, the bzlmod example is failing because newer versions of some dependencies request Python 3.8 to be available. To fix, just comment out the restriction in the example. The example has a somewhat large dependency footprint, so enforcing this restriction seems untenable. The config is left commented out so users can discover the feature. Fixes #2361 Fixes bazelbuild/bazel-central-registry#3056
🐞 bug report
Affected Rule
Unclear, looks like early module-phase startup code
Is this a regression?
Yes, works in 7.x
Description
🔬 Minimal Reproduction
Unclear, maybe running the bzlmod example under bazel 8?
The text was updated successfully, but these errors were encountered: