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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ END_UNRELEASED_TEMPLATE
to the package path. This is enabled via the
`# gazelle:experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
* (gazelle) Types for exposed members of `python.ParserOutput` are now all public.
* (gazelle) Remove entry point file requirements when generating rules.

{#v0-0-0-fixed}
### Fixed
Expand Down
2 changes: 0 additions & 2 deletions gazelle/python/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateRes
if parent != nil && parent.CoarseGrainedGeneration() {
return language.GenerateResult{}
}
} else if !hasEntrypointFile(args.Dir) {
return language.GenerateResult{}
}
}

Expand Down
1 change: 1 addition & 0 deletions gazelle/python/testdata/subdir_sources/BUILD.in
Original file line number Diff line number Diff line change
@@ -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.

3 changes: 3 additions & 0 deletions gazelle/python/testdata/subdir_sources/BUILD.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

load("@rules_python//python:defs.bzl", "py_binary")

# gazelle:python_generation_mode project

py_binary(
name = "subdir_sources_bin",
srcs = ["__main__.py"],
Expand Down