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 2 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.

@@ -1 +1,2 @@
# gazelle:resolve py resolved_package //package2:resolved_package
# gazelle:python_generation_mode project
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why were these directives needed to be added?

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.

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