Skip to content

Commit 6b0e40a

Browse files
ewiandaaignas
andauthored
feat(gazelle): Include types/stubs packages (bazel-contrib#2425)
This PR adds logic that checks if a package has a corresponding `types` or `stubs` package and automatically adds that to the BUILD file. This is useful for typeckers e.g pyright , mypy --------- Co-authored-by: Ignas Anikevicius <[email protected]>
1 parent 679c553 commit 6b0e40a

24 files changed

+424
-14
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ Unreleased changes template.
6161

6262
{#v0-0-0-added}
6363
### Added
64-
* Nothing added.
64+
* (gazelle) Added `include_stub_packages` flag to `modules_mapping`. When set to `True`, this
65+
automatically includes corresponding stub packages for third-party libraries
66+
that are present and used (e.g., `boto3``boto3-stubs`), improving
67+
type-checking support.
6568

6669
{#v0-0-0-removed}
6770
### Removed

examples/bzlmod_build_file_generation/BUILD.bazel

+23
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,26 @@ modules_mapping(
3232
"^_|(\\._)+", # This is the default.
3333
"(\\.tests)+", # Add a custom one to get rid of the psutil tests.
3434
"^colorama", # Get rid of colorama on Windows.
35+
"^tzdata", # Get rid of tzdata on Windows.
3536
"^lazy_object_proxy\\.cext$", # Get rid of this on Linux because it isn't included on Windows.
3637
],
3738
wheels = all_whl_requirements,
3839
)
3940

41+
modules_mapping(
42+
name = "modules_map_with_types",
43+
exclude_patterns = [
44+
"^_|(\\._)+", # This is the default.
45+
"(\\.tests)+", # Add a custom one to get rid of the psutil tests.
46+
"^colorama", # Get rid of colorama on Windows.
47+
"^tzdata", # Get rid of tzdata on Windows.
48+
"^lazy_object_proxy\\.cext$", # Get rid of this on Linux because it isn't included on Windows.
49+
],
50+
include_stub_packages = True,
51+
modules_mapping_name = "modules_mapping_with_types.json",
52+
wheels = all_whl_requirements,
53+
)
54+
4055
# Gazelle python extension needs a manifest file mapping from
4156
# an import to the installed package that provides it.
4257
# This macro produces two targets:
@@ -54,6 +69,14 @@ gazelle_python_manifest(
5469
tags = ["exclusive"],
5570
)
5671

72+
gazelle_python_manifest(
73+
name = "gazelle_python_manifest_with_types",
74+
manifest = "gazelle_python_with_types.yaml",
75+
modules_mapping = ":modules_map_with_types",
76+
pip_repository_name = "pip",
77+
tags = ["exclusive"],
78+
)
79+
5780
# Our gazelle target points to the python gazelle binary.
5881
# This is the simple case where we only need one language supported.
5982
# If you also had proto, go, or other gazelle-supported languages,

examples/bzlmod_build_file_generation/gazelle_python.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,28 @@
66
manifest:
77
modules_mapping:
88
S3: s3cmd
9+
asgiref: asgiref
910
astroid: astroid
1011
certifi: certifi
1112
chardet: chardet
1213
dateutil: python_dateutil
1314
dill: dill
15+
django: Django
16+
django_stubs_ext: django_stubs_ext
1417
idna: idna
1518
isort: isort
1619
lazy_object_proxy: lazy_object_proxy
1720
magic: python_magic
1821
mccabe: mccabe
22+
mypy_django_plugin: django_stubs
1923
pathspec: pathspec
2024
pkg_resources: setuptools
2125
platformdirs: platformdirs
2226
pylint: pylint
2327
requests: requests
2428
setuptools: setuptools
2529
six: six
30+
sqlparse: sqlparse
2631
tabulate: tabulate
2732
tomli: tomli
2833
tomlkit: tomlkit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# GENERATED FILE - DO NOT EDIT!
2+
#
3+
# To update this file, run:
4+
# bazel run //:gazelle_python_manifest_with_types.update
5+
6+
manifest:
7+
modules_mapping:
8+
S3: s3cmd
9+
asgiref: asgiref
10+
astroid: astroid
11+
certifi: certifi
12+
chardet: chardet
13+
dateutil: python_dateutil
14+
dill: dill
15+
django: Django
16+
django_stubs: django_stubs
17+
django_stubs_ext: django_stubs_ext
18+
idna: idna
19+
isort: isort
20+
lazy_object_proxy: lazy_object_proxy
21+
magic: python_magic
22+
mccabe: mccabe
23+
pathspec: pathspec
24+
pkg_resources: setuptools
25+
platformdirs: platformdirs
26+
pylint: pylint
27+
requests: requests
28+
setuptools: setuptools
29+
six: six
30+
sqlparse: sqlparse
31+
tabulate: tabulate
32+
tomli: tomli
33+
tomlkit: tomlkit
34+
types_pyyaml: types_pyyaml
35+
types_tabulate: types_tabulate
36+
typing_extensions: typing_extensions
37+
urllib3: urllib3
38+
wrapt: wrapt
39+
yaml: PyYAML
40+
yamllint: yamllint
41+
pip_repository:
42+
name: pip

examples/bzlmod_build_file_generation/requirements.in

+3
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ requests~=2.25.1
22
s3cmd~=2.1.0
33
yamllint>=1.28.0
44
tabulate~=0.9.0
5+
types-tabulate
56
pylint~=2.15.5
67
python-dateutil>=2.8.2
8+
django
9+
django-stubs

examples/bzlmod_build_file_generation/requirements_lock.txt

+39-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
#
55
# bazel run //:requirements.update
66
#
7+
asgiref==3.8.1 \
8+
--hash=sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47 \
9+
--hash=sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590
10+
# via
11+
# django
12+
# django-stubs
713
astroid==2.12.13 \
814
--hash=sha256:10e0ad5f7b79c435179d0d0f0df69998c4eef4597534aae44910db060baeb907 \
915
--hash=sha256:1493fe8bd3dfd73dc35bd53c9d5b6e49ead98497c47b2307662556a5692d29d7
@@ -20,6 +26,21 @@ dill==0.3.6 \
2026
--hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \
2127
--hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373
2228
# via pylint
29+
django==4.2.16 \
30+
--hash=sha256:1ddc333a16fc139fd253035a1606bb24261951bbc3a6ca256717fa06cc41a898 \
31+
--hash=sha256:6f1616c2786c408ce86ab7e10f792b8f15742f7b7b7460243929cb371e7f1dad
32+
# via
33+
# -r requirements.in
34+
# django-stubs
35+
# django-stubs-ext
36+
django-stubs==5.0.0 \
37+
--hash=sha256:084484cbe16a6d388e80ec687e46f529d67a232f3befaf55c936b3b476be289d \
38+
--hash=sha256:b8a792bee526d6cab31e197cb414ee7fa218abd931a50948c66a80b3a2548621
39+
# via -r requirements.in
40+
django-stubs-ext==5.1.1 \
41+
--hash=sha256:3907f99e178c93323e2ce908aef8352adb8c047605161f8d9e5e7b4efb5a6a9c \
42+
--hash=sha256:db7364e4f50ae7e5360993dbd58a3a57ea4b2e7e5bab0fbd525ccdb3e7975d1c
43+
# via django-stubs
2344
idna==2.10 \
2445
--hash=sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6 \
2546
--hash=sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0
@@ -129,23 +150,40 @@ six==1.16.0 \
129150
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
130151
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
131152
# via python-dateutil
153+
sqlparse==0.5.2 \
154+
--hash=sha256:9e37b35e16d1cc652a2545f0997c1deb23ea28fa1f3eefe609eee3063c3b105f \
155+
--hash=sha256:e99bc85c78160918c3e1d9230834ab8d80fc06c59d03f8db2618f65f65dda55e
156+
# via django
132157
tabulate==0.9.0 \
133158
--hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \
134159
--hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f
135160
# via -r requirements.in
136161
tomli==2.0.1 \
137162
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
138163
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
139-
# via pylint
164+
# via
165+
# django-stubs
166+
# pylint
140167
tomlkit==0.11.6 \
141168
--hash=sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b \
142169
--hash=sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73
143170
# via pylint
171+
types-pyyaml==6.0.12.20240917 \
172+
--hash=sha256:392b267f1c0fe6022952462bf5d6523f31e37f6cea49b14cee7ad634b6301570 \
173+
--hash=sha256:d1405a86f9576682234ef83bcb4e6fff7c9305c8b1fbad5e0bcd4f7dbdc9c587
174+
# via django-stubs
175+
types-tabulate==0.9.0.20240106 \
176+
--hash=sha256:0378b7b6fe0ccb4986299496d027a6d4c218298ecad67199bbd0e2d7e9d335a1 \
177+
--hash=sha256:c9b6db10dd7fcf55bd1712dd3537f86ddce72a08fd62bb1af4338c7096ce947e
178+
# via -r requirements.in
144179
typing-extensions==4.4.0 \
145180
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
146181
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
147182
# via
183+
# asgiref
148184
# astroid
185+
# django-stubs
186+
# django-stubs-ext
149187
# pylint
150188
urllib3==1.26.13 \
151189
--hash=sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc \

examples/bzlmod_build_file_generation/requirements_windows.txt

+56-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
#
55
# bazel run //:requirements.update
66
#
7+
asgiref==3.8.1 \
8+
--hash=sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47 \
9+
--hash=sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590
10+
# via
11+
# django
12+
# django-stubs
713
astroid==2.12.13 \
814
--hash=sha256:10e0ad5f7b79c435179d0d0f0df69998c4eef4597534aae44910db060baeb907 \
915
--hash=sha256:1493fe8bd3dfd73dc35bd53c9d5b6e49ead98497c47b2307662556a5692d29d7
@@ -24,6 +30,21 @@ dill==0.3.6 \
2430
--hash=sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0 \
2531
--hash=sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373
2632
# via pylint
33+
django==4.2.16 \
34+
--hash=sha256:1ddc333a16fc139fd253035a1606bb24261951bbc3a6ca256717fa06cc41a898 \
35+
--hash=sha256:6f1616c2786c408ce86ab7e10f792b8f15742f7b7b7460243929cb371e7f1dad
36+
# via
37+
# -r requirements.in
38+
# django-stubs
39+
# django-stubs-ext
40+
django-stubs==5.1.1 \
41+
--hash=sha256:126d354bbdff4906c4e93e6361197f6fbfb6231c3df6def85a291dae6f9f577b \
42+
--hash=sha256:c4dc64260bd72e6d32b9e536e8dd0d9247922f0271f82d1d5132a18f24b388ac
43+
# via -r requirements.in
44+
django-stubs-ext==5.1.1 \
45+
--hash=sha256:3907f99e178c93323e2ce908aef8352adb8c047605161f8d9e5e7b4efb5a6a9c \
46+
--hash=sha256:db7364e4f50ae7e5360993dbd58a3a57ea4b2e7e5bab0fbd525ccdb3e7975d1c
47+
# via django-stubs
2748
idna==2.10 \
2849
--hash=sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6 \
2950
--hash=sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0
@@ -133,24 +154,45 @@ six==1.16.0 \
133154
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
134155
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
135156
# via python-dateutil
157+
sqlparse==0.5.2 \
158+
--hash=sha256:9e37b35e16d1cc652a2545f0997c1deb23ea28fa1f3eefe609eee3063c3b105f \
159+
--hash=sha256:e99bc85c78160918c3e1d9230834ab8d80fc06c59d03f8db2618f65f65dda55e
160+
# via django
136161
tabulate==0.9.0 \
137162
--hash=sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c \
138163
--hash=sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f
139164
# via -r requirements.in
140165
tomli==2.0.1 \
141166
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
142167
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
143-
# via pylint
168+
# via
169+
# django-stubs
170+
# pylint
144171
tomlkit==0.11.6 \
145172
--hash=sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b \
146173
--hash=sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73
147174
# via pylint
148-
typing-extensions==4.4.0 \
149-
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
150-
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
175+
types-pyyaml==6.0.12.20240917 \
176+
--hash=sha256:392b267f1c0fe6022952462bf5d6523f31e37f6cea49b14cee7ad634b6301570 \
177+
--hash=sha256:d1405a86f9576682234ef83bcb4e6fff7c9305c8b1fbad5e0bcd4f7dbdc9c587
178+
# via django-stubs
179+
types-tabulate==0.9.0.20240106 \
180+
--hash=sha256:0378b7b6fe0ccb4986299496d027a6d4c218298ecad67199bbd0e2d7e9d335a1 \
181+
--hash=sha256:c9b6db10dd7fcf55bd1712dd3537f86ddce72a08fd62bb1af4338c7096ce947e
182+
# via -r requirements.in
183+
typing-extensions==4.12.2 \
184+
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
185+
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
151186
# via
187+
# asgiref
152188
# astroid
189+
# django-stubs
190+
# django-stubs-ext
153191
# pylint
192+
tzdata==2024.2 \
193+
--hash=sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc \
194+
--hash=sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd
195+
# via django
154196
urllib3==1.26.13 \
155197
--hash=sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc \
156198
--hash=sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8
@@ -162,23 +204,30 @@ wrapt==1.14.1 \
162204
--hash=sha256:07f7a7d0f388028b2df1d916e94bbb40624c59b48ecc6cbc232546706fac74c2 \
163205
--hash=sha256:11871514607b15cfeb87c547a49bca19fde402f32e2b1c24a632506c0a756656 \
164206
--hash=sha256:1b376b3f4896e7930f1f772ac4b064ac12598d1c38d04907e696cc4d794b43d3 \
207+
--hash=sha256:2020f391008ef874c6d9e208b24f28e31bcb85ccff4f335f15a3251d222b92d9 \
165208
--hash=sha256:21ac0156c4b089b330b7666db40feee30a5d52634cc4560e1905d6529a3897ff \
209+
--hash=sha256:240b1686f38ae665d1b15475966fe0472f78e71b1b4903c143a842659c8e4cb9 \
166210
--hash=sha256:257fd78c513e0fb5cdbe058c27a0624c9884e735bbd131935fd49e9fe719d310 \
211+
--hash=sha256:26046cd03936ae745a502abf44dac702a5e6880b2b01c29aea8ddf3353b68224 \
167212
--hash=sha256:2b39d38039a1fdad98c87279b48bc5dce2c0ca0d73483b12cb72aa9609278e8a \
168213
--hash=sha256:2cf71233a0ed05ccdabe209c606fe0bac7379fdcf687f39b944420d2a09fdb57 \
169214
--hash=sha256:2fe803deacd09a233e4762a1adcea5db5d31e6be577a43352936179d14d90069 \
215+
--hash=sha256:2feecf86e1f7a86517cab34ae6c2f081fd2d0dac860cb0c0ded96d799d20b335 \
170216
--hash=sha256:3232822c7d98d23895ccc443bbdf57c7412c5a65996c30442ebe6ed3df335383 \
171217
--hash=sha256:34aa51c45f28ba7f12accd624225e2b1e5a3a45206aa191f6f9aac931d9d56fe \
218+
--hash=sha256:358fe87cc899c6bb0ddc185bf3dbfa4ba646f05b1b0b9b5a27c2cb92c2cea204 \
172219
--hash=sha256:36f582d0c6bc99d5f39cd3ac2a9062e57f3cf606ade29a0a0d6b323462f4dd87 \
173220
--hash=sha256:380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d \
174221
--hash=sha256:40e7bc81c9e2b2734ea4bc1aceb8a8f0ceaac7c5299bc5d69e37c44d9081d43b \
175222
--hash=sha256:43ca3bbbe97af00f49efb06e352eae40434ca9d915906f77def219b88e85d907 \
223+
--hash=sha256:49ef582b7a1152ae2766557f0550a9fcbf7bbd76f43fbdc94dd3bf07cc7168be \
176224
--hash=sha256:4fcc4649dc762cddacd193e6b55bc02edca674067f5f98166d7713b193932b7f \
177225
--hash=sha256:5a0f54ce2c092aaf439813735584b9537cad479575a09892b8352fea5e988dc0 \
178226
--hash=sha256:5a9a0d155deafd9448baff28c08e150d9b24ff010e899311ddd63c45c2445e28 \
179227
--hash=sha256:5b02d65b9ccf0ef6c34cba6cf5bf2aab1bb2f49c6090bafeecc9cd81ad4ea1c1 \
180228
--hash=sha256:60db23fa423575eeb65ea430cee741acb7c26a1365d103f7b0f6ec412b893853 \
181229
--hash=sha256:642c2e7a804fcf18c222e1060df25fc210b9c58db7c91416fb055897fc27e8cc \
230+
--hash=sha256:6447e9f3ba72f8e2b985a1da758767698efa72723d5b59accefd716e9e8272bf \
182231
--hash=sha256:6a9a25751acb379b466ff6be78a315e2b439d4c94c1e99cb7266d40a537995d3 \
183232
--hash=sha256:6b1a564e6cb69922c7fe3a678b9f9a3c54e72b469875aa8018f18b4d1dd1adf3 \
184233
--hash=sha256:6d323e1554b3d22cfc03cd3243b5bb815a51f5249fdcbb86fda4bf62bab9e164 \
@@ -201,8 +250,10 @@ wrapt==1.14.1 \
201250
--hash=sha256:9e0fd32e0148dd5dea6af5fee42beb949098564cc23211a88d799e434255a1f4 \
202251
--hash=sha256:9f3e6f9e05148ff90002b884fbc2a86bd303ae847e472f44ecc06c2cd2fcdb2d \
203252
--hash=sha256:a85d2b46be66a71bedde836d9e41859879cc54a2a04fad1191eb50c2066f6e9d \
253+
--hash=sha256:a9008dad07d71f68487c91e96579c8567c98ca4c3881b9b113bc7b33e9fd78b8 \
204254
--hash=sha256:a9a52172be0b5aae932bef82a79ec0a0ce87288c7d132946d645eba03f0ad8a8 \
205255
--hash=sha256:aa31fdcc33fef9eb2552cbcbfee7773d5a6792c137b359e82879c101e98584c5 \
256+
--hash=sha256:acae32e13a4153809db37405f5eba5bac5fbe2e2ba61ab227926a22901051c0a \
206257
--hash=sha256:b014c23646a467558be7da3d6b9fa409b2c567d2110599b7cf9a0c5992b3b471 \
207258
--hash=sha256:b21bb4c09ffabfa0e85e3a6b623e19b80e7acd709b9f91452b8297ace2a8ab00 \
208259
--hash=sha256:b5901a312f4d14c59918c221323068fad0540e34324925c8475263841dbdfe68 \
@@ -217,6 +268,7 @@ wrapt==1.14.1 \
217268
--hash=sha256:dee60e1de1898bde3b238f18340eec6148986da0455d8ba7848d50470a7a32fb \
218269
--hash=sha256:e2f83e18fe2f4c9e7db597e988f72712c0c3676d337d8b101f6758107c42425b \
219270
--hash=sha256:e3fb1677c720409d5f671e39bac6c9e0e422584e5f518bfd50aa4cbbea02433f \
271+
--hash=sha256:ecee4132c6cd2ce5308e21672015ddfed1ff975ad0ac8d27168ea82e71413f55 \
220272
--hash=sha256:ee2b1b1769f6707a8a445162ea16dddf74285c3964f605877a20e38545c3c462 \
221273
--hash=sha256:ee6acae74a2b91865910eef5e7de37dc6895ad96fa23603d1d27ea69df545015 \
222274
--hash=sha256:ef3f72c9666bba2bab70d2a8b79f2c6d2c1a42a7f7e2b0ec83bb2f9e383950af

gazelle/MODULE.bazel

+11
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,14 @@ use_repo(
3434
python_stdlib_list,
3535
"python_stdlib_list",
3636
)
37+
38+
internal_dev_deps = use_extension(
39+
"//:internal_dev_deps.bzl",
40+
"internal_dev_deps_extension",
41+
dev_dependency = True,
42+
)
43+
use_repo(
44+
internal_dev_deps,
45+
"django-types",
46+
"pytest",
47+
)

gazelle/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ gazelle_python_manifest(
119119
# the integrity field is not added to the manifest which can help avoid
120120
# merge conflicts in large repos.
121121
requirements = "//:requirements_lock.txt",
122+
# include_stub_packages: bool (default: False)
123+
# If set to True, this flag automatically includes any corresponding type stub packages
124+
# for the third-party libraries that are present and used. For example, if you have
125+
# `boto3` as a dependency, and this flag is enabled, the corresponding `boto3-stubs`
126+
# package will be automatically included in the BUILD file.
127+
#
128+
# Enabling this feature helps ensure that type hints and stubs are readily available
129+
# for tools like type checkers and IDEs, improving the development experience and
130+
# reducing manual overhead in managing separate stub packages.
131+
include_stub_packages = True
122132
)
123133
```
124134

gazelle/WORKSPACE

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ load("@rules_python//python:repositories.bzl", "py_repositories")
3838

3939
py_repositories()
4040

41+
load("//:internal_dev_deps.bzl", "internal_dev_deps")
42+
43+
internal_dev_deps()
44+
4145
load("//:deps.bzl", _py_gazelle_deps = "gazelle_deps")
4246

4347
# gazelle:repository_macro deps.bzl%go_deps

0 commit comments

Comments
 (0)