Open mikn opened 1 day ago
I do remember a discussion somewhere in the early days of bzlmod
that the compatibility_level
bumping is super painful but I definitely don't have a reference anymore. @Wyverald, do you have any recommendation how rules_python
should resolve this?
e.g. is a retroactive backfill of the bumped compatibility_level
after we release a new version with a bumped level would be something that cannot be done? I assume we might be able to pull it off by applying extra patches to the MODULE.bazel
metadata in the registry.
Affected Rule
https://registry.bazel.build/modules/grpc (probably more)
The issue appears in the pip module extension (
@rules_python//python/extensions:pip.bzl
), specifically renaming thename
tag tohub_name
without incrementing the rules_python module compatibility level from 1 to 2.Is this a regression?
Yes - rules_python didn't increment its compatibility_level when introducing a breaking change from
name
tohub_name
in the pip extension, causing issues with transitive dependencies that use the older API.Description
The core issue is that rules_python made a breaking API change (changing
name
tohub_name
in the pip extension) without incrementing the compatibility_level parameter from 1 (set in version 0.22) to 2. This causes problems in dependency chains where:hub_name
)name
This manifests as an error when running
bazel mod tidy
:🔬 Minimal Reproduction
Here's a minimal reproduction case demonstrating the compatibility level issue:
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") pip.parse( hub_name = "pypi", # New API python_version = "3.11", requirements_lock = "//python:requirements.txt", ) use_repo(pip, "pypi")
bazel mod tidy ERROR: in tag at https://bcr.bazel.build/modules/protoc-gen-validate/1.0.4/MODULE.bazel:64:10, unknown attribute name provided. Type 'bazel help mod' for syntax and help.
Linux (amd64)
bazel 7.4.1
1.0.0-rc2
The proper fix would be to increment the compatibility_level parameter in rules_python. This would prevent Bazel from attempting to mix incompatible versions of the rules in a single build.