Skip to content

Commit 9889d9f

Browse files
authored
fix(gazelle): Rename experimental_allow_relative_imports directive to follow convention (bazel-contrib#3128)
Prefix `experimental_allow_relative_imports` with `python_` to match the rest of the directives. 1.6.0 hasn't been released yet, so this is a non-breaking change.
1 parent 2c53bf6 commit 9889d9f

File tree

11 files changed

+12
-12
lines changed

11 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ END_UNRELEASED_TEMPLATE
5656
### Changed
5757
* (gazelle) For package mode, resolve dependencies when imports are relative
5858
to the package path. This is enabled via the
59-
`# gazelle:experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
59+
`# gazelle:python_experimental_allow_relative_imports` true directive ({gh-issue}`2203`).
6060
* (gazelle) Types for exposed members of `python.ParserOutput` are now all public.
6161
* (gazelle) Removed the requirement for `__init__.py`, `__main__.py`, or `__test__.py` files to be
6262
present in a directory to generate a `BUILD.bazel` file.

gazelle/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Python-specific directives are as follows:
222222
| Defines the format of the distribution name in labels to third-party deps. Useful for using Gazelle plugin with other rules with different repository conventions (e.g. `rules_pycross`). Full label is always prepended with (pip) repository name, e.g. `@pip//numpy`. |
223223
| `# gazelle:python_label_normalization` | `snake_case` |
224224
| Controls how distribution names in labels to third-party deps are normalized. Useful for using Gazelle plugin with other rules with different label conventions (e.g. `rules_pycross` uses PEP-503). Can be "snake_case", "none", or "pep503". |
225-
| `# gazelle:experimental_allow_relative_imports` | `false` |
225+
| `# gazelle:python_experimental_allow_relative_imports` | `false` |
226226
| Controls whether Gazelle resolves dependencies for import statements that use paths relative to the current package. Can be "true" or "false".|
227227
| `# gazelle:python_generate_pyi_deps` | `false` |
228228
| Controls whether to generate a separate `pyi_deps` attribute for type-checking dependencies or merge them into the regular `deps` attribute. When `false` (default), type-checking dependencies are merged into `deps` for backward compatibility. When `true`, generates separate `pyi_deps`. Imports in blocks with the format `if typing.TYPE_CHECKING:`/`if TYPE_CHECKING:` and type-only stub packages (eg. boto3-stubs) are recognized as type-checking dependencies. |
@@ -736,7 +736,7 @@ See [Issue #3076][gh3076] for more information.
736736
[gh3076]: https://github.com/bazel-contrib/rules_python/issues/3076
737737

738738

739-
#### Directive: `experimental_allow_relative_imports`
739+
#### Directive: `python_experimental_allow_relative_imports`
740740
Enables experimental support for resolving relative imports in
741741
`python_generation_mode package`.
742742

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# gazelle:python_generation_mode package
2-
# gazelle:experimental_allow_relative_imports true
2+
# gazelle:python_experimental_allow_relative_imports true

gazelle/python/testdata/relative_imports_package_mode/BUILD.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@rules_python//python:defs.bzl", "py_binary")
22

33
# gazelle:python_generation_mode package
4-
# gazelle:experimental_allow_relative_imports true
4+
# gazelle:python_experimental_allow_relative_imports true
55

66
py_binary(
77
name = "relative_imports_package_mode_bin",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# gazelle:python_resolve_sibling_imports false
2-
# gazelle:experimental_allow_relative_imports true
2+
# gazelle:python_experimental_allow_relative_imports true

gazelle/python/testdata/sibling_imports_disabled/BUILD.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@rules_python//python:defs.bzl", "py_library", "py_test")
22

33
# gazelle:python_resolve_sibling_imports false
4-
# gazelle:experimental_allow_relative_imports true
4+
# gazelle:python_experimental_allow_relative_imports true
55

66
py_library(
77
name = "sibling_imports_disabled",

gazelle/python/testdata/sibling_imports_disabled/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ disabled. It covers different types of imports in `pkg/unit_test.py`:
1010
(not the sibling `typing.py`).
1111
- `from .b import run` / `from .typing import A` - resolves to the sibling
1212
`pkg/b.py` / `pkg/typing.py` (with
13-
`gazelle:experimental_allow_relative_imports` enabled)
13+
`gazelle:python_experimental_allow_relative_imports` enabled)
1414
- `import test_util` - resolves to the root-level `test_util.py` instead of
1515
the sibling `pkg/test_util.py`
1616
- `from b import run` - resolves to the root-level `b.py` instead of the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# gazelle:python_generation_mode file
22
# gazelle:python_resolve_sibling_imports false
3-
# gazelle:experimental_allow_relative_imports true
3+
# gazelle:python_experimental_allow_relative_imports true

gazelle/python/testdata/sibling_imports_disabled_file_mode/BUILD.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test")
22

33
# gazelle:python_generation_mode file
44
# gazelle:python_resolve_sibling_imports false
5-
# gazelle:experimental_allow_relative_imports true
5+
# gazelle:python_experimental_allow_relative_imports true
66

77
py_library(
88
name = "a",

gazelle/python/testdata/sibling_imports_disabled_file_mode/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ disabled. It covers different types of imports in `pkg/unit_test.py`:
1010
(not the sibling `typing.py`).
1111
- `from .b import run` / `from .typing import A` - resolves to the sibling
1212
`pkg/b.py` / `pkg/typing.py` (with
13-
`gazelle:experimental_allow_relative_imports` enabled)
13+
`gazelle:python_experimental_allow_relative_imports` enabled)
1414
- `import test_util` - resolves to the root-level `test_util.py` instead of
1515
the sibling `pkg/test_util.py`
1616
- `from b import run` - resolves to the root-level `b.py` instead of the

0 commit comments

Comments
 (0)