Skip to content

Commit ef06820

Browse files
committed
chore: use python.defaults to set rules_python default python version
python.defaults is the modern way to set the default. Setting it this way also helps avoid a bug where if a root module has a single `python.toolchain()` call (which are implicitly treated as `is_default=True`) and also sets the default using `python.defaults()`, some validation logic gives an error about using both ways to set a default.
1 parent 726ffa2 commit ef06820

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MODULE.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ use_repo(
3737
# We need to do another use_extension call to expose the "pythons_hub"
3838
# repo.
3939
python = use_extension("//python/extensions:python.bzl", "python")
40+
python.defaults(
41+
python_version = "3.11",
42+
)
4043

4144
# The default toolchain to use if nobody configures a toolchain.
4245
# NOTE: This is not a stable version. It is provided for convenience, but will
4346
# change frequently to track the most recent Python version.
4447
# NOTE: The root module can override this.
4548
python.toolchain(
46-
is_default = True,
4749
python_version = "3.11",
4850
)
4951
use_repo(

0 commit comments

Comments
 (0)