Skip to content

Commit f2a77ea

Browse files
authored
Update to include latest stubs in typeshed (#18366)
Fixes #18365 See #18367 for script
1 parent 7b61945 commit f2a77ea

File tree

2 files changed

+145
-9
lines changed

2 files changed

+145
-9
lines changed

mypy/stubinfo.py

+141-8
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,45 @@ def stub_distribution_name(module: str) -> str | None:
8585
# types-pika already exists on PyPI, and is more complete in many ways,
8686
# but is a non-typeshed stubs package.
8787
non_bundled_packages_flat: dict[str, str] = {
88-
"MySQLdb": "types-mysqlclient",
89-
"PIL": "types-Pillow",
90-
"PyInstaller": "types-pyinstaller",
91-
"Xlib": "types-python-xlib",
88+
"_cffi_backend": "types-cffi",
89+
"_win32typing": "types-pywin32",
90+
"antlr4": "types-antlr4-python3-runtime",
91+
"assertpy": "types-assertpy",
92+
"atheris": "types-atheris",
93+
"authlib": "types-Authlib",
9294
"aws_xray_sdk": "types-aws-xray-sdk",
9395
"babel": "types-babel",
96+
"boltons": "types-boltons",
9497
"braintree": "types-braintree",
9598
"bs4": "types-beautifulsoup4",
9699
"bugbear": "types-flake8-bugbear",
97100
"caldav": "types-caldav",
101+
"capturer": "types-capturer",
98102
"cffi": "types-cffi",
99103
"chevron": "types-chevron",
104+
"click_default_group": "types-click-default-group",
105+
"click_log": "types-click-log",
106+
"click_web": "types-click-web",
100107
"colorama": "types-colorama",
108+
"commctrl": "types-pywin32",
101109
"commonmark": "types-commonmark",
102110
"consolemenu": "types-console-menu",
111+
"corus": "types-corus",
112+
"cronlog": "types-python-crontab",
103113
"crontab": "types-python-crontab",
114+
"crontabs": "types-python-crontab",
104115
"d3dshot": "types-D3DShot",
116+
"datemath": "types-python-datemath",
117+
"dateparser_data": "types-dateparser",
118+
"dde": "types-pywin32",
119+
"defusedxml": "types-defusedxml",
120+
"docker": "types-docker",
105121
"dockerfile_parse": "types-dockerfile-parse",
106122
"docopt": "types-docopt",
107123
"editdistance": "types-editdistance",
108124
"entrypoints": "types-entrypoints",
125+
"exifread": "types-ExifRead",
126+
"fanstatic": "types-fanstatic",
109127
"farmhash": "types-pyfarmhash",
110128
"flake8_2020": "types-flake8-2020",
111129
"flake8_builtins": "types-flake8-builtins",
@@ -114,65 +132,180 @@ def stub_distribution_name(module: str) -> str | None:
114132
"flake8_rst_docstrings": "types-flake8-rst-docstrings",
115133
"flake8_simplify": "types-flake8-simplify",
116134
"flake8_typing_imports": "types-flake8-typing-imports",
135+
"flake8": "types-flake8",
117136
"flask_cors": "types-Flask-Cors",
118137
"flask_migrate": "types-Flask-Migrate",
138+
"flask_socketio": "types-Flask-SocketIO",
119139
"fpdf": "types-fpdf2",
120140
"gdb": "types-gdb",
141+
"gevent": "types-gevent",
142+
"greenlet": "types-greenlet",
121143
"hdbcli": "types-hdbcli",
122144
"html5lib": "types-html5lib",
123145
"httplib2": "types-httplib2",
124146
"humanfriendly": "types-humanfriendly",
147+
"hvac": "types-hvac",
148+
"ibm_db": "types-ibm-db",
149+
"icalendar": "types-icalendar",
150+
"import_export": "types-django-import-export",
151+
"influxdb_client": "types-influxdb-client",
152+
"inifile": "types-inifile",
125153
"invoke": "types-invoke",
154+
"isapi": "types-pywin32",
126155
"jack": "types-JACK-Client",
156+
"jenkins": "types-python-jenkins",
157+
"Jetson": "types-Jetson.GPIO",
158+
"jks": "types-pyjks",
127159
"jmespath": "types-jmespath",
128160
"jose": "types-python-jose",
129161
"jsonschema": "types-jsonschema",
162+
"jwcrypto": "types-jwcrypto",
130163
"keyboard": "types-keyboard",
131164
"ldap3": "types-ldap3",
165+
"lupa": "types-lupa",
166+
"lzstring": "types-lzstring",
167+
"m3u8": "types-m3u8",
168+
"mmapfile": "types-pywin32",
169+
"mmsystem": "types-pywin32",
170+
"mypy_extensions": "types-mypy-extensions",
171+
"MySQLdb": "types-mysqlclient",
172+
"nanoid": "types-nanoid",
173+
"nanoleafapi": "types-nanoleafapi",
174+
"netaddr": "types-netaddr",
175+
"netifaces": "types-netifaces",
176+
"networkx": "types-networkx",
132177
"nmap": "types-python-nmap",
178+
"ntsecuritycon": "types-pywin32",
133179
"oauthlib": "types-oauthlib",
180+
"objgraph": "types-objgraph",
181+
"odbc": "types-pywin32",
182+
"olefile": "types-olefile",
134183
"openpyxl": "types-openpyxl",
135184
"opentracing": "types-opentracing",
136185
"parsimonious": "types-parsimonious",
137186
"passlib": "types-passlib",
138187
"passpy": "types-passpy",
139188
"peewee": "types-peewee",
140189
"pep8ext_naming": "types-pep8-naming",
190+
"perfmon": "types-pywin32",
191+
"pexpect": "types-pexpect",
192+
"PIL": "types-Pillow",
193+
"playhouse": "types-peewee",
141194
"playsound": "types-playsound",
195+
"portpicker": "types-portpicker",
142196
"psutil": "types-psutil",
143197
"psycopg2": "types-psycopg2",
198+
"pyasn1": "types-pyasn1",
144199
"pyaudio": "types-pyaudio",
145200
"pyautogui": "types-PyAutoGUI",
146201
"pycocotools": "types-pycocotools",
147202
"pyflakes": "types-pyflakes",
203+
"pygit2": "types-pygit2",
148204
"pygments": "types-Pygments",
149205
"pyi_splash": "types-pyinstaller",
206+
"PyInstaller": "types-pyinstaller",
150207
"pynput": "types-pynput",
151-
"pythoncom": "types-pywin32",
152-
"pythonwin": "types-pywin32",
153208
"pyscreeze": "types-PyScreeze",
154209
"pysftp": "types-pysftp",
155210
"pytest_lazyfixture": "types-pytest-lazy-fixture",
211+
"python_http_client": "types-python-http-client",
212+
"pythoncom": "types-pywin32",
213+
"pythonwin": "types-pywin32",
156214
"pywintypes": "types-pywin32",
215+
"qrbill": "types-qrbill",
216+
"qrcode": "types-qrcode",
157217
"regex": "types-regex",
218+
"regutil": "types-pywin32",
219+
"reportlab": "types-reportlab",
220+
"requests_oauthlib": "types-requests-oauthlib",
221+
"RPi": "types-RPi.GPIO",
222+
"s2clientprotocol": "types-s2clientprotocol",
223+
"sass": "types-libsass",
224+
"sassutils": "types-libsass",
225+
"seaborn": "types-seaborn",
158226
"send2trash": "types-Send2Trash",
227+
"serial": "types-pyserial",
228+
"servicemanager": "types-pywin32",
229+
"setuptools": "types-setuptools",
230+
"shapely": "types-shapely",
159231
"slumber": "types-slumber",
232+
"sspicon": "types-pywin32",
160233
"stdlib_list": "types-stdlib-list",
234+
"str2bool": "types-str2bool",
161235
"stripe": "types-stripe",
236+
"tensorflow": "types-tensorflow",
237+
"tgcrypto": "types-TgCrypto",
238+
"timer": "types-pywin32",
162239
"toposort": "types-toposort",
163240
"tqdm": "types-tqdm",
164-
"tree_sitter": "types-tree-sitter",
241+
"translationstring": "types-translationstring",
165242
"tree_sitter_languages": "types-tree-sitter-languages",
243+
"tree_sitter": "types-tree-sitter",
166244
"ttkthemes": "types-ttkthemes",
245+
"unidiff": "types-unidiff",
246+
"untangle": "types-untangle",
247+
"usersettings": "types-usersettings",
248+
"uwsgi": "types-uWSGI",
249+
"uwsgidecorators": "types-uWSGI",
167250
"vobject": "types-vobject",
251+
"webob": "types-WebOb",
168252
"whatthepatch": "types-whatthepatch",
253+
"win2kras": "types-pywin32",
169254
"win32": "types-pywin32",
170255
"win32api": "types-pywin32",
171-
"win32con": "types-pywin32",
256+
"win32clipboard": "types-pywin32",
172257
"win32com": "types-pywin32",
173258
"win32comext": "types-pywin32",
259+
"win32con": "types-pywin32",
260+
"win32console": "types-pywin32",
261+
"win32cred": "types-pywin32",
262+
"win32crypt": "types-pywin32",
263+
"win32cryptcon": "types-pywin32",
264+
"win32event": "types-pywin32",
265+
"win32evtlog": "types-pywin32",
266+
"win32evtlogutil": "types-pywin32",
267+
"win32file": "types-pywin32",
268+
"win32gui_struct": "types-pywin32",
174269
"win32gui": "types-pywin32",
270+
"win32help": "types-pywin32",
271+
"win32inet": "types-pywin32",
272+
"win32inetcon": "types-pywin32",
273+
"win32job": "types-pywin32",
274+
"win32lz": "types-pywin32",
275+
"win32net": "types-pywin32",
276+
"win32netcon": "types-pywin32",
277+
"win32pdh": "types-pywin32",
278+
"win32pdhquery": "types-pywin32",
279+
"win32pipe": "types-pywin32",
280+
"win32print": "types-pywin32",
281+
"win32process": "types-pywin32",
282+
"win32profile": "types-pywin32",
283+
"win32ras": "types-pywin32",
284+
"win32security": "types-pywin32",
285+
"win32service": "types-pywin32",
286+
"win32serviceutil": "types-pywin32",
287+
"win32timezone": "types-pywin32",
288+
"win32trace": "types-pywin32",
289+
"win32transaction": "types-pywin32",
290+
"win32ts": "types-pywin32",
291+
"win32ui": "types-pywin32",
292+
"win32uiole": "types-pywin32",
293+
"win32verstamp": "types-pywin32",
294+
"win32wnet": "types-pywin32",
295+
"winerror": "types-pywin32",
296+
"winioctlcon": "types-pywin32",
297+
"winnt": "types-pywin32",
298+
"winperf": "types-pywin32",
299+
"winxpgui": "types-pywin32",
300+
"winxptheme": "types-pywin32",
301+
"workalendar": "types-workalendar",
302+
"wtforms": "types-WTForms",
303+
"wurlitzer": "types-wurlitzer",
304+
"xdg": "types-pyxdg",
305+
"xdgenvpy": "types-xdgenvpy",
306+
"Xlib": "types-python-xlib",
175307
"xmltodict": "types-xmltodict",
308+
"zstd": "types-zstd",
176309
"zxcvbn": "types-zxcvbn",
177310
# Stub packages that are not from typeshed
178311
# Since these can be installed automatically via --install-types, we have a high trust bar

test-data/unit/check-errorcodes.test

+4-1
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,16 @@ if int() is str(): # E: Non-overlapping identity check (left operand type: "int
522522
[builtins fixtures/primitives.pyi]
523523

524524
[case testErrorCodeMissingModule]
525-
from defusedxml import xyz # E: Cannot find implementation or library stub for module named "defusedxml" [import-not-found]
525+
from defusedxml import xyz # E: Library stubs not installed for "defusedxml" [import-untyped] \
526+
# N: Hint: "python3 -m pip install types-defusedxml" \
527+
# N: (or run "mypy --install-types" to install all missing stub packages)
526528
from nonexistent import foobar # E: Cannot find implementation or library stub for module named "nonexistent" [import-not-found]
527529
import nonexistent2 # E: Cannot find implementation or library stub for module named "nonexistent2" [import-not-found]
528530
from nonexistent3 import * # E: Cannot find implementation or library stub for module named "nonexistent3" [import-not-found]
529531
from pkg import bad # E: Module "pkg" has no attribute "bad" [attr-defined]
530532
from pkg.bad2 import bad3 # E: Cannot find implementation or library stub for module named "pkg.bad2" [import-not-found] \
531533
# N: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
534+
532535
[file pkg/__init__.py]
533536

534537
[case testErrorCodeAlreadyDefined]

0 commit comments

Comments
 (0)