pyright

Static Type Checker for Python

OTHER License

Downloads
2.3M
Stars
13.2K
Committers
119

Bot releases are hidden (Show)

pyright - Published 1.1.38

Published by erictraut over 4 years ago

Bug Fix: Fixed bug that caused unaccessed variable diagnostics to go unreported in "for" clause of list comprehensions.

Bug Fix: Fixed errant "unbound variable" and "unknown type" messages that result from particularly complex cyclical analysis dependencies.

Bug Fix: Fixed bug in generic class type matching. TypeVars from different levels of a class hierarchy were getting conflated.

Bug Fix: Fixed bug related to specialization of a type alias definition that consists of a partially-specialized class.

Enhancement: Added support for ClassVar as specified in PEP 526 and 544.

Enhancement: Added logic to ensure that a TypeVar or ParameterSpecification is assigned to a variable of the same name used within the constructor call.

Bug Fix: Fixed bug in completion suggestions where inappropriate auto-import suggestions were sometimes presented when multiple execution environments are defined.

Bug Fix: Changed code to allow ParameterSpecification to be passed as a type arg to a generic class.

Enhancement: Tightened the check for unknown member types. Previous logic didn't check for unknown member types when member accesses in all cases.

Enhancement: If a type stub doesn't specify a return type for a function or method, assume that it's "Unknown" rather than "Any".

Enhancement: Updated stdlib typeshed stubs to the latest.

Enhancement: Added third-party typeshed stubs.

New Feature: Hover text, signature help, and completion now uses doc strings from source code if types come from a type stub file but doc strings are not found in the stub.

Bug Fix: "Find All References" no longer shows references within library implementations (other than the primary declaration).

Enhancement: Diagnostic severity level for individual diagnostic rules can be set to "information" (in addition to "none", "warning" and "error").

New Feature: python.analysis.diagnosticSeverityOverrides setting in VS Code can be used instead of pyrightconfig.json to specify severity overrides for specific diagnostic rules.

pyright - Published 1.1.37

Published by erictraut over 4 years ago

Bug Fix: Fixed bug that caused incorrect type analysis for a property provided by a specialized form of a generic subclass.

Bug Fix: Fixed bug in auto-import logic for the case where the completed symbol is a submodule within a top-level module.

Enhancement: Added support for ".so" and ".dylib" native module files.

Enhancement: Changed code that prints types (e.g. for hover text) to use "Any" instead of "Unknown" when typeCheckingMode is "off". Also avoided printing type arguments when they're all Any or Unknown when typeCheckingMode is "off".

Bug Fix: Changed code that infers the return type of a coroutine (async) function that never returns. Previously, it inferred the type as "NoReturn", but it now infers "Awaitable[NoReturn]".

Bug Fix: Fixed a bug in the handling of overloaded functions. PEP 484 indicates that type checkers should ignore the final non-decorated function when matching a call against a series of overloaded variants for a function.

Enhancement: Updated typeshed fallback stubs from the typeshed repo.

Enhancement: Use new PEP 604 notation for unions in hover text rather than older "Union" and "Optional" syntax defined in PEP 484.

Enhancement: Added support for new setting python.analysis.diagnosticMode. This replaces the now-deprecated setting pyright.openFilesOnly.

Enhancement: Added support for new setting python.analysis.stubPath. Changed the config setting "typingsPath" to "stubPath" for consistency. The config setting "typingsPath" is now deprecated and will eventually be removed.

New Feature: Added support for the Python 3.9 feature described in PEP 612: ParameterSpecification.

Enhancement: Allow comment-based type annotations to use forward references without using string literals.

pyright - Published 1.1.36

Published by erictraut over 4 years ago

Bug Fix: Fixed bug that caused auto-import to insert import statements in the wrong place when local typings stubs are used. These imports were treated as part of the local group rather than third-party.

Enhancement: Added support for @runtime_checkable decorator, as defined in PEP 544.

Enhancement: Implemented support for enum literals.

Enhancement: Implemented support for type narrowing for == or != comparisons for types that can be decomposed into a limited number of literals (bool and enum).

Enhancement: Updated heuristics that are used to determine which type to use for constructor calls. In some cases, it's preferable to use the specialized type derived from the call to __init__. Other times, it's preferable to use the type derived from the call to __new__.

