Skip to content

chore: warn on implicit __init__.py creation#3841

Open
rickeylev wants to merge 4 commits into
bazel-contrib:mainfrom
rickeylev:warn-implicit-init-py
Open

chore: warn on implicit __init__.py creation#3841
rickeylev wants to merge 4 commits into
bazel-contrib:mainfrom
rickeylev:warn-implicit-init-py

Conversation

@rickeylev

@rickeylev rickeylev commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Implicit __init__.py creation is deprecated and will be disabled by default in a future release. We need to warn users when their targets rely on this behavior so they can transition to explicit __init__.py files before the default changes and their builds break.

Work towards #2945

Warn users when targets rely on deprecated implicit __init__.py creation
to encourage migration to explicit inits.

We add a formatted multiline warning block inside the execution path
of `_should_create_init_files(ctx)` in `py_executable.bzl`. The warning
identifies the offending target by label and provides instructions on
how to explicitly create inits or disable the warning.
Add a changelog news entry for the newly introduced deprecation
warning on implicit __init__.py creation.
Clarify in the warning message that implicit __init__.py creation
will be disabled by default (rather than completely removed) in a
future release.
@rickeylev rickeylev requested a review from aignas as a code owner June 21, 2026 06:14

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deprecation warning for targets relying on implicit __init__.py creation. The review feedback suggests using more professional language by replacing the word "diabolic" and recommends condensing the multi-line warning message into a single line to prevent excessive console noise in large workspaces.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/private/py_executable.bzl
@rickeylev rickeylev changed the title feat(binaries/tests): warn on implicit __init__.py creation chore: warn on implicit __init__.py creation Jun 21, 2026
@rickeylev rickeylev enabled auto-merge June 21, 2026 06:20
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.

1 participant