fix: make executable implicit defaults public so other modules can use rule builders (#3919) - #3970
Merged
aignas merged 2 commits intoJul 30, 2026
Conversation
…e rule builders (bazel-contrib#3919) `create_executable_rule_builder()` (used by `py_binary_rule_builder()` / `py_test_rule_builder()`, the public `python/api/executables.bzl` API) bundles three implicit attrs whose defaults point at private targets under `//python/private`: `build_data_writer`, `debugger_if_target_config`, and `uncachable_version_file`. These targets had no explicit visibility, so they inherited the package's `default_visibility` (`//:__subpackages__`), which only covers packages inside the rules_python repo itself. Because the builder API is designed to let external modules call `rule()` themselves (via `builder.build()`), Bazel checks visibility of these attr defaults from the *calling* module's package, not from rules_python's. Any external repo constructing a rule via `py_binary_rule_builder()` / `py_test_rule_builder()` therefore fails at analysis time with a visibility error. This has been broken since the builder API's introduction; there's prior art in this same file for exactly this situation (e.g. `stage1_bootstrap_template`, among others) Co-authored-by: Richard Levasseur <richardlev@gmail.com> (cherry picked from commit 19ffd21)
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
aignas
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports #3919 to
release/1.9(requested by @aignas / @rickeylev).create_executable_rule_builder()(used bypy_binary_rule_builder()/py_test_rule_builder(), the publicpython/api/executables.bzlAPI)bundles three implicit attrs whose defaults point at private targets under
//python/private. These had no explicit visibility, so any externalmodule constructing a rule via the builder API failed at analysis time
with a visibility error.
Commits:
fix: make executable implicit defaults public ... (#3919)— cherry-pickof
19ffd215, unchanged from main.Release 1.9.2: Update changelog— finalizes the changelog entry(
release/1.9doesn't carry thenews/fragment infra main uses, so thefragment is folded into
CHANGELOG.mddirectly, matching feat(toolchains): backport 20260325/20260414 Python toolchains for 2.0.2 (#3708) #3775/feat(toolchains): backport 20260325/20260414 Python toolchains for 1.9.1 (#3708) #3776/build: release 2.0.3 #3819).Fixes #3919 on
1.9.x.