Skip to content

feat(gazelle) Remove entry point file requirements when generating rules #2998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yushan26
Copy link
Contributor

@yushan26 yushan26 commented Jun 16, 2025

Remove entry point file requirements when generating rules. Enable python rule generation as long as there are .py source files under the directory so all new packages will have python rules generated in the package.

The extension used to require entrypoints for generation but:

The entry point for libraries (__init__.py ) shouldn't be required either, especially for Python 3.3 and after when namespace packages are supported.

@yushan26 yushan26 changed the title (gazelle) Remove entrypoint file requirements when generating rules feat(gazelle) Remove entry point file requirements when generating rules Jun 16, 2025
Copy link
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.

Dang, now I'll have to use some other method to enforce people to have __init__.py files 🤣

But yeah I'm fine with this. I'm curious as to why the generation_mode project directives were added though.

Copy link
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 note to CHANGELOG.md, as some people (like me!) might rely on the fact that a BUILD.bazel wasn't generated if an __init__.py file wasn't present.

@yushan26 yushan26 force-pushed the always-gen-buildfile branch from 852d647 to 3ae39ee Compare June 23, 2025 17:54
@yushan26 yushan26 requested a review from rickeylev as a code owner June 23, 2025 17:54
@@ -0,0 +1 @@
# gazelle:python_generation_mode project
Copy link
Contributor Author

@yushan26 yushan26 Jun 24, 2025

Choose a reason for hiding this comment

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

This is an existing test that is testing if subdirectory srcs gets added to a py_library target. Subdirectory sources will only be added to a py_library target in project mode.

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.

3 participants