3 ms·
As someone who hasn't started using types in Python seriously yet, it's a bit discouraging to see that there are already so many competing type checkers with di
by hiq 5y ago
As someone who hasn't started using types in Python seriously yet, it's a bit discouraging to see that there are already so many competing type checkers with different approaches and no clear winner. I understand that the problem is a bit harder than `{go, cargo} fmt`, but I feel we'd be better off with one type checker to rule them all.
Or does it mean that we should check types using all type-checkers available to have the most compliant code possible?
- Mehdi2277 5y agoIn practice they are quite similar in errors reported. There are differences that pop up but most of the time either it is bug to report or one has implemented a certain pep faster than another. A few rare things are extra type checking support entirely like pyright supports recursive types but mypy does not (or pyre has best tensor related support but those are future peps). Mypy's biggest unique thing is plugin support and some very dynamic libraries use plugins for better coverage. The differences should become peps if important enough and then eventually be supported by all 4. I think for most people any of the 4 big ones is fine. Most of the common type errors will look identical regardless of which you pick. Configuring multiple in CI is pretty straightforward if you want to go full. My current codebase has mypy + pyright configured. Pyright was a mix of fast response time on github issues + I use vscode and was the one that added type checks to CI. If you want a deep dive pycon is this week I think and there's a day for type checking related talks including one talk comparing the 4. I think type checking day is thursday.
- flakiness 5y agoThanks for the tip! Posting link here for the reference: https://us.pycon.org/2021/summits/typing/ https://us.pycon.org/2021/summits/typing/ Hope they post the recordings somewhere later.
- ben509 5y agoNo, multiple checkers will drive you crazy because one type checker will support one feature while another will report errors for it.