Open simonjayhawkins opened 5 years ago
Yea I started along this path in #26645 . The hang up on that was some of the internal imports which (maybe?) require stubs. Never went far beyond that so if you want to dive deeper I think still worth exploring
I think we should create stubs for pyx files.
It would be nice if this could be done automatically (@mrocklin wrote http://matthewrocklin.com/blog/work/2017/11/05/cython-everywhere which mentioned use of cython in regular .py files instead of creating .pyx files)
if we create the stubs manually, i suspect there would not be an issue keeping them in sync, since changes to the code for .pyx file changes would likely cause mypy to report an error if the stub wasn't updated as well.
Cool yea I agree with everything you've mentioned above. Article is certainly interesting as well - not sure what limitations there are to that approach but worth exploring if you've got time and interest I think
I believe we will never be able to set ignore_missing_imports=False
unless all dependencies (optional or not) publish stubs or add a py.typed
marker. If this happens - great, but otherwise, I think there is nothing we can do here. Marking as a closing candidate.
in setup.cfg we currently have
mypy states "We recommend using this approach only as a last resort: it’s equivalent to adding a # type: ignore to all unresolved imports in your codebase." https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
the number of instances of missing imports resolving to Any is already significant..
Ideas for keeping this manageable?
cc @WillAyd