-
Notifications
You must be signed in to change notification settings - Fork 541
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
Add python_visibility
gazelle directive
#1783
Comments
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 1, 2024
…nal visibility labels (#1784) Fixes #1783. Add a new gazelle directive, `python_visibility`, that allows users to add labels to the `visibility` attribute of generated targets. out by the way, hence this PR), I noticed that the docs were a little This directive acts similar to[^1] the [`go_visibility` directive](https://github.com/bazelbuild/bazel-gazelle#directives). The primary use case is for python projects that separate unit test files from the python packages/modules that they test, like so: ``` packaging_tutorial/ ├── LICENSE ├── pyproject.toml ├── README.md ├── src/ │ └── mypackage/ │ ├── __init__.py │ └── foo.py └── tests/ ├── __init__.py └── test_foo.py ``` A future PR will add an example to the `./examples` directory (issue #1775). [^1]: At least, similar based on docs. I haven't done any actual comparison.
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 17, 2024
Fixes #1783. Provides a way to fix #1682. Add the `python_default_visibility` directive. This directive sets the `visibility` attribute on all generated `py_*` rules. It accepts a comma-separated list of labels to add as visibility targets, similar to how the base `default_visibility` directive works. Setting this directive multiple times will override previous values. Two special values are also accepted: `NONE` and `DEFAULT`. See ./gazelle/README.md#directive-python_default_visibility for details. The directive also accepts a special string `"$python_root"` that gets replaced with the `python_root` value, if set. If not set, `"$python_root"` is replaced with the empty string. --------- Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 feature request
Relevant Rules
Description
Summary: Add a
py(thon)_visibility
gazelle directive that acts like thego_visibility
directive. This directive would append additional labels to thevisibility
attribute on generated targets.Example:
Describe the solution you'd like
I have a branch that does this already. I'm mostly making this Issue for discussion before I submit the PR.
Branch: https://github.com/dougthor42/rules_python/tree/gazelle-python-visibility
Describe alternatives you've considered
Manually adding other vis labels is the only other option I've found. That's not really an option when adding gazelle to an existing, large project.
The text was updated successfully, but these errors were encountered: