File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,7 @@ local_runtime_repo = use_repo_rule(
358358local_runtime_toolchains_repo = use_repo_rule(
359359 " @rules_python//python/local_toolchains:repos.bzl"
360360 " local_runtime_toolchains_repo"
361+ dev_dependency = True ,
361362)
362363
363364# Step 1: Define the Python runtime
@@ -374,12 +375,21 @@ local_runtime_toolchains_repo(
374375)
375376
376377# Step 3: Register the toolchains
377- register_toolchains(" @local_toolchains//:all" )
378+ register_toolchains(" @local_toolchains//:all" , dev_dependency = True )
378379```
379380
380381Note that ` register_toolchains ` will insert the local toolchain earlier in the
381382toolchain ordering, so it will take precedence over other registered toolchains.
382383
384+ :::{important}
385+ Be sure to set ` dev_dependency = True ` . Using a local toolchain only makes sense
386+ for the root module.
387+
388+ If an intermediate module does it, then the ` register_toolchains() ` call will
389+ take precedence over the default rules_python toolchains and cause problems for
390+ downstream modules.
391+ :::
392+
383393Multiple runtimes and/or toolchains can be defined, which allows for multiple
384394Python versions and/or platforms to be configured in a single ` MODULE.bazel ` .
385395
You can’t perform that action at this time.
0 commit comments