Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import handling is confusing and misleading #4542

Closed
nedbat opened this issue Feb 5, 2018 · 49 comments
Closed

Import handling is confusing and misleading #4542

nedbat opened this issue Feb 5, 2018 · 49 comments

Comments

@nedbat
Copy link
Member

nedbat commented Feb 5, 2018

I tried mypy and was alarmed to see it unable to find imports that are clearly available. Reading the explanations in #1293 and #1339, I now understand why it doesn't merrily parse third-party code that will only add to a growing pile of unannotated code.

But this is a really bad first experience. I install something that claims to understand Python code, and it's confused by imports? Then it gives me two suggestions, neither of which is seems like the right advice:

note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)

I shouldn't try to set MYPYPATH, that's silly busy-work that if successful will only lead me into the unannotated third-party module trap. The imports aren't missing, so why would --ignore-missing-imports help? NOTE: using --ignore-missing-imports silences the warnings, but the option is misnamed: the imports are not missing.

Reading the help, I see --follow-imports, so I try those options. I try --follow-imports=silent, but that still complains about the imports. I try --follow-imports=skip, and that also still complains about the imports. Both of these sound like exactly what I need, and neither changes the behavior much:

$ mypy --version
mypy 0.560
$ mypy census.py
census.py:16: error: Cannot find module named 'aiohttp'
census.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
census.py:17: error: Cannot find module named 'async_timeout'
census.py:18: error: Cannot find module named 'attr'
census.py:20: error: Cannot find module named 'opaque_keys'
census.py:21: error: Cannot find module named 'opaque_keys.edx'
census.py:21: error: Cannot find module named 'opaque_keys.edx.keys'
helpers.py:3: error: No library stub file for module 'lxml'
helpers.py:3: note: (Stub files are from https://github.com/python/typeshed)
helpers.py:4: error: No library stub file for module 'lxml.html'
$ mypy --follow-imports=silent census.py
census.py:16: error: Cannot find module named 'aiohttp'
census.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
census.py:17: error: Cannot find module named 'async_timeout'
census.py:18: error: Cannot find module named 'attr'
census.py:20: error: Cannot find module named 'opaque_keys'
census.py:21: error: Cannot find module named 'opaque_keys.edx'
census.py:21: error: Cannot find module named 'opaque_keys.edx.keys'
$ mypy --follow-imports=skip census.py
census.py:16: error: Cannot find module named 'aiohttp'
census.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
census.py:17: error: Cannot find module named 'async_timeout'
census.py:18: error: Cannot find module named 'attr'
census.py:20: error: Cannot find module named 'opaque_keys'
census.py:21: error: Cannot find module named 'opaque_keys.edx'
census.py:21: error: Cannot find module named 'opaque_keys.edx.keys'
$ mypy --follow-imports=error census.py
census.py:16: error: Cannot find module named 'aiohttp'
census.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
census.py:17: error: Cannot find module named 'async_timeout'
census.py:18: error: Cannot find module named 'attr'
census.py:20: error: Cannot find module named 'opaque_keys'
census.py:21: error: Cannot find module named 'opaque_keys.edx'
census.py:21: error: Cannot find module named 'opaque_keys.edx.keys'
census.py:23: note: Import of 'html_writer' ignored
census.py:23: note: (Using --follow-imports=error, module not passed on command line)
census.py:24: note: Import of 'site_patterns' ignored
census.py:27: note: Import of 'sites' ignored
$ mypy --ignore-missing-imports census.py
$
@gvanrossum
Copy link
Member

Sorry you are having such a bad experience. Maybe PEP 561 will (eventually) make things better. And maybe we can improve the error messages.

In the meantime, in order to understand your predicament better, can you link to the contents of census.py, and explain where the things mypy couldn't find are installed?

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2018

census.py is here: https://github.com/edx/openedx-census/blob/4b242cc72896db002d9818a06bcdebdcdd6f8480/census.py

All of the imports mentioned in the error messages above are installed in the same virtualenv that mypy is installed into. Simply running "import aiohttp" succeeds, for example.

@gvanrossum
Copy link
Member

So for aiohttp the solution would be for someone to add stubs to typeshed, or to create a separate package of stubs using PEP 561 (soon to be accepted and implemented).

If you have a habit of splitting your 1st party project into multiple packages that are installed separately (IIUC that's what you do at Edx) that's also a bit of a problem for mypy compared to the workflow where most code is in a unirepo (like we do at Dropbox, and IIUC that's also how Instagram and other large current mypy users do it), since with the unirepo approach you only get this problem for 3rd party packages, which are usually in typeshed. This is also what --ignore-missing-imports was made for. I do think that PEP 561 should also help for your multi-repo approach.

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2018

You mention missing stubs. Perhaps this is the heart of the matter? The message says "missing imports", and what it means is, "missing stubs"? Or, I read it as trying to import Python, but it's trying to import stubs? Adding a few more words could clarify things.

FWIW: Although this code is in the edx org and about Open edX, it is a small-ish standalone program.

@gvanrossum
Copy link
Member

Not quite standalone (opaque_keys seems to be an edx package).

Maybe "missing imports" is indeed not the right term. When mypy sees import foo it looks for the code in a path that is constructed from $MYPYPATH plus the files from the command line (with some tweaks). In each directory along the path it looks for both a stub (foo.pyi) and a Python module (foo.py) and a package (foo/). When it doesn't find something, it doesn't know what's missing. So what should it say?

PS. People tend to counter "why doesn't it use $PYTHONPATH or sys.path" but that really doesn't work because the majority of code on sys.path is stdlib code which has no annotations and triggers complaints about all sorts of edge cases.

@glenjamin
Copy link

glenjamin commented Apr 2, 2018

I've just started playing around with mypy and run into this same confusion.

I think that something like "missing type definitions or type-annotated code for module foo" might be a more precise error message for this scenario.

I initially tried to get my environment to find the code, but what I actually need to do is provide type definitions for these modules in some way.

@glenjamin
Copy link

The flow project from facebook has a similar scope to mypy - i'm not sure whether or not I had a similar experience when beginning to use that project, but their docs section on how to work with library definitions seems relevant here: https://flow.org/en/docs/libdefs/

@ilevkivskyi
Copy link
Member

I think we could wait a bit until PEP 561 is implemented, then we can design a better error message that will better detect the situation and proposes possible solutions (with a link to the docs, like we do for a common error with invariant collections). @ethanhs what do you think?

@ethanhs
Copy link
Collaborator

ethanhs commented Apr 2, 2018

Yes, I think once #4693 is merged it would be good to take a look at updating and improving the missing module messages. Especially considering some of them (such as those that reference typeshed) may be misleading after PEP 561 packaging becomes the norm.

@jtratner
Copy link

jtratner commented Apr 9, 2018

I was quite confused by this too (at first I thought it was a virtualenv thing). Would folks be open to a page in the docs that has a separate section (for easier searchability) that looks like:

Common Errors
===========

Cannot find module named <foo>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some modules do not have stub files (yet!). When mypy encounters an import that cannot resolve to a stubfile... <copy from existing docs>

Also, perhaps changing the error message from:

census.py:16: error: Cannot find module named 'aiohttp'

to

census.py:16: error: Cannot find type stubs for module named 'aiohttp'

would make things clearer. "Cannot find module" is very similar to the ModuleNotFoundError you get on a typo on import.

@gvanrossum
Copy link
Member

How do you propose mypy should tell the difference between a module without a stub and a typo? It does not use the same module search path as the Python interpreter. For known standard library modules and for well-known third-party modules it does produce a different error message -- see the logic at

mypy/mypy/build.py

Lines 2059 to 2072 in 6784d85

elif ((manager.options.python_version[0] == 2 and moduleinfo.is_py2_std_lib_module(target))
or (manager.options.python_version[0] >= 3
and moduleinfo.is_py3_std_lib_module(target))):
errors.report(
line, 0, "No library stub file for standard library module '{}'".format(target))
errors.report(line, 0, stub_msg, severity='note', only_once=True)
elif moduleinfo.is_third_party_module(target):
errors.report(line, 0, "No library stub file for module '{}'".format(target))
errors.report(line, 0, stub_msg, severity='note', only_once=True)
else:
errors.report(line, 0, "Cannot find module named '{}'".format(target))
errors.report(line, 0, '(Perhaps setting MYPYPATH '
'or using the "--ignore-missing-imports" flag would help)',
severity='note', only_once=True)
. Perhaps you can provide an update to the list of well-known third-party modules? (It is in https://github.com/python/mypy/blob/master/mypy/moduleinfo.py.)

It's probably true that we need to improve the docs explaining how mypy finds modules though -- clearly this is a frequent source of confusion. (Many people assume mistakenly that mypy loads everything from sys.path.)

@jtratner
Copy link

jtratner commented Apr 9, 2018 via email

@sersorrel
Copy link

For known standard library modules and for well-known third-party modules it does produce a different error message

I wonder if producing a different error message for known third-party packages is actually more confusing… Such a list of packages will inevitably be incomplete, and it's not clear as an end user why some of your dependencies are being treated differently to others.

@gvanrossum
Copy link
Member

gvanrossum commented Apr 9, 2018 via email

@Lewiscowles1986
Copy link
Contributor

How do I contribute a .stub file?

backports.csv is being a pig. I'd like to support 2.7 (or latest 2.x) & 3.
from backports import csv seems to enable this, but mypy has an issue. It looks like it relates to these files.

@gvanrossum
Copy link
Member

@Lewiscowles1986 You will get better help from Gitter (where I see you already checked in).

@ulope
Copy link

ulope commented Sep 4, 2019

This issue seems to be a constant source of confusion and frustration for many starting out with mypy (judging by number of issues about this here and seeing this also in our team).

To me that clearly means the error message is less than it could be.

How do you propose mypy should tell the difference between a module without a stub and a typo?

Shouldn't checking if the module is importable (in the Python sense) be enough to make this distinction? If it is the type annotations are missing, if not it's either a typo or a missing package.

And even if the above is for some technical reason not easily implementable at least changing the error message to mention the possibility that it's the type definitions that can't be found would be a nice usability improvement.

@gvanrossum
Copy link
Member

changing the error message to mention the possibility that it's the type definitions that can't be found would be a nice usability improvement

I invite you to come up with a PR that implements this idea (there is indeed a technical reason why "checking if it is importable" is not a reasonable thing to try).

@ilevkivskyi
Copy link
Member

This issue seems to be a constant source of confusion and frustration for many starting out with mypy

And this is kind of normal. Although some people call mypy a linter, it is much closer to a compiler.
For people familiar with other languages it may be simpler to understand because they already know the difference between binary packages and header (dev) packages. For Python programmers this is something new, so one needs to read some docs.

Shouldn't checking if the module is importable (in the Python sense) be enough to make this distinction?

IMO this is a bad idea. Importing modules can have side effects (and sometimes bad ones).

at least changing the error message to mention the possibility that it's the type definitions

What exactly do you propose to change? Currently mypy gives dedicated errors for known packages:

test.py:1: error: No library stub file for module 'zope.interface'
test.py:1: note: (Stub files are from https://github.com/python/typeshed)

and a link to docs for unknown ones:

test.py:1: error: Cannot find module named 'mysterymodule'
test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

@ilevkivskyi
Copy link
Member

Didn't notice @gvanrossum already replied. Essentially I agree, improving error messages is the only thing we (including you) can do.

@sersorrel
Copy link

I'm interested in improving the error messages and documentation here. Does mypy currently distinguish between:

  • modules for which code has been found, but there is no py.typed marker, and
  • modules which can't be found at all?

If not, is it feasible to make such a distinction?

@gvanrossum
Copy link
Member

Mypy currently doesn't distinguish between modules that exist (in site-packages) without a py.typed marker and code that doesn't exist at all. The relevant search is in mypy/modulefinder.py (but I am aware that the logic there is pretty hard to follow).

Mypy does have a large list of "known popular modules" in mypy/moduleinfo.py -- maybe that list also needs updating?

@ulope
Copy link

ulope commented Sep 6, 2019

@ilevkivskyi

I guess part of the problem is that note message with the docs link only appears once (and apparently not necessarily at the first occurrence of the message). This can easily get lost in a big list of errors.

@ilevkivskyi
Copy link
Member

I guess part of the problem is that note message with the docs link only appears once (and apparently not necessarily at the first occurrence of the message). This can easily get lost in a big list of errors.

Showing this note for every error may be too noisy, potentially we can show it e.g. once in a file.

@JukkaL
Copy link
Collaborator

JukkaL commented Sep 6, 2019

I guess part of the problem is that note message with the docs link only appears once (and apparently not necessarily at the first occurrence of the message). This can easily get lost in a big list of errors.

What about making this a blocking error -- it would be prominent that way.

@ilevkivskyi
Copy link
Member

ilevkivskyi commented Sep 6, 2019

What about making this a blocking error -- it would be prominent that way.

But I thought blocking errors can't be # type: ignored. I would keep this possibility for users.

@kiwi0fruit
Copy link

kiwi0fruit commented Sep 14, 2019

Yeah. mypy has terrible UX about importing modules.

but the option is misnamed: the imports are not missing

+100500

If I can use modules then they are not missing. They may be not have stubs or something but at the same time I see both messages: Cannot find module named 'seaborn' and No library stub for module 'matplolib'. The latter I can understand but the former can only mean bug in the mypy (unless you use some other meaning for "cannot find" that differs drastically from common sence).

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 9, 2019

Marked this a high priority since this seems to affect many users, and there is some low-hanging fruit that could improve the situation.

JukkaL pushed a commit that referenced this issue Oct 28, 2019
It can be difficult to understand the missing module error message at times.

Changes

>  Cannot find module named '{}'

to

>  Cannot find implementation or library stub for module named '{}'

This improves #4542.
@nicoe
Copy link

nicoe commented Oct 28, 2019

Mypy does have a large list of "known popular modules" in mypy/moduleinfo.py -- maybe that list also needs updating?

If this list is here to stay (I haven't checked the code yet and I am not sure what impact #7698 have on this list). Would it be possible to have a way to specify "locally popular modules" in the configuration file?

eg: I work with Tryton, which is not a very popular. But the vast majority of code I import will have some code in the trytond namespace. Having the possibility to add some packages to the list would be handy.

@sersorrel
Copy link

@nicoe that seems unlikely to be terribly helpful; all that the list is used for, as far as I can tell, is deciding whether to say

No library stub file for module 'whatever'

or

Cannot find implementation or library stub for module named 'whatever'

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 28, 2019

Would it be possible to have a way to specify "locally popular modules" in the configuration file?

To better understand your use case, can you give an example of a scenario where this would be helpful? If it's locally popular, you could perhaps use stubgen to generate stubs for the package.

@nicoe
Copy link

nicoe commented Oct 28, 2019

To better understand your use case, can you give an example of a scenario where this would be helpful?

I came here through issue #7788 and indeed after testing stubgen it works. The minor annoyance is that I'll have to do it for every virtualenv but I can live with it.

@The-Compiler
Copy link
Contributor

@nicoe maybe you want something like

[mypy-sql]
ignore_missing_imports = True

in your mypy.ini?

@pawamoy
Copy link
Sponsor

pawamoy commented Jan 2, 2020

I had trouble understanding how mypy works with third party packages as well. I just spent something like 40 minutes testing things and reading issues and the documentation to understand.

My thoughts and actions when trying mypy the first time:

  1. mypy uses type annotations in my code
  2. if my code imports other packages, mypy will read their type annotations (seems obvious 😄 ?)
  3. but mypy says cannot find module named fastapi: am I running in the right virtualenv? Does fastapi have type annotations? Yes and yes. So why can't mypy find fastapi?
  4. reading the --help and the docs, ignore or silent "missing" imports does not seem to be what I need
  5. I then somehow tell myself that fastapi or other third party packages must not be "mypy-compatible"?
  6. searching the issues, I finally find information about this in How to make packages compatible with mypy #2625: PEP 561, which says to put a py.typed file in your package (and to add it to the release files when building)
  7. knowing this, I now search mypy docs, and find Using installed packages

Maybe this last docs section should be added in a section of the README titled ## Running mypy on a project, including third-party packages, clearly stating that every third-party package you depend on must provide stubs or inline annotations with a py.typed (empty) file.

So, if I got it right, I should just open a PR on fastapi with a new file py.typed in the root package to make it mypy-compatible?

Well, I just looked and this file is already there! So I'm lost again...

I finally solved that by setting MYPYPATH environment variable to the site-packages of my virtualenv, and am left wondering how I will automate that in my makefile or in CI.

EDIT: I was tired. Mypy was not installed in the virtualenv. It's working as expected, without having to add site-packages to MYPYPATH. Clearly a "did you try to turn it off an on again" case. But anyway, I still learned some things 🙂 Thank you @The-Compiler and @ethanhs for your help.

@The-Compiler
Copy link
Contributor

@pawamoy As far as I understand, having a py.typed marker doesn't make any sense if a package doesn't have any type annotations. Instead, ignoring missing imports is what you want. See my comment above for an example - that way, you're essentially saying "I'm aware I'm using this third-party packages mypy doesn't know details about".

@pawamoy
Copy link
Sponsor

pawamoy commented Jan 2, 2020

@The-Compiler of course, but in my case, fastapi does have type annotations, and I wanted to take advantage of them. I just had real trouble understanding that yes, you need to add the virtualenv site-packages path to MYPYPATH, even if the packages are importable at runtime. I guess this is what I would emphasize if I had to show someone how mypy works 🙂

The TL;DR is:

  1. put $venv/lib/site-packages in MYPYPATH
  2. if packages are"missing", check that they use type annotations and that they ship a py.typed marker file. If they do not, use the configuration options to ignore them.

EDIT: don't add your site-packages to MYPYPATH. This is not desirable as mypy will pick every package, even the non-typed ones, generating errors.

@The-Compiler
Copy link
Contributor

The-Compiler commented Jan 2, 2020

Ah, indeed, I missed that bit in your comment. Yeah, as soon as fastapi is reasonably sure its type annotations are correct/stable, it should probably ship a py.typed file (I think you'll need to add something like package_data={'fastapi': ['py.typed']} to setup.py as well)

@ethanhs
Copy link
Collaborator

ethanhs commented Jan 2, 2020

@pawamoy you should never add site-packages to your mypy path. If there is a package that is PEP 561 compatible in the venv you should be able to use it. Is mypy globally installed? If so you may need to pass the venv Python executable to mypy.

@ethanhs
Copy link
Collaborator

ethanhs commented Jan 3, 2020

@pawamoy you can chat on gitter and get help there in real time (https://gitter.im/python/typing)

@pawamoy
Copy link
Sponsor

pawamoy commented Jan 3, 2020

Edited my comments accordingly, thanks @ethanhs

Michael0x2a added a commit to Michael0x2a/mypy that referenced this issue Jan 4, 2020
This pull request is an attempt at mitigating
python#4542 by making
mypy report a custom error when it detects installed
packages that are not PEP 561 compliant.

(I don't think it resolves it though -- I've come to
the conclusion that import handling is just inherently
complex/spooky. So if you were in a cynical mode, you
could perhaps argue the issue is just fundamentally
unresolvable...)

But anyways, this PR:

1.  Removes the hard-coded list of "popular third party
    libraries" from `moduleinfo.py` and replaces it with
    a heuristic that tries to find when an import "plausibly
    matches" some directory or Python file while we search
    for packages containing ``py.typed``.

    If we do find a plausible match, we generate an error
    that looks something like this:

    ```
    test.py:1: error: Skipping analyzing 'scipy': found module but no type hints or library stubs
    test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
    ```

    The heuristic I'm using obviously isn't foolproof since
    we don't have any obvious signifiers like the ``py.typed``
    file we can look for, but it seemed to work well enough
    when I tried testing in on some of the libraries in the old list.

    Hopefully this will result in less confusion when users
    use a mix of "popular" and "unpopular" libraries.

2.  Gives us a way to add more fine-grained "module not found"
    error messages and heuristics in the future: we can add
    more entries to the ModuleNotFoundReason enum.

3.  Updates the docs about missing imports to use these new
    errors. I added a new subsection per each error type to
    try and make things a little less unwieldy.

4.  Adds what I think are common points of confusion to the
    doc -- e.g. that missing imports are inferred to be of
    type Any, what exactly it means to add a `# type: ignore`,
    and the whole virtualenv confusion thing.

5.  Modifies the docs to more strongly discourage the use
    of MYPYPATH. Unless I'm wrong, it's not a feature most
    people will find useful.

One limitation of this PR is that I added tests for just ModuleFinder.
I didn't want to dive into modifying our testcases framework to support
adding custom site-packages/some moral equivalent -- and my PR
only changes the behavior of ModuleFinder when it would have originally
reported something was not found, anyways.
Michael0x2a added a commit that referenced this issue Feb 23, 2020
This pull request is an attempt at mitigating
#4542 by making
mypy report a custom error when it detects installed
packages that are not PEP 561 compliant.

(I don't think it resolves it though -- I've come to
the conclusion that import handling is just inherently
complex/spooky. So if you were in a cynical mode, you
could perhaps argue the issue is just fundamentally
unresolvable...)

But anyways, this PR:

1.  Removes the hard-coded list of "popular third party
    libraries" from `moduleinfo.py` and replaces it with
    a heuristic that tries to find when an import "plausibly
    matches" some directory or Python file while we search
    for packages containing ``py.typed``.

    If we do find a plausible match, we generate an error
    that looks something like this:

    ```
    test.py:1: error: Skipping analyzing 'scipy': found module but no type hints or library stubs
    test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
    ```

    The heuristic I'm using obviously isn't foolproof since
    we don't have any obvious signifiers like the ``py.typed``
    file we can look for, but it seemed to work well enough
    when I tried testing in on some of the libraries in the old list.

    Hopefully this will result in less confusion when users
    use a mix of "popular" and "unpopular" libraries.

2.  Gives us a way to add more fine-grained "module not found"
    error messages and heuristics in the future: we can add
    more entries to the ModuleNotFoundReason enum.

3.  Updates the docs about missing imports to use these new
    errors. I added a new subsection per each error type to
    try and make things a little less unwieldy.

4.  Adds what I think are common points of confusion to the
    doc -- e.g. that missing imports are inferred to be of
    type Any, what exactly it means to add a `# type: ignore`,
    and the whole virtualenv confusion thing.

5.  Modifies the docs to more strongly discourage the use
    of MYPYPATH. Unless I'm wrong, it's not a feature most
    people will find useful.

One limitation of this PR is that I added tests for just ModuleFinder.
I didn't want to dive into modifying our testcases framework to support
adding custom site-packages/some moral equivalent -- and my PR
only changes the behavior of ModuleFinder when it would have originally
reported something was not found, anyways.
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2020
I was looking at python#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.
JukkaL pushed a commit that referenced this issue Nov 4, 2020
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 <>
@hauntsaninja
Copy link
Collaborator

I think #8238 does a good job of improving the situation here, so I'm tentatively going to close this issue. As always, if you see ways for the error messages to be improved, let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests