From 95a971b666cfb3c2a4b201081e999f06b3feeb92 Mon Sep 17 00:00:00 2001 From: Douglas Thor Date: Sat, 21 Feb 2026 14:35:55 -0800 Subject: [PATCH 1/3] Add versionadded notes to some Gazelle docs. Also fixup CHANGELOG entry. --- CHANGELOG.md | 2 +- gazelle/docs/directives.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d1d492d0f..4f2221eb62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)). diff --git a/gazelle/docs/directives.md b/gazelle/docs/directives.md index cb2bb4929a..52c4417c32 100644 --- a/gazelle/docs/directives.md +++ b/gazelle/docs/directives.md @@ -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 @@ -653,6 +657,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. ::: @@ -661,6 +669,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: @@ -684,6 +696,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 @@ -746,6 +762,10 @@ 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. ::: @@ -753,6 +773,10 @@ Detailed docs are not yet written. (directive-python-include-ancestor-conftest)= ## `python_include_ancestor_conftest` +:::{versionadded} 1.9.0 +{gh-pr}`3596` +::: + Version VERSION_NEXT_FEATURE 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. From b0a25a1473656a307825bddf061ea96e48a85cac Mon Sep 17 00:00:00 2001 From: Douglas Thor Date: Sat, 21 Feb 2026 14:40:31 -0800 Subject: [PATCH 2/3] a couple more --- gazelle/docs/directives.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gazelle/docs/directives.md b/gazelle/docs/directives.md index 52c4417c32..052a0699c7 100644 --- a/gazelle/docs/directives.md +++ b/gazelle/docs/directives.md @@ -397,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. @@ -473,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 @@ -531,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 @@ -594,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. ::: @@ -602,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. ::: From 8f1464181f77616697d01d5d5558aed1d09aa03f Mon Sep 17 00:00:00 2001 From: Douglas Thor Date: Sun, 22 Feb 2026 13:49:46 -0800 Subject: [PATCH 3/3] fix bad merge commit lol --- gazelle/docs/directives.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gazelle/docs/directives.md b/gazelle/docs/directives.md index 79a4107418..f23c75f331 100644 --- a/gazelle/docs/directives.md +++ b/gazelle/docs/directives.md @@ -806,7 +806,7 @@ Thus the `python_include_ancestor_conftest` directive controls this behavior. It defaults to `true`, which causes all ancestor `conftest.py` files to be included as dependencies for {bzl:obj}`py_test` targets. -Setting the directive to `false` reverts to the pre-VERSION_NEXT_FEATURE behavior. +Setting the directive to `false` reverts to the pre-1.9.0 behavior. For example, given this directory tree (not shown: intermediary `BUILD.bazel` files)