[scikit-learn] Is there any official position on PEP484/mypy?

Sebastian Raschka mail at sebastianraschka.com
Thu Jul 28 14:49:39 EDT 2016


I am not a core dev but just wanted to say that I like the idea of adding static type checking a lot, Daniel. Coincidentally, I just listened to the Podcast.__init__ episode on mypy a few weeks ago and was planning to use it in my personal + research projects as well. 

I think the “normal” scikit-learn user would not really benefit from it (since the docstrings are already pretty good and thorough), but I think that it can be immensly useful for devs and contributors (and augmenting the unittest)

> We can put mypy in the CI, right? Shouldn't that prevent it from rotting?

Yeah, it can be added to Travis CI checks, for example.

One question though, are you planning to apply the “whole" type checking syntax? E.g., 

def hello(r: int, c=5) -> str:
    s = 'hello'  # type: str
    return '(%d + %d) times %s' % (r, c, s)

Does this work with Python 2.7, 3.4 etc?

Or are you only thinking about the “comment” syntax? E.g., 

def hello(r, c=5):
    s = 'hello'  # type: str
    return '(%d + %d) times %s' % (r, c, s)

Which should work on all Py versions.

Best,
Sebastian


> On Jul 28, 2016, at 12:49 PM, Andreas Mueller <t3kcit at gmail.com> wrote:
> 
> 
> 
> On 07/28/2016 12:43 PM, Gael Varoquaux wrote:
>> On Thu, Jul 28, 2016 at 12:04:48PM -0400, Andreas Mueller wrote:
>>> If you find some bugs with the annotations and mypy, that would probably
>>> prove its value to some degree [and if you don't, I might be inclined to
>>> argue it's not working well ;]
>>> Joel, Olivier, Gael, anyone else?: opinions?
>> The only reserve that I might have is with regards to the maintainability
>> of these annotation. I am afraid that they coderot.
>> 
>> Daniel, any comments on that concern?
> We can put mypy in the CI, right? Shouldn't that prevent it from rotting?
> [I don't actually know. Daniel?]
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn



More information about the scikit-learn mailing list