Skip to content

Releases: microsoft/pyright

Published 1.0.25

09 May 07:24
Compare
Choose a tag to compare

New Feature: Extended type constraint logic for isinstance calls that pass a tuple of types for the second parameter.
New Feature: Improved definition provider ("show definitions") to handle multiple declarations. This occurs when overrides are used and when a member is declared in different places for types in a union.
New Feature: Types used for TypeVar bound and constraint types are now validated to ensure that they are not generic (i.e. use other TypeVars).
New Feature: Implemented proper type inference for dictionary literals that use list comprehensions.
New Feature: Annotated types for function parameters are now enforced, so an attempt to reassign the parameter will generate an error if the assigned value doesn't match the annotated type.
Bug Fix: Fixed reported bug with specialized type aliases.
Bug Fix: Type constraint logic was not properly handling the case where an assignment targeted a property.
Bug Fix: Imports of the form "from . import X" are now properly checked, and an error is reported if X doesn't exist.

Published 1.0.24

05 May 19:54
Compare
Choose a tag to compare

New Feature: Type checker now honors type annotations on *args and **kwargs function parameters.
New Feature: Changed the way assignments are handled when the target of the assignment has a declared type. The type checker now uses the source (RHS) of the assignment to constrain the declared type if it is a union.
Bug Fix: Unbound or potentially-unbound variables are once again flagged as such.
Bug Fix: Fixed type inference for instantiation of generic class based on arguments passed to its constructor or init routine.
Bug Fix: Fixed several bugs relating to list comprehension type analysis.
Bug Fix: Fixed code flow analysis logic for for/else statements.
Bug Fix: Arguments with a literal type need to be "genericized" before performing type var matching on generic functions.
Bug Fix: Literal types with a value of 0 or empty string were not being printed as a literal in error messages.
Bug Fix: Fixed another bug in the datetime.pyi typeshed stub file relating to the datetime.combine method.
Bug Fix: Fixed a bug in the builtins.pyi typeshed stub file in the tuple.__add__ method. It required that the parameter be of the same tuple type.

Published 1.0.23

04 May 07:56
Compare
Choose a tag to compare

New Feature: Added support for Literal type in typing_extensions.
New Feature: Added typing_extensions.pyi fallback type stub file.
New Feature: Types for arg and kwarg parameters are now correctly inferred to be of type List[X] and Dict[str, X] where X is either specified by the type annotation or assumed to be Unknown.
New Feature: Added type constraint logic for expressions of the form "type(X) is Y" and "type(X) is not Y".
New Feature: Added validation for ClassVar parameters to ensure that it doesn't contain any type variables.
Bug Fix: Fixed bug in "datetime.combine" method in datetime.pyi typeshed type stub.
Bug Fix: Type checker was not properly handling assignments where the LHS was a tuple and the RHS was an utterable type.
Improved responsiveness of VS Code extension.

Published 1.0.22

02 May 04:05
Compare
Choose a tag to compare

Bug Fix: Fixed bad regression introduced in 1.0.20 where imported modules that are imported with the import xyz statement (as opposed to the from xyz import abc form) are reported as 'unbound'. This occurs only if there is no type stub file found for that import.

Published 1.0.21

02 May 01:54
Compare
Choose a tag to compare

New Feature: Added "reportUntypedNamedTuple" config switch for reporting the use of "namedtuple", which is an untyped version of "NamedTuple".
New Feature: Added type inference support for list comprehension statements.
New Feature: Improved type inference when indexing into a tuple type with a constant integer index. It now uses the appropriate type for that tuple entry if it's known.
Bug Fix #101: Type inference engine now infers a return type of Generator[Y] for generator functions rather than Iterator[Y].
Bug Fix: Fixed bug that masked type checking operations for certain built-in types like List and Dict.
Bug Fix: For statements now allow iterators that provide __getitem__, as per PEP 234.
Bug Fix: Fixed an issue where classes defined with NamedTuple were not providing correct type checks.
Bug Fix: Fixed bug in completion handler that caused completion recommendations to appear when pressing period within a comment.
Bug Fix: Pyright was failing to search beyond the first search path when using fall-back paths from the python interpreter.

