Skip to content

Commit 9f69c62

Browse files
committed
Flip default to false
1 parent 0e49623 commit 9f69c62

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ END_UNRELEASED_TEMPLATE
9595
([#2921](https://github.com/bazel-contrib/rules_python/issues/2921)).
9696
* (repl) Normalize the path for the `REPL` stub to make it possible to use the
9797
default stub template from outside `rules_python` ({gh-issue}`3101`).
98+
* (gazelle) Fixes gazelle adding sibling module dependencies to resolve
99+
absolute imports (Python 2's behavior without `absolute_import`). Previous
100+
behavior can be restored using the directive
101+
`# gazelle:python_resolve_sibling_imports true`
98102

99103
{#v0-0-0-added}
100104
### Added
@@ -122,10 +126,6 @@ END_UNRELEASED_TEMPLATE
122126
Gazelle generates `py_proto_library` rules for `proto_library`. `false` by default.
123127
* (gazelle) New directive `gazelle:python_proto_naming_convention`; controls
124128
naming of `py_proto_library` rules.
125-
* (gazelle) Added directive `# gazelle:python_resolve_sibling_imports` (default
126-
`enabled` for backwards-compatibility). When enabled, gazelle will allow absolute
127-
imports to be resolved to sibling modules (Python 2's behavior without
128-
`absolute_import`).
129129

130130
{#v0-0-0-removed}
131131
### Removed

gazelle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Python-specific directives are as follows:
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. |
229229
| [`# gazelle:python_generate_proto`](#directive-python_generate_proto) | `false` |
230230
| Controls whether to generate a `py_proto_library` for each `proto_library` in the package. By default we load this rule from the `@protobuf` repository; use `gazelle:map_kind` if you need to load this from somewhere else. |
231-
| `# gazelle:python_resolve_sibling_imports` | `true` |
231+
| `# gazelle:python_resolve_sibling_imports` | `false` |
232232
| Allows absolute imports to be resolved to sibling modules (Python 2's behavior without `absolute_import`). |
233233

234234
#### Directive: `python_root`:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# gazelle:python_resolve_sibling_imports true

gazelle/python/testdata/annotation_include_pytest_conftest/with_conftest/BUILD.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
22

3+
# gazelle:python_resolve_sibling_imports true
4+
35
py_binary(
46
name = "binary",
57
srcs = ["binary.py"],

gazelle/pythonconfig/pythonconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func New(
243243
experimentalAllowRelativeImports: false,
244244
generatePyiDeps: false,
245245
generateProto: false,
246-
resolveSiblingImports: true,
246+
resolveSiblingImports: false,
247247
}
248248
}
249249

0 commit comments

Comments
 (0)