Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ END_UNRELEASED_TEMPLATE
* (binaries/tests) Build information is now included in binaries and tests.
Use the `bazel_binary_info` module to access it. The {flag}`--stamp` flag will
add {obj}`--workspace_status_command` information.
* (gazelle) A new directive `python_generate_pyi_deps` has been added. When
* (gazelle) A new directive `python_generate_pyi_srcs` has been added. When
`true`, a `py_*` target's `pyi_srcs` attribute will be set if any `.pyi` files
that are associated with the target's `srcs` are present.
([#3354](https://github.com/bazel-contrib/rules_python/issues/3354)).
Expand Down
44 changes: 44 additions & 0 deletions gazelle/docs/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ Detailed docs are not yet written.
(directive-python-proto-naming-convention)=
## `python_proto_naming_convention`

:::{versionadded} 1.6.0
{gh-pr}`3093`
:::

Set this directive to a string pattern to control how the generated
{bzl:obj}`py_proto_library` targets are named. When generating new
{bzl:obj}`py_proto_library` rules, Gazelle will replace `$proto_name$` in the
Expand Down Expand Up @@ -393,6 +397,10 @@ Detailed docs are not yet written.
(directive-python-default-visibility)=
## `python_default_visibility`

:::{versionadded} 0.32.0
{gh-pr}`1787`
:::

Instructs gazelle to use these visibility labels on all _python_ targets
(typically `py_*`, but can be modified via the `map_kind` directive). The arg
to this directive is a comma-separated list (without spaces) of labels.
Expand Down Expand Up @@ -469,6 +477,10 @@ These special values can be useful for sub-packages.
(directive-python-visibility)=
## `python_visibility`

:::{versionadded} 0.32.0
{gh-pr}`1784`
:::

Appends additional `visibility` labels to each generated target.

This directive can be set multiple times. The generated `visibility` attribute
Expand Down Expand Up @@ -527,6 +539,10 @@ py_library(
(directive-python-test-file-pattern)=
## `python_test_file_pattern`

:::{versionadded} 0.32.0
{gh-pr}`1819`
:::

This directive adjusts which python files will be mapped to the {bzl:obj}`py_test` rule.

+ The default is `*_test.py,test_*.py`: both `test_*.py` and `*_test.py` files
Expand Down Expand Up @@ -590,6 +606,10 @@ py_library(
(directive-python-label-convention)=
## `python_label_convention`

:::{versionadded} 0.34.0
{gh-pr}`1976`
:::

:::{error}
Detailed docs are not yet written.
:::
Expand All @@ -598,6 +618,10 @@ Detailed docs are not yet written.
(directive-python-label-normalization)=
## `python_label_normalization`

:::{versionadded} 0.34.0
{gh-pr}`1976`
:::

:::{error}
Detailed docs are not yet written.
:::
Expand Down Expand Up @@ -653,6 +677,10 @@ that are relative to the current package.
(directive-python-generate-pyi-deps)=
## `python_generate_pyi_deps`

:::{versionadded} 1.6.0
{gh-pr}`3014`
:::

:::{error}
Detailed docs are not yet written.
:::
Expand All @@ -661,6 +689,10 @@ Detailed docs are not yet written.
(directive-python-generate-pyi-srcs)=
## `python_generate_pyi_srcs`

:::{versionadded} 1.6.0
{gh-pr}`3356`
:::

When `true`, include any sibling `.pyi` files in the `pyi_srcs` target attribute.

For example, assume you have the following files:
Expand All @@ -684,6 +716,10 @@ py_library(
(directive-python-generate-proto)=
## `python_generate_proto`

:::{versionadded} 1.6.0
{gh-pr}`3057`
:::

When `# gazelle:python_generate_proto true`, Gazelle will generate one
{bzl:obj}`py_proto_library` for each `proto_library`, generating Python clients for
protobuf in each package. By default this is turned off. Gazelle will also
Expand Down Expand Up @@ -746,13 +782,21 @@ previously-generated or hand-created rules.
(directive-python-resolve-sibling-imports)=
## `python_resolve_sibling_imports`

:::{versionadded} 1.6.0
{gh-pr}`3106`
:::

:::{error}
Detailed docs are not yet written.
:::

(directive-python-include-ancestor-conftest)=
## `python_include_ancestor_conftest`

:::{versionadded} 1.9.0
{gh-pr}`3596`
:::

Version 1.9.0 includes a fix ({gh-pr}`3498`) for a long-standing issue
({gh-issue}`3497`) where ancestor `conftest.py` files were not automatically
added as dependencies of {bzl:obj}`py_test` targets.
Expand Down