Published 1.0.20

30 Apr 17:53
Compare
Choose a tag to compare

This release includes a significant set of changes to the core type engine that are required to enable the next round of functionality. I've done my best to avoid introducing regressions, but they are possible in a change of this size.
One known regression is that unbound or potentially-unbound variables are no longer flagged in many cases.

New Feature: Added new config switch "reportUnknownParameterType" that reports input and return parameters with an unknown type.
New Feature: Added new config switch "reportUnknownVariableType" that reports local variables with an unknown type.
New Feature: Added new config switch "reportUnknownMemberType" that reports class members (instance variables and class variables) with an unknown type.
New Feature: Further improved logging to diagnose import failures.
New Feature: Added "strict mode" that can be enabled on a per-file basis by adding the comment "# pyright: strict". This enables all type-checking configuration flags for that file.
New Feature: Added support in type check engine for expression type constraints involving the "or" operator.
Bug Fix #91: Added code to convert file specs passed to command-line from relative to absolute.
Bug Fix: Added code path lookups for both "lib" and "Lib" within virtual environment to accommodate capitalization convention on Windows.
Bug Fix: Removed limitation that type annotation strings not use bytes, unicode or raw strings.

Published 1.0.19

28 Apr 02:19
Compare
Choose a tag to compare

New Feature: Types are now validated for assignments that target objects with a __set__ method, including properties with setters.
New Feature: Added key/value type inference for dictionary literal statements.
New Feature: Unreachable code is now detected in cases where a return or raise occurs before the end of a code block.
New Feature: Added verbose diagnostic information for import resolution failures. Added --verbose switch for command-line tool.
New Feature: Type constraint subsystem is now able to handle more complicated code flow inferences.
Bug Fix: Fixed false positive error related to arg/param matching when an unpacked arg is used.

Published 1.0.18

27 Apr 06:43
Compare
Choose a tag to compare

New Feature: Added type constraint for assert command.
Bug Fix: Fixed bug in parser that allowed an arbitrary number of comma-separated expressions to appear after an assert keyword.
Bug Fix #90: Fixed false error for common arithmetic binary operators that act upon int/float/complex when operand is union with an unknown or any type.
Bug Fix #88: Text completion options shouldn't appear for comments or strings.
Bug Fix: Fixed regression introduced in previous version where the check for max import chain length generated false positives.
Bug Fix: Command-line tool didn't allow the use of "--watch" with a list of specified files.
Bug Fix #89: Fixed regression in tokenizer that caused incorrect line attributes when CR/LF was contained within a string.

Published 1.0.17

25 Apr 05:36
Compare
Choose a tag to compare

New Feature: Improved formatting of errors and warnings for command-line tool.
New Feature: Started to implement type completion for keywords, local variables, module variables, and class/instance variables.
Bug Fix: FIx for #83: Changed the way type analyzer handles assignment statements with type annotation.
Bug Fix: Fix #85, recursion crash due to long import chains.
Bug Fix: Partial fix for #82 (hang)
Bug Fix: Don't flag invalid as errors string escape sequences in raw strings.
Bug Fix: Removed logo from VS Code README.

Published 1.0.16

21 Apr 19:19
Compare
Choose a tag to compare

New Feature: Unused code blocks are now displayed as "grayed out" in VS Code.
New Feature: Use of "yield from" generates error for Python <3.3.
New Feature: Scanning of string literals now fully complies with Python spec, including support for all defined escape sequences.
New Feature: Added "reportInvalidStringEscapeSequence" config switch to control whether the analyzer reports errors or warnings for invalid escape sequences.
New Feature: Use of Protocol in a code file is now flagged as illegal for Python <3.7.
New Feature: An attempt to instantiate certain special classes defined in typing (Callable, Generic, etc.) now emits an error.
Fixed bug in import cycle detection logic that could result in slow analysis time and even an infinite loop.