New Feature: Added support for the upcoming PEP 604 alternative notation for unions.

Bug Fix: Fixed bug that caused incorrect error to be reported when assigning a value to an expression involving an index operator (e.g. a[x] = b) where the indexed value had a __setitem__ overload with an unannotated set of parameters.

Enhancement: Improved error messages related to argument matching. The message now includes the corresponding parameter name and function, which is sometimes not obvious from the context (e.g. in the case of operator overloads or other magic methods).

New Feature: Added support for python.analysis.extraPaths setting.

Enhancement: Accept minor versions in version_info when evaluating static expressions.

Enhancement: Added code to verify that resource manager type implements __exit__ or __aexit__ in addition to its enter counterpart.

Bug Fix: Fixed regression that caused diagnostics not to be cleared when closing a source file in the editor and openFilesOnly is enabled.

Bug Fix: Fixed bug in auto-import feature of type completion where imported module name included "-stubs" on the end if the symbol was resolved to a companion stub package.

Enhancement: Introduced reportUnboundVariable and reportUndefinedVariable diagnostic rules.

Bug Fix: Fixed bug that caused file changes not to trigger reanalysis in some cases.

Bug Fix: Special-cased FunctionType and LambdaType to avoid emitting false positives for the reportUnnecessaryIsInstance rule.

pyright - Published 1.1.35

Published by erictraut over 4 years ago

New Feature: Added support for "python.analysis.autoSearchPaths" setting. If enabled (as it is by default), it automatically adds "src" to the import search paths. It is common for workspaces to contain a directory by this name.

Bug Fix: Fixed bug that caused the type arguments for a bare "Callable" to be treated as Any rather than Unknown. This resulted in some missed "partially Unknown" errors.

Enhancement: Fixed perf bug that caused large numbers of empty diagnostic reports to be sent to the language client when the openFilesOnly was enabled.

Bug Fix: Don't dirty a source file and its dependencies just because we receive a file system change event. This is especially important if the file is already open, in which case file system change events are ignored.

Enhancement: Changed generic type specialization code to treat unspecified type arguments as Unknown (Any) in cases where the TypeVar is constrained.

Bug Fix: Fixed bugs in "find references" logic (which is also used for "rename symbol"). It wasn't properly handling locally-aliased import names.

Enhancement: Dramatically sped up "find references" and "rename symbol" operations.

Bug Fix: Fixed a bug in hover provider where it didn't show the proper type for an imported symbol with a local alias name.

Bug Fix: Fixed bug that caused "find references" and "rename symbol" to stop working for member variable names outside of the current file.

Bug Fix: Fixed bug where a string literal used within the first argument of a Callable was interpreted as a string rather than a forward-declared type.

Bug Fix: Fixed recent regression where parameter types for functions declared using Callable were omitted in the hover text.

Enhancement: Enhanced the type narrowing logic for isinstance to narrow the type of an Any or Unknown variable to the target type (for positive tests only).

Bug Fix: Added code to prevent "Rename symbol" from renaming symbols in library code or third-party type stubs.

Enhancement: Added cancelable progress dialog for "Find All References" and "Create Type Stubs" commands.

Bug Fix: Fixed recent regression that caused deleted files within a workspace not to cause re-analysis as appropriate.

Enhancement: Changed "organize imports" to follow formatting rules of "black" formatter for multi-line imports.

pyright - Published 1.1.34

Published by erictraut over 4 years ago

Bug Fix: Fixed crash on startup that several users reported.

Bug Fix: Fixed bug that masked errors in strict mode where parameter types were not declared.

Bug Fix: Fixed bug that caused errant "not derived from BaseException" error if base class type was unknown.

Enhancement: Parser now reports error when "return" statement is used outside of a function.

Enhancement: Improved responsiveness of type completion suggestions.

New Feature: Add diagnostic for missing imported source file (reportMissingModuleSource).

pyright - Published 1.1.33

Published by erictraut over 4 years ago

Bug Fix: Fixed bugs in type analyzer relating to assignments of tuples when target uses an "unpack" operator.

Bug Fix: Fixed race condition that resulted in spurious (but temporary) diagnostics to be reported when there was an open file when VS Code started.

Bug Fix: Fixed bug in type evaluator where literals were being inappropriately stripped from type arguments in certain assignments.

