8000 docs: remove mention of missing standard library stubs (#9675) · python/mypy@1e6063d · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e6063d

Browse files
authored
docs: remove mention of missing standard library stubs (#9675)
I was looking at #4542, an old issue that I think we've mostly addressed, but nonetheless has an alarming number of likes. It occurs to me that front and centre we mention an issue that most people never run into in practice. I also pulled the details of this. mypy's hardcoded list of stdlib modules is incomplete, but here are the ones on the list that we do not have stubs for (I only checked Python 3): ``` {'__dummy_stdlib1', '__dummy_stdlib2', 'ossaudiodev', 'sqlite3.dump', 'turtledemo', 'xml.dom.expatbuilder', 'xml.dom.minicompat', 'xml.dom.xmlbuilder', 'xml.sax._exceptions', 'xml.sax.expatreader', 'xxlimited'} ``` We should maybe consider getting rid of the hardcoded list altogether. Co-authored-by: hauntsaninja <>
1 parent 57c8317 commit 1e6063d

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

docs/source/running_mypy.rst

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ follow the import.
133133

134134
This can cause errors that look like the following::
135135

136-
main.py:1: error: No library stub file for standard library module 'antigravity'
137-
main.py:2: error: Skipping analyzing 'django': found module but no type hints or library stubs
138-
main.py:3: error: Cannot find implementation or library stub for module named 'this_module_does_not_exist'
136+
main.py:1: error: Skipping analyzing 'django': found module but no type hints or library stubs
137+
main.py:2: error: Cannot find implementation or library stub for module named 'this_module_does_not_exist'
139138

140139
If you get any of these errors on an import, mypy will assume the type of that
141140
module is ``Any``, the dynamic type. This means attempting to access any
@@ -149,27 +148,7 @@ attribute of the module will automatically succeed:
149148
# But this type checks, and x will have type 'Any'
150149
x = does_not_exist.foobar()
151150
152-
The next three sections describe what each error means and recommended next steps.
153-
154-
Missing type hints for standard library module
155-
----------------------------------------------
156-
157-
If you are getting a "No library stub file for standard library module" error,
158-
this means that you are attempting to import something from the standard library
159-
which has not yet been annotated with type hints. In this case, try:
160-
161-
1. Updating mypy and re-running it. It's possible type hints for that corner
162-
of the standard library were added in a newer version of mypy.
163-
164-
2. Filing a bug report or submitting a pull request to
165-
`typeshed <https://github.com/python/typeshed>`_, the repository of type hints
166-
for the standard library that comes bundled with mypy.
167-
168-
Changes to typeshed will come bundled with mypy the next time it's released.
169-
In the meantime, you can add a ``# type: ignore`` to the import to suppress
170-
the errors generated on that line. After upgrading, run mypy with the
171-
:option:`--warn-unused-ignores <mypy --warn-unused-ignores>` flag to help you
172-
find any ``# type: ignore`` annotations you no longer need.
151+
The next sections describe what each error means and recommended next steps.
173152

174153
.. _missing-type-hints-for-third-party-library:
175154

@@ -275,8 +254,8 @@ this error, try:
275254
how you're invoking mypy accordingly.
276255

277256
3. Directly specifying the directory containing the module you want to
278-
type check from the command line, by using the :confval:`files` or
279-
:confval:`mypy_path` config file options,
257+
type check from the command line, by using the :confval:`mypy_path`
258+
or :confval:`files` config file options,
280259
or by using the ``MYPYPATH`` environment variable.
281260

282261
Note: if the module you are trying to import is actually a *submodule* of

0 commit comments

Comments
 (0)
0