[Bug]: [email protected] 'python/extensions' is not a package
What happened?
I ran the following command: bazel run --enable_bzlmod //python:main and got the following error:
Error loading '@rules_python~0.21.0//python/extensions:python.bzl' for module extensions, requested by <root>/MODULE.bazel:6:23: Label '@rules_python~0.21.0//python/extensions:python.bzl' is invalid because 'python/extensions' is not a package; perhaps you meant to put the colon here: '@rules_python~0.21.0//python:extensions/python.bzl'?: Label '@rules_python~0.21.0//python/extensions:python.bzl' is invalid because 'python/extensions' is not a package; perhaps you meant to put the colon here: '@rules_python~0.21.0//python:extensions/python.bzl'?
Version
Development (host) and target OS/architectures:
OSX aarch64
Output of bazel --version:
bazel 6.2.0
Version of relevant rules from the WORKSPACE or MODULE.bazel file:
Language(s) and/or frameworks involved:
Python
How to reproduce
In MODULE.bazel:
bazel_dep(name = "rules_python", version = "0.21.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
name = "python3_10",
configure_coverage_tool = True,
python_version = "3.10",
)
use_repo(python, "python3_10")
use_repo(python, "python3_10_toolchains")
register_toolchains(
"@python3_10_toolchains//:all",
)
The extension usage changed with https://github.com/bazelbuild/rules_python/commit/46537cf32f8bf722a6be805821cb2ee17d7b936a, but that change hasn't been released yet.
@rickeylev @chrislovecnm
anything I can do to help?
FYI 0.24.0 of rules_python has been released so bumping to that version should resolve this issue. Note the extension API change though!