microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
912 stars 133 forks source link

Source for numpy stubs #1782

Closed rlee287 closed 5 years ago

rlee287 commented 5 years ago

Where do the type stubs for numpy come from? I would like to copy the stubs in this repo for use in my own checking with mypy, but I would like to confirm first that there is no upstream source from which these were pulled. The commit that introduced these type stubs (a4d7a4b2e5a944cd874b309a7582c575b757c5cf) does not mention a source, and the file in question has not been modified since then.

jakebailey commented 5 years ago

Those stubs were hand-written to try and fix some common cases we can't handle (because we don't yet attempt to parse numpy's docstring format for type info); there is no upstream source as they are original. They're incomplete, and work because we merge "real" analysis results with stubs to produce a nice result.

We haven't worked on them since, but there does appear to be some development of stubs being done at: https://github.com/numpy/numpy-stubs

Note that for our purposes, the stubs are a way to provide better completion / usability in the editor, so they might be inaccurate for a strict checker. Your mileage may vary.

jakebailey commented 5 years ago

Closing, since this is a question, but feel free to follow up.