feat: Make __init__.py generation configurable module-wide - #3997
Open
armandomontanez wants to merge 1 commit into
Open
feat: Make __init__.py generation configurable module-wide#3997armandomontanez wants to merge 1 commit into
armandomontanez wants to merge 1 commit into
Conversation
armandomontanez
force-pushed
the
legacy-init-migration-configurator
branch
2 times, most recently
from
August 3, 2026 23:57
52ca889 to
b98502f
Compare
In bazel-contrib#3841, a warning pushing users to migrate away from implicit `__init__.py` generation was added. While this is very nice to have, it forces users to either explicitly configure this option on every `py_binary` and `py_test` target, or configure the option globally in their `.bazelrc`. To better facilitate a migration, this change introduces a mechanism for modules to configure this option module-wide. This has multiple benefits: 1. Everyone working in the module doesn't need to remember to explicitly set `legacy_create_init` on every target. 2. Everyone that depends on the module receives the correct behavior as configured by the module. 3. It becomes possible to tell BCR-wide which modules have adopted this migration. Work towards bazel-contrib#2945
armandomontanez
force-pushed
the
legacy-init-migration-configurator
branch
from
August 4, 2026 00:01
b98502f to
117b6cb
Compare
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.
In #3841, a warning pushing users to migrate away from implicit
__init__.pygeneration was added. While it's good to flag this bad behavior, silencing it requires users to either explicitly configure this option on everypy_binaryandpy_testtarget, or configure the option globally in their.bazelrc.To better facilitate a migration, this change introduces a mechanism for modules to configure this option module-wide. This has multiple benefits:
legacy_create_initon every target.Work towards #2945