55
66Sources:
77- Python standard library (typeshed/stdlib/VERSIONS)
8- - Top 200 PyPI packages by downloads (https://github.com/hugovk/top-pypi-packages)
8+ - Top 100 PyPI packages by downloads (https://github.com/hugovk/top-pypi-packages)
99
1010Note: These are import names, not PyPI package names.
1111"""
3838 "multidict" ,
3939 "requests_oauthlib" ,
4040 "oauthlib" ,
41- "websocket" ,
42- "websockets" ,
4341 "h11" ,
44- "sniffio" ,
45- "requests_toolbelt" ,
46- "httplib2" ,
4742
4843 # Typing / Extensions
4944 "typing_extensions" ,
50- "mypy_extensions" ,
5145 "annotated_types" ,
5246 "typing_inspection" ,
5347
6155 "filelock" ,
6256 "zipp" ,
6357 "importlib_metadata" ,
64- "importlib_resources" ,
65- "distlib" ,
66- "distro" ,
67- "appdirs" ,
6858
6959 # Data Science / Numerical
7060 "numpy" ,
7161 "pandas" ,
7262 "scipy" ,
73- "sklearn" ,
74- "matplotlib" ,
7563 "pyarrow" ,
76- "networkx" ,
77- "joblib" ,
78- "threadpoolctl" ,
79- "kiwisolver" ,
80- "fontTools" ,
81- "dill" ,
82- "cloudpickle" ,
8364
8465 # Serialization / Config
8566 "yaml" ,
8667 "pydantic" ,
8768 "pydantic_core" ,
88- "pydantic_settings" ,
8969 "attrs" ,
9070 "tomli" ,
91- "tomlkit" ,
9271 "jsonschema" ,
9372 "jsonschema_specifications" ,
94- "jsonpointer" ,
9573 "jmespath" ,
96- "msgpack" ,
97- "isodate" ,
98- "ruamel" ,
9974
10075 # Cryptography / Security
10176 "cryptography" ,
10277 "cffi" ,
10378 "pycparser" ,
10479 "rsa" ,
10580 "pyjwt" ,
106- "jwt" ,
10781 "pyasn1" ,
10882 "pyasn1_modules" ,
109- "OpenSSL" ,
110- "nacl" ,
111- "bcrypt" ,
112- "asn1crypto" ,
113- "paramiko" ,
114- "secretstorage" ,
115- "msal" ,
116- "msal_extensions" ,
117- "keyring" ,
11883
11984 # Date / Time
12085 "dateutil" ,
12186 "pytz" ,
12287 "tzdata" ,
123- "tzlocal" ,
12488
125- # Google
89+ # Google / gRPC
12690 "google" ,
127- "google_auth_oauthlib" ,
128- "google_auth_httplib2" ,
129- "google_crc32c" ,
130- "googleapiclient" ,
13191 "grpc" ,
13292 "grpc_status" ,
13393 "grpc_tools" ,
13494 "protobuf" ,
135- "proto" ,
13695 "googleapis_common_protos" ,
13796
13897 # Testing
13998 "pytest" ,
14099 "pluggy" ,
141100 "iniconfig" ,
142- "coverage" ,
143- "exceptiongroup" ,
144101
145102 # CLI / Terminal
146103 "click" ,
147- "typer" ,
148104 "colorama" ,
149105 "rich" ,
150106 "tqdm" ,
151- "tabulate" ,
152- "prompt_toolkit" ,
153- "shellingham" ,
154- "wcwidth" ,
155107
156108 # Web Frameworks
157- "flask" ,
158- "werkzeug" ,
159- "itsdangerous" ,
160- "blinker" ,
161- "fastapi" ,
162109 "starlette" ,
163- "uvicorn" ,
164110
165111 # Templates / Markup
166112 "jinja2" ,
167113 "markupsafe" ,
168114 "pygments" ,
169115 "markdown_it" ,
170116 "mdurl" ,
171- "docutils" ,
172117
173118 # Async
174119 "anyio" ,
175120 "greenlet" ,
176121 "aiosignal" ,
177122 "aiohappyeyeballs" ,
178- "async_timeout " ,
123+ "frozenlist " ,
179124
180125 # Database
181126 "sqlalchemy" ,
182- "alembic" ,
183- "redis" ,
184- "psycopg2" ,
185127
186128 # Parsing / XML
187- "lxml" ,
188- "bs4" ,
189- "soupsieve" ,
190129 "pyparsing" ,
191- "regex" ,
192130 "et_xmlfile" ,
193131
194132 # OpenTelemetry
195133 "opentelemetry" ,
196134
197- # Azure
198- "azure" ,
199-
200135 # Other Popular Modules
201136 "six" ,
202137 "fsspec" ,
205140 "rpds" ,
206141 "pathspec" ,
207142 "PIL" ,
208- "pillow" ,
209143 "psutil" ,
210144 "referencing" ,
211145 "trove_classifiers" ,
212146 "openpyxl" ,
213- "tenacity" ,
214- "more_itertools" ,
215- "sortedcontainers" ,
216- "decorator" ,
217- "ptyprocess" ,
218- "pexpect" ,
219- "hatchling" ,
220147 "dotenv" ,
221- "python_dotenv" ,
222- "huggingface_hub" ,
223- "transformers" ,
224- "openai" ,
225- "langsmith" ,
226- "dns" ,
227- "dnspython" ,
228- "git" ,
229- "gitdb" ,
230- "smmap" ,
231- "deprecated" ,
232- "chardet" ,
233- "backoff" ,
234- "ruff" ,
235- "setuptools_scm" ,
236- "pyproject_hooks" ,
237- "jiter" ,
238148 "yandexcloud" ,
239- "aliyunsdkcore" ,
240- "uritemplate" ,
241- "kubernetes" ,
242- "snowflake" ,
243- "multipart" ,
149+ "cachetools" ,
244150})
245151
246152
153+ _known_modules_cache : frozenset [str ] | None = None
154+
155+
247156def get_stdlib_modules (
248157 stdlib_versions : StdlibVersions ,
249158 python_version : tuple [int , int ] | None = None ,
@@ -264,7 +173,11 @@ def get_known_modules(
264173 stdlib_versions : StdlibVersions | None = None ,
265174 python_version : tuple [int , int ] | None = None ,
266175) -> frozenset [str ]:
176+ global _known_modules_cache
177+ if _known_modules_cache is not None :
178+ return _known_modules_cache
267179 modules : set [str ] = set (POPULAR_THIRD_PARTY_MODULES )
268180 if stdlib_versions is not None :
269181 modules = modules .union (get_stdlib_modules (stdlib_versions , python_version ))
270- return frozenset (modules )
182+ _known_modules_cache = frozenset (modules )
183+ return _known_modules_cache
0 commit comments