Skip to content

Releases: microsoft/pyright

Published 1.1.1

18 Nov 06:23
Compare
Choose a tag to compare

Enhancement: Implemented an optimization that further sped up analysis by about 10%.

New Feature: Added reportAssertAlwaysTrue configuration switch, which flags situations where an assert statement uses an expression that always evaluates to true.

Bug Fix: Fixed edge cases in abstract class detection and reporting of attempts to instantiate an ABC.

Bug Fix: Fixed a couple of behavioral regressions related to the recently-added onlyOpenFiles setting.

Bug Fix: Fixed a regression where imported symbols from unresolved imports were flagged as "unbound" rather than being treated as unknown.

Published 1.1.0

17 Nov 08:56
Compare
Choose a tag to compare

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.

Published 1.0.84

08 Nov 00:53
Compare
Choose a tag to compare

This version contains a major change in the way pyright infers the type of local and member variables that have no explicit type annotation.

Bug Fix: Fixed issue in definition provider that caused it to return duplicate definitions for some symbols.

Bug Fix: Fixed a bug in constructor specialization code. The __init__ specialization was being overwritten by the __new__ specialization, often discarding important type arguments in the process.

Bug Fix: Fixed regression in hover provider where it didn't return any hover information for unresolved import symbols.

Bug Fix: Fixed bug where argument value expressions were not evaluated if they didn't match any parameters.

Bug Fix: Fixed bug relating to scoping of variables introduced within list comprehensions.

Bug Fix: Fixed bug in TypeVar matching logic.

Published 1.0.83

05 Nov 08:52
Compare
Choose a tag to compare

Enhancement: A rewritten implementation of the code flow and type constraint engine provides better handling of complex code flow like nested loops, try/except/finally statements, etc.

Enhancement: In VS Code extension, changed the logic for how to handle opened files that don't fall within any workspace. Previously, all such files were analyzed in a default workspace using default settings. The new logic uses the current workspace if there is only one. The "default" workspace fallback is still used for multi-root workspaces.

Bug Fix: Fixed bugs in logic that determines when to allow importing a non-stub from a stub file. It's not allowed for third-party files.

Bug Fix: Changed import logic to search for imported symbols in the target module before looking for submodules of the same name.

Bug Fix: Unreachable code is displayed even for files where errors or warnings are suppressed.

Bug Fix: Fixed TypeVar matching logic to avoid adding widened types if the TypeVar was already matched against subclasses of the type that is being added.

Bug Fix: Union types that include Literal[True] and Literal[False] are now collapsed into a 'bool' type.

Published 1.0.82

01 Nov 06:11
Compare
Choose a tag to compare

Bug Fix: Fixed type completions for TypedDict classes when TypedDict is imported from typings (versus typing_extensions).

Bug Fix: Fixed bug that affected proper type evaluation for CTypes like c_uint64.

Bug Fix: Changed server to create service on demand, when a file is opened that doesn't match any existing workspace.

Bug Fix: Fixed bug that caused list[x] and List[x] not to be combined into the same union type.

Bug Fix: Added support for proper type inference for assignments that target lists (e.g. [a, b] = [1, 2]).

Enhancement: Added missing methods and attribute to memoryview class in builtins.pyi.

Published 1.0.81

25 Oct 16:14
Compare
Choose a tag to compare

Enhancement: Command-line version now exits with a new exit code (3) if the pyrightconfig.json is malformed or cannot be read. Previously, it proceeded to perform the analysis with default settings.

Enhancement: Added support for interleaved for and if clauses within a list comprehension statement. Previously, the analyzer assumed that there would be only one if clause and it would be after all for clauses.

Enhancement: the built-in function issubclass is now supported by the analyzer in the same way as isinstance. It can be used as a type constraint in conditional code flow statements (if, while, etc.), and the reportUnnecessaryIsInstance setting applies to it.

Enhancement: Added support for the @abc.abstractproperty function decorator.

Bug Fix: Fixed a reported bug relating to the handling of the @overload function decorator. This was due to a recent regression.

Published 1.0.80

23 Oct 16:56
Compare
Choose a tag to compare

Enhancement: Added code to interpret the python.path VS Code setting in the same manner as the Python VS Code extension. In particular, it now handles the special-case value of "python" to mean "use the default python interpreter" rather than treating it as a relative path.

Enhancement: Added special-case handling of __import__ built-in call so it always returns Any type.

Bug Fix: Fixed bug in code that determines whether code is reachable.

Bug Fix: Fixed static expression evaluation for expressions that involve python platform when no platform is specified.

Bug Fix: Fixed bug in alias resolution logic that caused the definition provider not to take the user to the right location in cases where there were multiple alias hops.

Bug Fix: Changed implicit module symbol __path__ to be properly typed as Iterable[str] rather than str.

Published 1.0.79

22 Oct 00:44
Compare
Choose a tag to compare

Bug Fix: Fixed regression introduced in 1.0.77 that caused imports of third-party libraries to generate "not a known member of module" error messages.

This version includes a big change in the way pyright tracks variable declarations. This change should not be visible to users. It was done in preparation for an upcoming change in the analysis engine.

Published 1.0.77

20 Oct 16:49
Compare
Choose a tag to compare

New Feature: Signature help provider now extracts parameter-specific comments and presents them in the help text when typing function arguments.

Enhancement: Added knowledge of __doc__ symbol to all modules.

Bug Fix: Fixed crash that resulted when launching the production VS Code extension in debug mode.

Bug Fix: Fixed recent regression that broke type completions within import statements.

Bug Fix: Fixed issue that caused analysis to fail after repeated edits while in "watch" mode.

This version includes a big change in the way pyright processes import statements. This change should not be visible to users. It was done in preparation for an upcoming change in the type analysis engine.

Published 1.0.76

19 Oct 23:41
Compare
Choose a tag to compare

Bug Fix: Fixed Windows-specific path processing bug.

Bug Fix: Fixed bug that caused "import cycle" errors to persist even after they were corrected.