You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can we add a python directive to tell gazelle to avoid adding visibility annotations? #2953
I have a library which I want to make public since it's a base library for many other parts of the codebase. Therefore I set the visibility to public for the whole file:
Running gazelle however incorrectly adds a more restrictive visibility annotation, transforming the BUILD file to:
load("@aspect_rules_py//py:defs.bzl", "py_library")
package(default_visibility = ["//visibility:public"])
py_library(
name = "cli",
srcs = ["cli.py"],
visibility = ["//:__subpackages__"], # <---- This should not be added, right?
)
The added visibility is incorrect, as it overwrite the default visibility set at the package level.
Is there a way to fix this behavior, or at least provide a gazelle directive (at the root level) to tell gazelle to not add a visibility field to python targets?
Activity
aignas commentedon Jun 5, 2025
Does the documentation here help you? https://github.com/bazel-contrib/rules_python/tree/main/gazelle#directive-python_default_visibility