diff options
author | Richard Levasseur <rlevasseur@google.com> | 2023-06-12 07:52:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-12 14:52:01 +0000 |
commit | 2c28e61232cd77c25d1eb09cf63283f62b942558 (patch) | |
tree | 234196b6dbe4d8ed6bcaeda806b7247354a959d1 /BZLMOD_SUPPORT.md | |
parent | 1f58f4c9fb5a5f17f35482b0ec7f8bc5448afb59 (diff) | |
download | bazelbuild-rules_python-2c28e61232cd77c25d1eb09cf63283f62b942558.tar.gz |
feat(bzlmod): Register a default toolchain (#1259)upstream/0.23.0
This makes rules_python always provide a default toolchain when using
bzlmod.
Note that, unlike workspace builds, the default is not the local
system Python (`@bazel_tools//tools/python:autodetecting_toolchain`).
Instead, the default is a hermetic runtime, but no guarantees are made
about the particular version used. In practice, it will be the latest
available Python version.
Work towards #1233
Diffstat (limited to 'BZLMOD_SUPPORT.md')
-rw-r--r-- | BZLMOD_SUPPORT.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/BZLMOD_SUPPORT.md b/BZLMOD_SUPPORT.md index 8efd0df..dbe5238 100644 --- a/BZLMOD_SUPPORT.md +++ b/BZLMOD_SUPPORT.md @@ -35,3 +35,27 @@ This rule set does not have full feature partity with the older `WORKSPACE` type 2. Gazelle does not support finding deps in sub-modules. For instance we can have a dep like ` "@our_other_module//other_module/pkg:lib",` in a `py_test` definition. Check ["issues"](/bazelbuild/rules_python/issues) for an up to date list. + +## Differences in behavior from WORKSPACE + +### Default toolchain is not the local system Python + +Under bzlmod, the default toolchain is no longer based on the locally installed +system Python. Instead, a recent Python version using the pre-built, +standalone runtimes are used. + +If you need the local system Python to be your toolchain, then it's suggested +that you setup and configure your own toolchain and register it. Note that using +the local system's Python is not advised because will vary between users and +platforms. + +If you want to use the same toolchain as what WORKSPACE used, then manually +register the builtin Bazel Python toolchain by doing +`register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain")`. +**IMPORTANT: this should only be done in a root module, and may intefere with +the toolchains rules_python registers**. + +NOTE: Regardless of your toolchain, due to +[#691](https://github.com/bazelbuild/rules_python/issues/691), `rules_python` +still relies on a local Python being available to bootstrap the program before +handing over execution to the toolchain Python. |