It would be wonderful to have static typing warnings via mypy-lang pop up directly in the IDE like the current static code analysis does. Is this a planned feature?
It's not in our roadmap, sorry. Maybe this could be implemented as a plugin, after Spyder 3.0 is released (in a couple of months :-)
It's a big thing for the next python version so it should be a priority after 3.0.
PyCharm supports PEP 484, and I would love for Spyder to do the same. See http://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/
Any chance to have MyPy implemented in version 4.0? Could not find any reference to it, would be a great addition to the linter section. Running MyPy from the command line is really tedious.
@RnoldR spyder for now uses the Language Server Protocol for the completion archetecture and can use plugins written for it like:
https://github.com/tomv564/pyls-mypy
So in theory there is support out of the box by installing that package
@ccordoba12 should we consider including this as a dependency?
should we consider including this as a dependency?
We need to check if that plugin flags things without typing as warnings/errors because that would be very confusing to newbies. If not, then I agree to add it as another dependency.
@steff456, please install pyls-mypy and check how things look with it. Thanks!
Great for looking into this! Agree that untyped variables should not be flagged, which is also required by PEP 484. Some quick tests indicate that mypy does not flag untyped variables.
Let me know if I can test.
If you're using not using Anaconda, you can test this right now by running
pip install pyls-mypy
It works! I'll start experimenting right away.
Oh, an oversight: I use Anaconda but it still works.
But it broke my installation, most packages are gone. Fortunately that only happened in the test environment. Other environments seem to be untouched.
but it still works
Great!! @steff456 will do more tests, and if everything goes well, we could provide out of the box support for MyPy in our next beta.
That would make me very happy! MyPy is a great addition, it really makes my code better.
@ccordoba12 I already try it in an environment created with pip, not conda and it is working fine and the environment is not broken.
I have tested more thoroughly and it seems to work now, I had some issues with my spyder 4 install which I resolved and it all seems to work fine. I'll continue rewriting my code and will report if something is found. Thanks for all your efforts!
@RnoldR, yes, please let us know if you encounter any issues so we can be more confident when adding that package as one more of our dependencies.
Just tested on Python 3.7.4 ; Spyder 4.1.3 and pyls-mypy 0.1.8. Works like a charm. And I recently discovered that even Cython benefits from type annotations too. Thank you very much, I discovered all that just because of this ticket. Great addition!
Thanks! We'll provide a simpler experience to enable and work with MyPy in our 4.2.0 version, to be released in a couple of months.