Pyright

Latest version: v1.1.390

Safety actively analyzes 685838 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 66 of 81

1.1.4

Enhancement: Exposed the useLibraryForTypes setting in the command-line version of pyright ("--lib" switch).

Enhancement: Updated typeshed type stub files to the latest version from the typeshed repo.

Enhancement: Revamped how properties are handled. Rather than define a custom "PropertyType" that requires its own handling everywhere, a property is now modeled as regular ObjectType whose associated class type has a special ClassTypeFlag. This eliminates a bunch of edge cases that didn't previously work with properties, including support for custom properties.

Bug Fix: Changed code to allow comma delimiters within namedtuple field definition strings.

Bug Fix: Changed import logic to better match behavior of python loader. If there's an empty directory and a python file with the same name, the import resolution logic now selects the file rather than failing resolution.

Bug Fix: Fixed stack overflow due to infinite recursion in lazy binding callback caused by import loops in some packages like numpy.

Bug Fix: Fixed bug where symbols that couldn't be resolved through wildcard imports were resolved as unbound rather than unknown.

Bug Fix: Added code to switch the working directory to the root of the extension before invoking the python interpreter to query sys.path.

Bug Fix: Fixed recent regression that caused symbols imported through "from X import Y" statement not to be flagged as an error if Y was not defined in X's namespace.

Bug Fix: Fixed bug in document symbol provider where it was not providing the correct ranges. This caused the "outline" view in VS Code not to report which outline item contained errors.

Bug Fix: Added support for static evaluation of "typing.TYPE_CHECKING" (in addition to just "TYPE_CHECKING").

1.1.3

New Feature: The command-line version now accepts a command-line switch "outputjson". If provided, the output is a JSON structure including all diagnostics (errors and warnings). This format is useful for when pyright is used in a tool chain (e.g. a build system). It eliminates the need for consumers to parse the text output.

Enhancement: Added support for PEP 561 provision for type stubs that are packaged separately from a main package and placed in a peer directory ending in "-stubs".

Enhancement: Improved type completions for method definitions. When defining an override method from a base class, pyright now fills in the type signature for you.

Enhancement: Improved type widening rules for Literal types during TypeVar matching.

Enhancement: Improved printing of literal types. They're now combined (e.g. "Literal[1, 2]" instead of "Union[Literal[1], Literal[2]]").

Bug Fix: When typing floating-point values, type completion suggestions shouldn't be presented after the "."

Bug Fix: Added code to match syntax error detection and scope binding rules defined in PEP 572 for assignment expressions found within list comprehension expressions.

Bug Fix: Fixed issue where the progress spinner wasn't immediately hidden when onlyOpenFiles setting was toggled from false to true.

1.1.2

New Feature: Added a new VS Code setting called "useLibraryCodeForTypes". It's disabled by default currently. If enabled, pyright will attempt to extract type information from library code implementations in the absence of type stub files.

New Feature: Added support for hierarchical document symbols, which appear in the "Outline" view within VS Code.

Bug Fix: Fixed regression in "find symbol in workspace" command if onlyOpenFiles is set to true.

Bug Fix: Added code to honor the behavior specified in PEP 484 for imported symbols within type stub files. Only symbols imported using the "as" form of import statements or wildcard imports should be considered exported from the type stub.

1.1.1

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.

1.1.0

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.

1.0.84

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.

Page 66 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.