Skip to content

fix(gazelle): handle auto-included __init__.py when generating py_binary targets.#3730

Merged
dougthor42 merged 1 commit intobazel-contrib:mainfrom
jvolkman:main
Apr 23, 2026
Merged

fix(gazelle): handle auto-included __init__.py when generating py_binary targets.#3730
dougthor42 merged 1 commit intobazel-contrib:mainfrom
jvolkman:main

Conversation

@jvolkman
Copy link
Copy Markdown
Contributor

Fixes binary target generation when using per-file mode and automatically
including init.py files.

Fixes #3729

Copy link
Copy Markdown
Contributor

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

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 updates the Python Gazelle plugin to include __init__.py files in py_binary targets when per_file_generation_mode is active and per_file_include_init is enabled. It refactors the binary target creation to use a builder pattern for conditional source inclusion. Feedback suggests guarding the calculation of the autoIncludeInit flag with a check for per-file generation mode to avoid unnecessary file system operations in package-level generation mode.

Comment thread gazelle/python/generate.go Outdated
Comment thread gazelle/python/generate.go Outdated
Copy link
Copy Markdown
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

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

Oh, and please add a line to CHANGELOG.md

@jvolkman jvolkman requested a review from rickeylev as a code owner April 23, 2026 20:38
@jvolkman jvolkman changed the title fix[gazelle]: handle auto-included __init__.py when generating py_binary targets. fix(gazelle): handle auto-included __init__.py when generating py_binary targets. Apr 23, 2026
@dougthor42 dougthor42 added this pull request to the merge queue Apr 23, 2026
Merged via the queue into bazel-contrib:main with commit 8633255 Apr 23, 2026
4 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.

Gazelle: conflict with per-file generation, python_generation_mode_per_file_include_init, and py_binary targets

2 participants