Mypy third-party stubs
See original GitHub issueSince Mypy 0.900 third-party stubs are not shipped by default. Can (I’m not sure if it’s viable) the pre-commit hook be updated to run mypy --install-types
to install all missing stub package prior to running the mypy
command?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Stub files - mypy 0.991 documentation
Mypy uses stub files stored in the typeshed repository to determine the types of standard library and third-party library functions, classes, ...
Read more >Third-party stubs: recommending a default path for installing ...
My plan is to only have stubs/python2 and stubs/python3 (or similar) in mypy. Also, should the directory be shared/python/typehints/... instead (i.e., with / ......
Read more >one-off 3rd party mypy types (intermediate) anthony explains ...
today I show how to fix "Cannot find implementation or library stub for module named ..." errors in mypy by writing our own...
Read more >python - Extending stub file for a third-party library/module
So, how can I, within my own project, "tack on" (or extend) an instance attribute annotation to URL so that it can be...
Read more >Missing types | Code Cookbook - Michael Currin
Write your own stub files containing type hints for the library. You can point mypy at your type hints either by passing them...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
to be clear,
args: [--install-types]
may possibly work but is not supported because it mutates the pre-commit environment at runtime – pre-commit environments are intended to be immutable. it will also, for instance, not work in https://pre-commit.ci where network is forbidden at runtime.also note that this is not a new problem, the isolated mypy virtualenv has always been missing some amount of stubs – just now it is missing more of them.
auto-enabling
--install-types
will not happen here but you’re free to proceed in unsupported territory if you want.I tried this in
.pre-commit-config.yaml
and it worked: