From 5cd32ad47b0383147f84578b5c8880fc26647540 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Mon, 12 Feb 2024 19:29:42 -0800 Subject: [PATCH] feat: enable rules_python Starlark implemention by default for Bazel 7+ (#1699) This makes the base rules use the Starlark code in rules_python ("pystar") instead of what is built into Bazel 7. The pystar implementation can be disabled by setting `RULES_PYTHON_ENABLE_PYSTAR=0` in your environment or using `--action_env`. Earlier versions of Bazel continue to use the rules built into Bazel regardless (the new implementation requires special APIs that only Bazel 7 has). Work towards https://github.com/bazelbuild/rules_python/issues/1069 --- CHANGELOG.md | 6 ++++++ python/private/internal_config_repo.bzl | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebfeaddc0e..234e2e2d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,12 @@ A brief description of the categories of changes: ### Changed +* For Bazel 7, the core rules and providers are now implemented in rules_python + directly and the rules bundled with Bazel are not used. Bazel 6 and earlier + continue to use the Bazel builtin symbols. Of particular note, this means, + under Bazel 7, the builtin global symbol `PyInfo` is **not** the same as what + is loaded from rules_python. The same is true of `PyRuntimeInfo`. + * (toolchains) Windows hosts always ignore pyc files in the downloaded runtimes. This fixes issues due to pyc files being created at runtime and affecting the definition of what files were considered part of the runtime. diff --git a/python/private/internal_config_repo.bzl b/python/private/internal_config_repo.bzl index 282eb0b10a..7be34aef8f 100644 --- a/python/private/internal_config_repo.bzl +++ b/python/private/internal_config_repo.bzl @@ -19,7 +19,7 @@ settings for rules to later use. """ _ENABLE_PYSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PYSTAR" -_ENABLE_PYSTAR_DEFAULT = "0" +_ENABLE_PYSTAR_DEFAULT = "1" _CONFIG_TEMPLATE = """\ config = struct(