[Numpy-discussion] Is there any official position on PEP484/mypy?

Daniel Moisset dmoisset at machinalis.com
Wed Jul 27 15:07:05 EDT 2016


I work at Machinalis were we use a lot of numpy (and the pydata stack in
general). Recently we've also been getting involved with mypy, which is a
tool to type check (not on runtime, think of it as a linter) annotated
python code (the way of annotating python types has been recently
standarized in PEP 484).

As part of that involvement we've started creating type annotations for the
Python libraries we use most, which include numpy. Mypy provides a way to
specify types with annotations in separate files in case you don't have
control over a library, so we have created an initial proof of concept at
[1], and we are actively improving it. You can find some additional
information about it and some problems we've found on the way at this
blogpost [2].

What I wanted to ask is if the people involved on the numpy project are
aware of PEP484 and if you have some interest in starting using them. The
main benefit is that annotations serve as clear (and automatically
testable) documentation for users, and secondary benefits is that users
discovers bugs more quickly and that some IDEs (like pycharm) are starting
to use this information for smart editor features (autocompletion, online
checking, refactoring tools); eventually tools like jupyter could take
advantage of these annotations in the future. And the cost of writing and
including these are relatively low.

We're doing the work anyway, but contributing our typespecs back could make
it easier for users to benefit from this, and for us to maintain it and
keep it in sync with future releases.

If you've never heard about PEP484 or mypy (it happens a lot) I'll be happy
to clarify anything about it that might helpunderstand this situation



[1] https://github.com/machinalis/mypy-data
[2] http://www.machinalis.com/blog/writing-type-stubs-for-numpy/

Daniel F. Moisset - UK Country Manager
Skype: @dmoisset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160727/fe12a24e/attachment.html>

More information about the NumPy-Discussion mailing list