Enhancement: Changed text representation of function declarations to omit extra spaces around "=" for default value assignments when type annotations are not used (consistent with PEP8 guidelines).

Enhancement: Added dataclass_fields class variable to synthesized data classes.

Enhancement: Moved type analysis to background process and added cancellation for better responsiveness.

pyright - Published 1.1.32

Published by erictraut over 4 years ago

Enhancement: Updated typeshed stubs to latest version from typeshed repo.

Bug Fix: Fixed small bug in signature helper provider.

Bug Fix: Fixed crashing bug when type checker encountered a dictionary comprehension that was not the first entry in a dictionary literal.

Enhancement: Added syntax error for comprehensions used within set or dictionary literal that are not the first and only entry.

Bug Fix: Removed code that verifies that a slice object has ranges defined by 'int' types. Slices can support other types as well.

Enhancement: Added type narrowing logic for conditionals that involve comparisons between Literal expressions such as "animal: Literal['cow', 'horse'] \ if animal == 'cow'"

New Feature: Implemented new setting "pyright.disableOrganizeImports".

Bug Fix: Fixed bug in constructor argument validation logic. If there was no init or new method in the class, argument expressions were not being evaluated. This led to errant "unreferenced symbol" errors.

Bug Fix: Fixed type checker's handling of "yield from" statement. It wasn't correctly handling iterable expressions.

Enhancement: Added code to validate that type arguments used to specialize a generic union type alias match the type variable constraints and bounds. Also validated that the correct number of type arguments are provided in this case.

Bug Fix: Fixed bug where unresolved imports with alias (i.e. "import x as y") resulted in errant "y is unbound" errors if y was used in an execution scope other than the one in which the import was located (e.g. within a function).

Bug Fix: Fixed bug in function signature code that caused incorrect errors to be reported related to function overload resolution.

pyright - Published 1.1.31

Published by erictraut over 4 years ago

Enhancement: Add contextual signature help that handles overloads and arbitrary ordering of named parameters.

Bug Fix: Fixed bug in code that determines whether an instantiated class is abstract. It was not properly taking into account MRO (method resolution ordering) for the class.

Bug Fix: Another attempt to work around the file watcher issues on Mac OS X.

Enhancement: Added special-case handling for type var matching of Optional[T].

Enhancement: Added new pyright.typeCheckingMode setting for VS Code extension that allows you to set the default rule set for type checking. Three values are supported: "off", "basic", and "strict". This setting can be overridden in the pyrightconfig.json file with the typeCheckingMode config key.

Enhancement: Changed text representation of functions to omit "Unused" parameter type annotations. This makes hover text and completion suggestion text more readable in code bases that are lacking type annotations.

Enhancement: Added "reportGeneralTypeIssues" setting, which is set to "error" by default. Users can optionally change it to "warning" or "none".

pyright - Published 1.1.30

Published by erictraut over 4 years ago

Bug Fix: Prevent reporting of redundant errors and warnings.

Bug Fix: Fixed bug that caused forward-referenced type annotations within data class definitions to be reported as "unbound" even if the "annotations" futures flag was enabled.

Bug Fix: Fixed handling of Tuple[()], which should be interpreted as a zero-element tuple according to PEP 483. Fixed assignment compatibility check for zero-element tuples.

Bug Fix: Changed class-member lookup logic to better handle the case where one of the base classes is unknown. It previously stopped when it encountered an unknown base class. Now it scans all known base classes first.

Bug Fix: Fixed bug where Any or Unknown type incorrectly resulted in an "is not valid iterable" error.

Enhancement: Improved type analysis performance, especially in cases where code contains no type annotation, so return types and instance variable types need to be inferred.

Enhancement: Improved responsiveness by adding cancellation support for hover, completion suggestions, and other language server requests.

Enhancement: Added support for built-in __dict__ symbol within module.

Enhancement: Added more helpful error message for missing __enter__ method if there is an __aenter__ method present.

Enhancement: Added checks for disallowed usage of Final as specified in PEP 591.

Enhancement: Normalized all diagnostic messages to use the same terminology, tense, and quote symbol.

Enhancement: Added code to hover provider to print the constructor input parameters for a class that is being instantiated.

Enhancement: Hover text for functions no longer print "Unknown" type for input parameters if type annotations are not present. This makes the hover text more readable.

