To the obvious question: how does this differ from mypy?<p>tldr; mostly about performance improvements but there's also semantic differences. The latter sounds like it means a split between the community who decides to do mypy vs pyright. But maybe pyright only differs with mypy in terms of things that are considered bugs in mypy, and things that are optional in mypy (via flags).<p><a href="https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md">https://github.com/microsoft/pyright/blob/main/docs/mypy-com...</a>.
From this comparison (<a href="https://github.com/microsoft/pyright/blob/main/docs/mypy-comparison.md">https://github.com/microsoft/pyright/blob/main/docs/mypy-com...</a>) it looks like Pyright fixes a load of issues that MyPy has. It also seems much closer to how TypeScript works (I have worked significantly more with TypeScript than typed Python and really like it)<p>Is there a reason <i>not</i> to go with Pyright and stick with MyPy?
I've been using pyright more than mypy these days; playing with higher order functions I have pulled about half of my hair out because of things that more often than not turn out to be mypy bugs. I've tried pyre, and that's better too, in my experience. The codebases of mypy and pyre are starkly different in terms of organization (though pyre does the heavy lifting in OCaml). Haven't looked at pyright's yet.<p>Besides the bug count, it's kind of weird to see the "reference" type checker for Python constantly lagging behind in terms of features, experimental ones but also ones that have already been accepted PEPs for a while. Meanwhile pyre and pyright both have usually had features for _months_ before mypy has even started implementing them.<p>As a side question, does anyone know how I can easily interface with an LSP client from Python? I'm itching to build something that gives me some custom typing insight as I write code, and it's probably more robust to consult LSP than to parse CLI output.
Has anyone migrated a large code base between MyPy and Pyright? In particular would love to hear about experiences with Django.
Mypy’s performance and the join based type merging are quite limiting. At the same time, the ecosystem support around MyPy seems strong.
I can vouch for use of Pyright as LSP for neovim and helix. Very useful, especially the strict mode.<p>I usually pair it with pyre, another great tool<p><a href="https://github.com/facebook/pyre-check">https://github.com/facebook/pyre-check</a>
I use both mypy and pyright. Pre-commit hook/vscode runs checks for mypy, pyright, as well as pylint, flake8, black, bandit.<p>Why both? I just have more confidence in getting feedback from both of the tools.
For Neovim users that use LSP + completion + snippets, it is slightly unfortunate that the Pyright team does not plan to support snippets on Pyright (but open to supporting it on Pylance, which is not OSS).<p><a href="https://github.com/microsoft/pyright/issues/924">https://github.com/microsoft/pyright/issues/924</a>
Moved Colour to Pyright a few weeks ago, our Mypy checks on Github Actions were taking 1h30. Those speed regressions were fixed recently though but Pyright is still much faster and seems stricter, finding more legit issues than Mypy.
Microsoft: "Where do you want to go today?"<p><a href="https://youtu.be/T4oNA8ViuwI?t=63" rel="nofollow">https://youtu.be/T4oNA8ViuwI?t=63</a>