4 ms·
I use mypy[0] for PEP-484 type checking on a regular basis in large projects. PyCharm[1] supports PEP-484 type checking as well and displays errors in the edito
by okl 8y ago
I use mypy[0] for PEP-484 type checking on a regular basis in large projects.
PyCharm[1] supports PEP-484 type checking as well and displays errors in the editor.
--
[0] - http://mypy-lang.org/ http://mypy-lang.org/
[1] - https://www.jetbrains.com/pycharm/ https://www.jetbrains.com/pycharm/
- mylons 8y agopycharm is so good.
- gipp 8y agoMypy is the standard, but too slow to integrate into editors (more appropriate for CI). PyCharm built its own implementation for this reason, but of course it's proprietary. Pyre's trying to get typecheck integration into other editors.
- sametmax 8y agoI got mypy plugged in on VSCode. It works very well. You don't get error reporting at the very second you type things but it never bothered me. I was more annoyed that it was practically unusable for years. Saner defaults, bug fixes and new types made it finally useful in late 2017.
- klibertp 8y agoWhy do you think it's too slow? I have it integrated with Emacs' flymake and it works pretty well. It takes less than a second to run mypy and display its results (with red underline or whatever else you have configured). From my experience, Visual Studio with F# takes similar time to type-check and show errors.
- zokier 8y agoA second is an eternity for interactive use.
- klibertp 8y agoOk, I don't know myself, because I stopped looking for the next editor years ago, so I'd like to ask: do you know how long it takes, on average, for IDEs and editors to highlight a type error?
- m45t3r 8y agoWell, I am start to writing some Typescript with tslint configured on save, and it takes way more than 1 second for a small toy project. Even just building this project with Typescript compiler takes more than 1 second. And I don't think it is that bad because at least the process is async.
- elbear 8y agoInteresting. I write TypeScript in PyCharm and I get feedback as soon as I write (PyCharm performs save automatically). I don't know how they implemented it that it's so fast.
- komon 8y agoWell, PyCharm is already doing a lot of parsing for syntax highlighting and autocompletion and other goodies. They're checker implementation probably just takes the AST PyCharm already has available to it, which saves the round-trip of saving to a file and having an outside checker open and re-parse the file.
- BLanen 8y agoI've had to disable mypy a couple time for specific parts that it doesn't understand. Very annoying how it breaks on non-trivial stuff because that'd be the use case where you'd want it most. I've never had it prevent a problem. I like staticly/strongly typed languages for this reason and putting optional type annotations into a language is never going to work out imo.
- weberc2 8y agoI upvoted because I had a similar experience; however, your conclusion doesn't follow. Python's borked type checking doesn't mean optional type annotations are fundamentally not going to work out. In particular, if Python added support for Go-like interfaces and recursive types, it wouldn't fall over for ~99% of nontrivial cases.
- thomasahle 8y agoI just tried both mypy and pyre for the first time. Pyre immediately found two actual issues, but mypy found a thousand possible ones. Maybe I just need to configure mypy better.