pyright - Published 1.1.29

Published by erictraut over 4 years ago

New Feature: Virtual environment detection ensures that virtual environments are excluded from analysis by default if the virtual environment is located within the workspace directory.

Enhancement: Hid type arguments and type parameters when printing types related to pseudo-generic classes. Since these type parameters are internally synthesized, they are confusing for users to see.

Bug Fix: Fixed several bugs in the logic that handles type matching of functions. It wasn't properly taking into account name-only and position-only markers in parameter lists.

Bug Fix: Fixed a few bugs in logic that determines whether to report diagnostics for a given source file. Diagnostics were previously suppressed for type stubs found in the "typings" directory but should not have been. Diagnostics were also suppressed for local source files that are imported by included files. And diagnostics were not properly added or cleared when a file was opened and the "openFilesOnly" setting was in effect.

Bug Fix: Fixed recent regression that caused a crash when using the "find references" or "rename symbol" features.

Enhancement: Added additional diagnostic context for type var assignments so it's clear whether the type var is invariant, covariant, or contravariant.

Bug Fix: Fixed bug in TypeVar matching logic for functions when a later parameter's generic type influenced the type of an earlier parameter. This situation requires multiple passes to resolve all type variables properly.

pyright - Published 1.1.28

Published by erictraut over 4 years ago

Enhancement: Handle the case where a function parameter with a type annotation that includes a generic (TypeVar) is assigned its value via a default argument rather than an explicit argument by the caller. The TypeVar should be matched using the default argument in this case.

Bug Fix: Fixed bug in parser where a single-element tuple atom used as a subscript index was handled incorrectly.

Enhancement: Added support for the multi-parameter form of the built-in "type" call.

Enhancement: When a class contains an __init__ method whose input parameters are not annotated, generate a "pseudo-generic" class parameterized by the types of the init method's input parameters. This allows call-site specialization of the class, which provides better type checking and type completion suggestions.

pyright - Published 1.1.27

Published by erictraut over 4 years ago

Bug Fix: Fixed bug in type narrowing logic for isinstance and in the logic for detecting unnecessary isinstance and issubclass calls. In both cases, they were not properly handling the case where a class derived from an unknown class.

Enhancement: Implemented "Restart Server" command.

Enhancement: Improved performance of "find symbol" and "rename symbol" operations for symbols that are local and not visible outside of the current source file.

Enhancement: Added support for TypedDict classes that use other TypedDict classes in a nested manner.

Bug Fix: Fixed bug where a symbol declared within a class scope is used before it is assigned but a symbol with the same name exists in the containing scope. In this case, the symbol should not be flagged as "unbound".

pyright - Published 1.1.26

Published by erictraut over 4 years ago

Enhancement: If no execution environments are specified in the config file, the subdirectory "src" is automatically added as a default execution environment for purposes of resolving imports.

Bug Fix: Added correct method resolution ordering (MRO) as specified by Python 3 spec.

Bug Fix: Fixed bug in "organize imports" command where it was not properly handling wildcard imports.

Enhancement: Added error for inconsistent use of specs and tabs that leads to ambiguity in indentation.

Enhancement: Added error message for the case where a consistent method ordering can't be created.

Enhancement: Added pyright.verboseOutput VS Code setting to aid with diagnosing problems with import resolution.

Enhancement: Added support for @overload functions that are async.

Enhancement: Improved appearance of documentation in hover text.

pyright - Published 1.1.25

Published by erictraut over 4 years ago

Bug Fix: Fixed "internal error" caused by assertion in type var matching logic.

Bug FIx: Fixed detection of abstract methods that are not overridden. Previous implementation made bad assumptions about overload ordering.

Bug Fix: Fixed a bug in the case where a type alias is used as a type argument for another (user-defined generic) type alias.

pyright - Published 1.1.24

Published by erictraut over 4 years ago

Enhancement: Added support for user-defined generic type aliases.

Bug Fix: Fixed the handling of bidirectional type inference for cases involving lists with a declared entry type.

Bug Fix: Fixed a condition where the literal portion of a type was improperly removed. This affected imported type aliases in some contexts.

pyright - Published 1.1.23

Published by erictraut over 4 years ago

Revert: Reverted default value of 'reportMissingTypeStubs' setting from 'warning' to 'none'.

