Loading rules_python should not depend on known python versions
#3,633 建立於 2026年2月23日
倉庫指標
- Star
- (679 star)
- PR 合併指標
- (PR 指標待抓取)
描述
🐞 bug report
Affected Rule
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
Loading python seems to check the system python version. This makes it impossible to use rules_python if the version is not in its version dict:
File "$BUILD/external/rules_python+/python/private/python_register_toolchains.bzl", line 106, column 31, in python_register_toolchains
sha256 = tool_versions[python_version]["sha256"].get(platform, None)
Error: key "3.14.0b2" not found in dictionary
ERROR: Analysis of target '@@rules_python+//python/bin:repl' failed; build aborted:
error evaluating module extension @@rules_python+//python/extensions:python.bzl%python
Note that this happens when loading the python extension, which is required to configure the python version, creating a catch 22.
Is this a regression?
I have found other occurrences (1,2) of the error message (as below) but I don't think it was traced to this before. It it likely a regression that happens every now and then when some python version gets a weird id and due to the hard coded map of versions in rules_python.
Description
Nothing that depends on rules_python builds. Simplest example
bazel run @rules_python//python/bin:repl
🔬 Minimal Reproduction
This depends on your system python, so it may be best to reproduce in a container. I am running Manjaro with python up to date. The exact python version is 3.14.2 (main, Jan 2 2026, 14:27:39) [GCC 15.2.1 20251112].
Relevant package information (from pacman -Qi python):
Here's my entire python MODULE.bazel setup section (tried older versions of rules_python as well):
🔥 Exception or Error
The expectation would be that the unknown python version is ignored as long as a valid python version is configured via python.toolchain(version=$KNOWN_VERSION}). Whatever else depends on the system python version before is quite likely an isolation failure wrt. reproducibility.
🌍 Your Environment
Operating System: Linux $HOSTNAME 6.18.8-1-MANJARO #1 SMP PREEMPT_DYNAMIC Fri, 30 Jan 2026 23:06:21 +0000 x86_64 GNU/Linux
Output of bazel version:
bazel 8.5.1
Confirmed on 9.0.0 as well
Rules_python version: 1.9.0-rc0, 1.84.0
Anything else relevant?