File tree Expand file tree Collapse file tree 8 files changed +33
-1
lines changed
type_checking_imports_disabled Expand file tree Collapse file tree 8 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,20 @@ py_library(
1414py_library(
1515 name = "baz",
1616 srcs = ["baz.py"],
17+ pyi_deps = [
18+ "@gazelle_python_test//boto3",
19+ "@gazelle_python_test//boto3_stubs",
20+ ],
1721 visibility = ["//:__subpackages__"],
1822)
1923
2024py_library(
2125 name = "foo",
2226 srcs = ["foo.py"],
23- pyi_deps = ["@gazelle_python_test//djangorestframework"],
27+ pyi_deps = [
28+ "@gazelle_python_test//boto3_stubs",
29+ "@gazelle_python_test//djangorestframework",
30+ ],
2431 visibility = ["//:__subpackages__"],
2532 deps = ["@gazelle_python_test//boto3"],
2633)
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+
16+ # While this format is not official, it is supported by most type checkers and
17+ # is used in the wild to avoid importing the typing module.
18+ TYPE_CHECKING = False
19+ if TYPE_CHECKING :
20+ # Both boto3 and boto3_stubs should be added to pyi_deps.
21+ import boto3
22+
1523X = 1
Original file line number Diff line number Diff line change 1414
1515import typing
1616
17+ # boto3 should be added to deps. boto3_stubs and djangorestframework should be added to pyi_deps.
1718import boto3
1819
1920if typing .TYPE_CHECKING :
Original file line number Diff line number Diff line change 1515manifest :
1616 modules_mapping :
1717 boto3 : boto3
18+ boto3_stubs : boto3_stubs
1819 rest_framework : djangorestframework
1920 pip_deps_repository_name : gazelle_python_test
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ py_library(
1717 name = "baz",
1818 srcs = ["baz.py"],
1919 visibility = ["//:__subpackages__"],
20+ deps = [
21+ "@gazelle_python_test//boto3",
22+ "@gazelle_python_test//boto3_stubs",
23+ ],
2024)
2125
2226py_library(
@@ -25,6 +29,7 @@ py_library(
2529 visibility = ["//:__subpackages__"],
2630 deps = [
2731 "@gazelle_python_test//boto3",
32+ "@gazelle_python_test//boto3_stubs",
2833 "@gazelle_python_test//djangorestframework",
2934 ],
3035)
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+
16+ # While this format is not official, it is supported by most type checkers and
17+ # is used in the wild to avoid importing the typing module.
18+ TYPE_CHECKING = False
19+ if TYPE_CHECKING :
20+ # Both boto3 and boto3_stubs should be added to pyi_deps.
21+ import boto3
22+
1523X = 1
Original file line number Diff line number Diff line change 1414
1515import typing
1616
17+ # boto3 should be added to deps. boto3_stubs and djangorestframework should be added to pyi_deps.
1718import boto3
1819
1920if typing .TYPE_CHECKING :
Original file line number Diff line number Diff line change 1515manifest :
1616 modules_mapping :
1717 boto3 : boto3
18+ boto3_stubs : boto3_stubs
1819 rest_framework : djangorestframework
1920 pip_deps_repository_name : gazelle_python_test
You can’t perform that action at this time.
0 commit comments