Bug Fix: Fixed a bug in the f-string parsing code, which didn't correctly handle the case where the "!=" token was used in an f-string expression.

Bug Fix: Updated dataclass analysis logic so it can handle circular type references in dataclass definitions.

Bug Fix: Fixed a hole in protocol type checking. The type checker wasn't properly handling protocol classes that derived from other classes.

Bug Fix: Fixed bug in import resolver. It was incorrectly returning implicit imports for "import X" or "import X as Y" statements. It failed to flag some errors and presented incorrect type completion suggestions.

Enhancement: Improved signature help suggestions for data class constructors.

Enhancement: Improved parse recovery and error messages for syntax that was previously valid in Python 2 but was made obsolete in Python 3.

pyright - Published 1.1.22

Published by erictraut over 4 years ago

Behavior Change: By default, the "reportMissingTypeStubs" setting now defaults to "warning" instead of "none". As before, it is an "error" in strict mode. Type checkers like Pyright provide significantly more value when you have type stubs available. For more details about why type stubs are important and how to locate or generate type stub files for your project, please refer to this documentation.

Bug Fix: Avoid reporting "partially unknown" error for functions that include "*" parameter.

Bug Fix: Fixed logic that converts function types to a string (for hover text, error messages, etc.). It wasn't correctly handling the 'position-only' argument separator ('/') introduced in Python 3.8.

Bug Fix: Fixed bug in binder logic that resulted in infinite recursion in the type evaluator. It occurred in the case where the target of an assignment was a tuple and the elements in the tuple depended on assignment ordering. The binder was not assigning the correct control flow nodes to the individual elements of the target tuple.

Bug Fix: Fixed bug in type evaluator relating to type var matching for function calls. The code now "locks" the type var map after the first pass. In the second pass, it verifies that the arguments are compatible with the types associated with the (now-locked) type vars.

Bug Fix: Fixed bug in type evaluator where it not properly handling properties within protocol classes.

Bug Fix: Fixed translation of a heterogenous tuple into an iterator. The resulting iterator needs to have a type argument created from a union of the heterogeneous tuple entries.

Enhancement: Added error reporting for instance and class variables within methods declared in a Protocol class. PEP 544 indicates that these should be flagged as an error.

Bug Fix: Fixed bug in type check logic that determines whether a class conforms to a Protocol. It was not properly taking into account instance variables within the class.

Bug Fix: Fixed bug in handling of "cast" function when type is specified within a string literal.

Enhancement: Added type narrowing support for built-in "callable" call.

pyright - Published 1.1.21

Published by erictraut over 4 years ago

Bug Fix: Fixed a ~5% performance regression that was introduced in 1.1.18 relating to abstract method checks.

Enhancement: Improved completion handling within decorators.

Enhancement: Added support for forward-declared types within contexts other than type annotations. This includes the 'bound' parameter and constraints within a TypeVar declaration, type arguments, the first argument to a "cast" call, and type expressions found within a "NamedTuple".

pyright - Published 1.1.20

Published by erictraut almost 5 years ago

Enhancement: Implemented support for "Final" type annotation introduced in Python 3.8.

Bug Fix: Fixed bug in type comparison logic. It wasn't taking into account specialized return types for functions, so unions that contained two functions with different specialized return types were being deduped incorrectly.

Bug Fix: Fixed a bug in member access evaluation where the base type was a generic class. The logic was inappropriately specializing the class, inserting "Unknown" type arguments.

Bug Fix: Enhanced TypeVar matching logic to handle the case where the first encounter with a TypeVar is contravariant but subsequent encounters are covariant or invariant, in which case we may be able to narrow the type from the initial guess.

pyright - Published 1.1.19

Published by erictraut almost 5 years ago

Enhancement: Added support for imaginary number literals (e.g. "3.4j").

Enhancement: Added new configuration setting reportImplicitStringConcatenation that generates errors or warnings when implicit string concatenation (multiple string literals in a row) are used.

Enhancement: Added type constraint support for conditional expressions that include assignment (walrus) operators.

Bug Fix: Fixed a bug in parser and a bug in completion provider that impacted completion suggestions within decorators.

Bug Fix: Fixed bug in TypeVar matching logic for case where a union includes multiple types, some of which are subclasses of the other.