github microsoft/pyright 1.1.0
Published 1.1.0

latest releases: 1.1.384, 1.1.383, 1.1.382...
4 years ago

This version of pyright features a rewrite of the type checking engine. I've decided to bump the minor version to 1.1 accordingly. I've done significant testing of the new version, but it's possible (likely) that there will be some regressions or behavioral changes. Please report any problems you encounter, and I'll try to fix them quickly.

The old type checking engine was a multi-pass analyzer. In each pass, it attempted to resolve the types for each symbol at each point in the program. To handle cyclical dependencies between types, it analyzed each file multiple times — often two or three — until all of the types converged to stable values.

The new type checking engine uses a technique called "lazy evaluation". Instead of analyzing each file top to bottom, it visits nodes of the program in whatever order is necessary to resolve each type. It does this across files as necessary. This technique is significantly faster. For most code, you will see an immediate 2x speedup. For pyright's own unit tests, I saw a speedup of about 8x.

Another big change in this version is that VS Code version of pyright defaults to analyzing and reporting errors only for files that are opened in the editor. This matches the behavior of TypeScript and other language services in the VS Code world. If you liked the old behavior of pyright where it reported errors for all source files in your program regardless of whether they were open, you can change this in the VS Code settings (turn off the "pyright.openFilesOnly" setting).

Other changes in this release:

Bug Fix: Fixed bug in TypeVar matching for generics when multiple constrained types were present.

Bug Fix: Fixed bug that caused incorrect errors when import statements were used within an if statement that checks TYPE_CHECKING.

Bug Fix: Fixed a few bugs in type stub generation.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.