News for hackers. Stuff that matters.

Ask HN: Which Python Type Checker?

I've worked with Python in the past but never went deep enough to compare the typecheckers. There are several: Pyre, Pyright, Mypy, Pytype.

It's unclear which is the best choice. I'd love to hear the take of a seasoned Python developer.

( 3 comments | on HN )
Re:Ask HN: Which Python Type Checker? by darthrupert on Saturday March 18, 2023 @09:17AM (#35208863)
I've had best experiences with pyright, i.e. fewer false negatives, reasonable speeds and good error messages.
Re:Ask HN: Which Python Type Checker? by parentheses on Saturday March 18, 2023 @12:55PM (#35210766)
Thank you. That’s what I started with last night. That was the default on my previous project as well. It seemed like a good shortcut decision.

What kinds of false negatives are we talking about? Are you referring to mixing untyped and typed code?

How is the support for libraries? Does support depend on using one typechecker in particular?

Re:Ask HN: Which Python Type Checker? by anthonyhn on Saturday March 18, 2023 @01:07PM (#35210903)
I typically use mypy. It's been around for over a decade, is available in many package repos, and has pretty good integration with vim lint plugins such as ALE (https://github.com/dense-analysis/ale).