Skip to content

fix: make executable implicit defaults public so other modules can use rule builders (#3919) - #3970

Merged
aignas merged 2 commits into
bazel-contrib:release/1.9from
chicagotrading:backport-3919-release-1.9
Jul 30, 2026
Merged

fix: make executable implicit defaults public so other modules can use rule builders (#3919)#3970
aignas merged 2 commits into
bazel-contrib:release/1.9from
chicagotrading:backport-3919-release-1.9

Conversation

@13steinj

Copy link
Copy Markdown
Contributor

Backports #3919 to release/1.9 (requested by @aignas / @rickeylev).

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. These had no explicit visibility, so any external
module constructing a rule via the builder API failed at analysis time
with a visibility error.

Commits:

Fixes #3919 on 1.9.x.

13steinj and others added 2 commits July 28, 2026 16:42
…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)
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@aignas
aignas merged commit 99858c5 into bazel-contrib:release/1.9 Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants