Skip to content

Missing attributes found running mypy on the standard library #2149

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

Closed
15 of 18 tasks
emmatyping opened this issue May 18, 2018 · 9 comments
Closed
15 of 18 tasks

Missing attributes found running mypy on the standard library #2149

emmatyping opened this issue May 18, 2018 · 9 comments
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module

Comments

@emmatyping
Copy link
Member

emmatyping commented May 18, 2018

The following are missing from stubs:

  • codecs
  • pkgutil.read_code
  • inspect.CO_COROUTINE
  • inspect.CO_ASYNC_GENERATOR
  • pickle.bytes_types
  • pickle.decode_long
  • tkinter.simpledialog
  • pdb.Pdb
  • msvcrt.setmode
  • sre_compile.SRE_FLAG_*
  • urrlib.request.HTTPError
  • docutils.parsers.rst.Parser
  • docutils.frontend
  • multiprocessing.get_start_method
  • multiprocessing.get_context
  • multiprocessing.TimeoutError
  • multiprocessing.AuthenticationError
  • multiprocessing.BufferTooShort

There also seem to be several uses of _thread, but I'm not familiar with typeshed's policy with "private" modules.

@srittau
Copy link
Collaborator

srittau commented Sep 13, 2018

urllib.request.HTTPError actually looks like a genuine problem, since HTTPError is defined in urllib.error. urllib.request does also not include it in __all__.

@srittau
Copy link
Collaborator

srittau commented Sep 17, 2020

msvcrt.setmode() will be added in #4548.

@srittau
Copy link
Collaborator

srittau commented Sep 17, 2020

I checked a few more items that exist now.

srittau added a commit to srittau/typeshed that referenced this issue Sep 17, 2020
@srittau
Copy link
Collaborator

srittau commented Sep 17, 2020

#4554 addresses most of these, with the exception of tkinter.simpledialog and docutils.*. The latter isn't part of the stdlib, so I wonder where this is referenced. There is already a stub for _thread, so this should also be fine.

@srittau srittau added stubs: incomplete Annotations or sub-modules missing from an existing package or module and removed stubs: false positive Type checkers report false errors labels Sep 17, 2020
hauntsaninja pushed a commit that referenced this issue Sep 20, 2020
@srittau
Copy link
Collaborator

srittau commented Feb 23, 2021

@ethanhs Do you remember what you did to check the stdlib? Was it a simple mypy call or was it more involved? I think it would be good idea for us to run a check like this on a regular basis.

@emmatyping
Copy link
Member Author

@srittau I'm pretty sure it was a direct invocation of mypy on typeshed

@hauntsaninja
Copy link
Collaborator

stubtest will find missing things (in CI we run with --ignore-missing-stub, so it doesn't)

@srittau
Copy link
Collaborator

srittau commented Apr 8, 2021

Apart from the problem with urllib.request.HTTPError (for which I filed python/cpython#22304), all should be fixed, although docutils mostly consists of __getattr__() stubs.

@srittau srittau closed this as completed Apr 8, 2021
@emmatyping
Copy link
Member Author

emmatyping commented Apr 8, 2021

Wow awesome! 🎉

Edit: Also on how I checked this, I think I ran mypy on the standard library one file/package at a time at one point on a flight home from pycon. I don't remember exactly how I did it but I agree it might be good to do from time to time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module
Projects
None yet
Development

No branches or pull requests

3 participants