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
How would we support such injection? The above example is a linux var style, but we could also do %s formatting or {{ python_root }} templating or something else.
Or we could just say "Do it yourself, users!":
# Example of users injecting python_root# gazelle:default_visibility //src:__pkg__,//bar:__pkg__,//src/foo:__subpackages
Open Question 2: Specific to just python?
I see 3 paths forward:
Add onlydefault_visibility
Same as the core bazel-gazelle project, affects all targets.
Add onlypython_default_visibility
Only affects py_* targets.
Add bothdefault_visibility and python_default_visibility.
allows more customization and would be beneficial for multi-language projects, but is more complex for both gazelle code and user BUILD files.
python_default_visibility overrides default_visibility for py_* targets
Which should we strive for?
Open Question 3: Should the current default be kept?
Should the current default visivility be kept as fmt.Sprintf("//%s:__subpackages__", pythonProjectRoot)?
If not, what should it change to?
Open Question 4: Support for "clearing/resetting" visibility?
Do we want to add the ability to clear/reset visibility? Perhaps by supporting special labels NONE and DEFAULT?
Example:
# No directive set, use the default. Assuming that python_root is unset.py_library(
visibility= ["//:__subpackages__"],
)
# Set default vis.# gazelle:default_visibility //src:__pkg__py_library(
visibility= ["//src:__pkg__"],
)
go_library(
visibility= ["//src:__pkg__"],
)
# python_default_visibility overrides default_visibility for py_* targets only# gazelle:python_default_visibility //foo:bar,//tests:bazpy_library(
visibility= [
"//foo:bar",
"//tests:baz",
],
)
go_library(
visibility= ["//src:__pkg__"],
)
# Here's the "reset"# gazelle:python_default_visibility DEFAULTpy_library(
visibility= ["//:__subpackages__"],
)
# gazelle:python_default_visibility NONEpy_library(
visibility= [], # in reality, this attribute would just be missing altogether
)
Describe alternatives you've considered
N/A
The text was updated successfully, but these errors were encountered:
🚀 feature request
Relevant Rules
Description
Python's gazelle doesn't currently support the
default_visibility
directive - it's hard-coded asrules_python/gazelle/python/generate.go
Line 215 in 3f40e98
If you try and use it, you get this error:
Support for such should be added.
Describe the solution you'd like
Implement
default_visibility
🙃. The same as how build-gazelle defines it:There are 4 questions that I've been able to come up with. I elaborate on them below.
python_root
?Open Question 1: How to handle
python_root
?rules_python
's gazelle supports thepython_root
directive, which modifies the default visibility:rules_python/gazelle/python/generate.go
Line 215 in 3f40e98
Do we want to support users injecting
python_root
or do we want them to hard code things?Examples:
How would we support such injection? The above example is a linux var style, but we could also do
%s
formatting or{{ python_root }}
templating or something else.Or we could just say "Do it yourself, users!":
Open Question 2: Specific to just python?
I see 3 paths forward:
default_visibility
bazel-gazelle
project, affects all targets.python_default_visibility
py_*
targets.default_visibility
andpython_default_visibility
.python_default_visibility
overridesdefault_visibility
forpy_*
targetsWhich should we strive for?
Open Question 3: Should the current default be kept?
Should the current default visivility be kept as
fmt.Sprintf("//%s:__subpackages__", pythonProjectRoot)
?If not, what should it change to?
Open Question 4: Support for "clearing/resetting" visibility?
Do we want to add the ability to clear/reset visibility? Perhaps by supporting special labels
NONE
andDEFAULT
?Example:
Describe alternatives you've considered
N/A
The text was updated successfully, but these errors were encountered: