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.140

Published by erictraut over 3 years ago

Bug Fix: Fixed bug that caused parameters in overloaded functions not to be marked as accessed, as was intended.

Bug Fix: Fixed false negative when the same name was defined in both an outer and inner function and referenced in the inner function prior to being assigned.

Enhancement: Added support for identifiers that contain Unicode characters that require two UTF16 character codes (surrogates). This allows identifiers to use characters in the Unicode blocks for Egyptian Hieroglyphs, Linear B Ideograms, Cuneiform, Phoenician, etc.

Enhancement: Added new diagnostic rule "reportIncompleteStub", which reports a diagnostic for a module-level __getattr__ function in a type stub, indicating that it's incomplete. This check was previously part of the "reportUnknownMemberType" diagnostic rule.

Behavior Change: Disabled support for keyword arguments in subscript expressions because PEP 637 was rejected.

Bug Fix: Fixed bug in the type specialization for ParamSpec when the return type contains no generics.

Bug Fix: Changed TypeGuard behavior to evaluate the return type of a call expression that invokes a type guard function to be 'bool' rather than 'TypeGuard[T]'.

Behavior Change: Changed TypeGuard behavior to allow a type guard function to be passed as a callback that expects the return type to be bool.

Bug Fix: Removed explicit check for Python 3.10 when using ParamSpec. It's possible to use it with older versions of Python if importing from typing_extensions.

Bug Fix: Fixed bug that caused a false positive error when applying a subscript operation on a TypeVar.

Bug Fix: Fixed bug that resulted in a false positive error when the second argument to isinstance or issubclass was a union that included both a single type and a tuple of types.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support in typeshed VERSIONS file for submodules.

pyright - Published 1.1.139

Published by erictraut over 3 years ago

Enhancement: Updated typeshed to the latest.

Enhancement: Added support for typeshed VERSION file, which indicates which stdlib modules are available in each version of Python.

Bug Fix: Fixed bug that resulted in symbols being inappropriately marked "unaccessed" when they were accessed within a keyword argument used within a class declaration.

Bug Fix: Fixed false positive error when a dataclass declares an instance variable but a subclass redeclares a class variable of the same name.

Bug Fix: Fixed type narrowing bug with 'isinstance' checks that involve protocol classes. The bug resulted in false positive errors with the reportUnnecessaryIsInstance check.

Enhancement: Added support for callback protocols that use overloaded __call__ methods.

Enhancement (from pylance): Improved performance of tokenizer's handling of string literals.

Bug Fix (from pylance): Ignore updates to ".git" file so they don't trigger reanalysis.

Bug Fix: Fixed false positive error in check for overload implementation consistency when one of the overloaded methods in a generic class provides an explicit type annotation for "self" or "cls" but the implementation does not.

Enhancement: Improved "is None" and "is not None" type narrowing logic to handle constrained TypeVar that includes None as one of the constraints.

Bug Fix: Fixed false positive error when a __getattr__ method is present. The previous logic was assuming that __getattr__ could provide a magic method value (e.g. for __add__).

Bug Fix: Prefer py.typed libraries over typeshed for consistency with PEP 561.

Bug Fix: Improved validation for function calls where the function signature includes keyword arguments without default values that are not directly matched by keyword arguments but are matched by a **kwargs argument. In this situation, the type of the **kwargs values should be verified to be compatible with the type of the keyword parameters.

Bug Fix: Fixed bug in lambda type evaluation for lambdas that use an *args parameter. The parameter type was not being transformed into a tuple, as it should have been.

Enhancement: Improved diagnostic message for constant redefinition to make it clear that the symbol is assumed to be constant because its name is uppercase.

pyright - Published 1.1.138

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in handling special-case types in typing.pyi or typing_extensions.pyi. The RHS of the assignment was not being evaluated, so symbols referenced in the RHS were not be marked as accessed.

Bug Fix: Changed special-case handling of "overload" definition in typying.pyi stub. New versions of this stub have changed the definition from an object to a function.

Bug Fix: Fixed recent regression in handling of f-strings that are also raw.

pyright - Published 1.1.137

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in type inference of dictionary, list and set expressions when they contain classes or class instances that are apparently the same type but internally appear different because they are "pseudo-generic". Pseudo-generic classes are those that have no type annotations in the __init__ method and are treated internally as generics to improve type inference.

Bug Fix: Fixed bug that caused false positive error when assigning Type[Any] to type.

Bug Fix: Fixed false positive error when assignment expression (i.e. walrus operator) is used within a class scope.

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: When in "outputjson" mode, the CLI now output log information to stderr.

Enhancement: Add match and case keywords to completion provider.

Bug Fix: Fixed regression that caused runtime assertion (and crash) in some rare circumstances.

Performance: Eliminated O(n*m) behavior when testing type compatibility of a union with n subtypes and a union of m subtypes when those subtypes contain mostly literals.

Performance: Moved checks for string literal errors (unsupported escape characters, etc.) from binder to checker for performance reasons.

Performance: Improved performance of string token value unescape logic by handling the common cases (no format string and no escape characters) using a fast path.

Bug Fix (from Pylance): Fixed bug in file watching logic for config files.

Performance (from Pylance): Reduced work done during parsing and binding related to doc string handling.

Enhancement (from Pylance): Improved document symbol provider symbol type information.

Behavior Change: Removed PEP 563 (deferred type annotation) behavior as default for Python 3.10, since the PEP was deferred.

Bug Fix: Fixed bug in completion provider that caused completions to be provided when pressing "." within the string literal portion of an f-string.

Performance (from Pylance): Provided special-case code paths in parser and binder to speed up symbol indexing operations.

pyright - Published 1.1.136

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in diagnostic check for contravariant type variables used in a return type annotation that resulted in a false negative.

Enhancement: Added minimal support for * and ** parameter annotations within function annotation comments.

Behavior Change: Modified algorithm for invariant union type assignments to avoid n^2 behavior.

Bug Fix: Fixed a false positive error that occurs when a class uses itself as a type argument for one of its base classes and that base class uses a bound type variable.

Enhancement: Added logic to skip the normal __new__ constructor evaluation if the class is created by a metaclass with a custom __call__ method.

Bug Fix: Fixed bug in TypedDict type narrowing (for containment of non-required fields) that resulted in a false positive error when a narrowed type was later used.

Bug Fix: Fixed bug in type variable constraint solver that resulted in a confusing false positive error in circumstances involving contravariant type variables (e.g. when dealing with callback protocols) and a combination of Type[T] and T within the callback signature.

Enhancement (from pylance): Improved formatting of doc strings in tool tips.

pyright - Published 1.1.135

Published by erictraut over 3 years ago

Behavior Change: Changed behavior of function overload evaluation to more closely match the behavior of other type checkers. Notably, if one or more argument have union types, they are expanded, and each combination of argument union subtypes can use different overloads.

Bug Fix: Fixed bug that caused false positive error when assigning a function with no position-only marker to a function with a position-only marker.

Enhancement: Added support for call arguments whose types are constrained type variables and must be constrained to a particular subtype during call evaluation because the LHS of the call imposes such constraints.

Enhancement: Added support for special cases of class pattern matching as described in PEP 634.

Enhancement: Added support for auto generation of __match_args__ class variable for dataclass and named tuples.

Enhancement: Added support for type narrowing of the subject expression within a "match" statement based on the matched pattern.

Bug Fix: Fixed bug in type analyzer that resulted in a false positive error when a return type annotation included a generic class but omitted the type arguments.

pyright - Published 1.1.134

Published by erictraut over 3 years ago

Enhancement: Implemented first cut at generalized support for dataclass transforms.

Behavior Change: Allow NoReturn return type annotation for __init__ method.

Bug Fix: Fixed bug in completion provider that resulted in no valid completion suggestions at the end of a "from x import a, " statement.

Bug Fix: Fixed bug in type checker that led to a false positive when assigning a function to a callable type and the source contained unannotated parameters.

Bug Fix: Fixed numerous bugs that result in occasional type evaluation errors, some of which appear to be somewhat non-deterministic.

Bug Fix: Fixed bug in type evaluator that caused incorrect type evaluation for annotated parameter types in some cases.

Bug Fix: Fixed a bug in the type checker that resulted in a false positive error when using "|" (union) operator in parameter type annotations in some cases.

Bug Fix: Changed binder logic for "from .a import x" statements in `init.py. Implicit import of ".a" is performed only in cases where there is a single dot. For example, "from .a.b import x" does not implicitly import ".a.b".

pyright - Published 1.1.133

Published by erictraut over 3 years ago

Bug Fix: Fixed bug that resulted in a false positive error within type checker when a constrained TypeVar was used in a lambda callback.

Bug Fix: Fixed bug in type variable constraint solver that resulted in false positive error in certain cases involving bidirectional type inference with unknown (or missing) type arguments.

Enhancement: Reduced memory consumption of tokenizer for string literal tokens.

Enhancement: Improved performance of type analyzer in cases where certain type checking diagnostic rules are disabled.

Enhancement: Improved startup time of pyright by eliminating redundant calls to Python interpreter to retrieve import resolution paths.

Behavior Change: Automatically mark parameters as accessed (so they don't appear as "grayed out") in the following circumstances: 1) it is a self parameter in an instance method, 2) it is a cls parameter in a class method, 3) it is a parameter in a method marked abstract, 4) it is a parameter in a method that is part of a protocol class, 5) it is a parameter in an overload signature.

Bug Fix: Fixed incompatibility with pypy when retrieving import resolution paths from the configured Python interpreter.

Enhancement: Added diagnostic for __init__ method that does not have a return type of None.

Enhancement: Configuration settings can now be stored in a pyproject.toml file. If both pyproject.toml and pyrightconfig.json are both present, the latter takes precedent.

pyright - Published 1.1.131

Published by erictraut over 3 years ago

Bug Fix: Changed logic that detects generator functions to accommodate yield statements that are provably unreachable in the code flow.

Behavior Change: Changed dataclass logic to not enforce ordering of fields with defaults vs those without if init=False is specified.

Enhancement: Extended method override check to include dundered methods (other than constructors).

Bug Fix (from pylance): Removed duplicate "yield" suggestion in completion list.

Enhancement (from pylance): Improved logic that maps type stubs to corresponding source files.

Enhancement: Added support for implicit __annotations__ symbol at the module level.

Enhancement: Updated to the latest typeshed stubs. Removed third-party stubs for that were marked as Python 2 only (enum34, fb303, futures, ipaddress, kazoo, openssl-python, pathlib2, pymssql, Routes, scribe, tornado).

Enhancement: Added support for type(None) within isinstance type narrowing.

Bug Fix: When providing a completion suggestion for an async method override, an "await" operator is now added in the generated return expression.

Bug Fix: Fixed false positive error in argument/parameter matching logic for function calls that occurs when a keyword argument targets a parameter that can be either positional or keyword and a spread operator is used in an earlier argument.

Bug Fix: Fixed bug that resulted in false positive error when a constrained TypeVar type was passed through the "isinstance" type narrowing logic and then used as an operand in a binary operation.

Bug Fix: Fixed several bugs that caused type checker crash in certain cases.

pyright - Published 1.1.130

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in type narrowing logic when the narrowed expression contained an assignment expression (walrus operator). It was not properly narrowing the target of the assignment expression.

Bug Fix: Fixed bug in "isinstance" type narrowing support when the first argument is a type (e.g. a class or Type[T]) and the second argument is type (or a tuple that contains type).

Bug Fix: Fixed bug in "isinstance" type narrowing logic where it didn't properly handle protocol classes that support runtime checking.

Enhancement (from Pylance): Improved docstring formatting in hover text.

Behavior Change: Suppressed "access to non-required key" diagnostic if the access is performed within a try block.

Bug Fix: Fixed bug in 'callable' type narrowing logic. It wasn't properly handling type variables.

Enhancement: Implemented new diagnostic rule "reportUnnecessaryComparison". It checks for "==" and "!=" comparisons where the LHS and RHS types have no overlap and the LHS has no __eq__ overload. This new diagnostic rule is off by default in normal type checking mode but is on in strict mode.

Bug Fix: Fixed false positive error that occurred when file started with "from typing import Collection". This was due to mishandling of a cyclical dependency in the typeshed classes.

Enhancement: Improved bidirectional type inference for expressions that involve the pattern [<list elements>] * <expression>.

Bug Fix: Fixed false positive error relating to the use of parentheses in "with" statement when using Python 3.9.

Bug Fix: Fixed bug in type evaluation of async functions that are not generators but have a declared return type of AsyncGenerator. The actual return type needs to be wrapped in a Coroutine in this case.

Bug Fix: Suppressed diagnostic check for Subscript for class "X" will generate runtime exception when it's used in a PEP 526-style variable type annotation. Apparently the exception occurs only when used in other contexts like parameter and return type annotations.

pyright - Published 1.1.129

Published by erictraut over 3 years ago

Enhancement: Added configuration option "strictSetInference" which is analogous to "strictListInference" and "strictDictionaryInference" but specifically for set expressions.

Enhancement: Tweaked heuristic in constraint solver to prefer types that have no "unknown" element to those that do.

Enhancement: Improved the handling of TypeVar matching when the source and dest types are both unions, the types are being compared with invariant constraints, and the dest contains a TypeVar.

Enhancement: Fixed misleading error message for "unsupported __all__ operations".

Enhancement: Improved error message for dataclass fields.

Bug Fix: Fixed bug that caused inconsistent type evaluation for type annotations based on order of evaluation. It was triggered in some cases by the semantic highlighting feature.

Bug Fix: Fixed bug in the function type compatibility logic. If the source has a *args or **kwargs parameter but the dest does not, the function should still be assignable.

Behavior Change: Changed the logic that searches for a config file. It currently searches from the current working directory all the way up the folder hierarchy. This makes sense only for a command-line tool, not for a language server. The latter already knows the project root, and we should look only in that directory for a config file.

Bug Fix: Fixed bug in signature help provider where its heuristics were causing it to return a bad response when the insertion point was immediately after a comma and a call expression preceded the comma.

Bug Fix: Added support for an import edge case where a module's __init__.py file is apparently importing from itself but intends instead to import from one of its submodules.

Bug Fix: Fixed bug in namespace import resolution. When there are multiple import search matches, the import resolver needs to take into account the individual symbols specified in the import statement.

Bug Fix: Fixed a bug whereby call expressions within a type annotation were flagged as errors but not evaluated, which meant that symbols referenced within them were not marked as accessed.

Enhancement: Updated typeshed stubs to the latest.

pyright - Published 1.1.128

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in argument-matching code that produced false positive errors when a keyword argument corresponded to a positional-only argument name but should have been matched to a **kwargs parameter instead.

Bug Fix: Fixed bug in bidirectional type inference logic for list and dict expressions when expected type included a type varaible.

Bug Fix: Disabled the "self" annotation checks for overloaded methods because the self annotation can be used as a legitimate filter for overloads.

Enhancement: Improved bidirectional type inference for set expressions so it better handles unions in expected type.

Bug Fix: Improved TypeVar constraint solver so it provides a better solution when a TypeVar is constrained first by a contravariant wide bound in a first argument and then a subsequent argument relies on bidirectional type inference with a covariant or invariant use of the same TypeVar.

Bug Fix: Fixed bug that caused a crash in the type checker when a protocol class inherited from a generic non-protocol class.

Enhancement: Added check for a class that inherits from Generic to ensure that all type variables are included in the Generic subscript list.

Bug Fix: Fixed regression in handling expressions of the form [x] * y. Some previously-added special-case code to handle the [None] * n case was too general.

Enhancement: Changed printed types to fully expand type aliases in error messages where that additional detail is needed — namely, for "partially unknown" messages. This makes for verbose types, but without the expansion, it can be very difficult to determine which part of the type is unknown.

Bug Fix: Fixed false positive error in type compatibility check where the destination type is Type[Any] and the source type is Type[x] where x is anything (including Any).

Enhancement: Added exemption to the overlapping overload check for the __get__ method. Other type checkers (namely mypy) exempt this method also.

pyright - Published 1.1.127

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in type evaluator that resulted in suppressed errors and evaluations when the evaluation of a lambda expression resulted in some form of recursion (e.g. it references a symbol that depends on the return result of the lambda).

Enhancement: Added "reportTypedDictNotRequiredAccess" diagnostic rule and split out diagnostics that pertain specifically to unguarded accesses to non-required TypedDict keys.

Bug Fix: Changed type of __path__ variable in module from List[str] to Iterable[str].

Bug Fix: Fixed bug that resulted in a runtime crash within the type checker when a protocol class inherits from another protocol class that is not generic (like "Sized").

Enhancement: Added better heuristics to auto-complete insertion logic so it honors single-symbol-per-line and multi-symbol-per-line formats of "from x import a" statements.

Enhancement: Implemented a new check to validate that annotated types for "self" and "cls" parameters are supertypes of their containing classes.

Bug Fix (from pylance): Fixed bug that resulted in crashes when a broken symlink was encountered.

Bug Fix: Fixed recent regression that resulted in false positives when checking the type of a "self" parameter within a metaclass when the type annotation was of the form Type[T].

Enhancement: Added minimal support for "@no_type_check" decorator. It does not suppress errors, but it doesn't generate an error itself.

Enhancement: Added support for PEP 612 ParamSpecs to be used as type parameters for generic classes and generic type aliases. Previously, they were allowed only in the specialization of Callable.

Enhancement: Added out-of-bounds access check for index operations where the indexed type is a tuple object with known length and the index value is a negative integer literal value.

Bug Fix: Fixed bugs in the handling of PEP 487 __init_subclass__. The logic was using the __init_subclass__ defined in the class itself rather than its base classes.

Enhancement: Added special-case handling for generic functions that return a Callable with generic parameters. The change allows for callers to pass type variables to the function and then have the resulting Callable provide a TypeVar scope for those variables.

Bug Fix (from pylance): Fixed bugs relating to partial type stub packages.

pyright - Published 1.1.126

Published by erictraut over 3 years ago

Bug Fix: Fixed bug that affected the use of the tuple constructor. It was not properly updating the variadic type arguments. This resulted in false negatives for the resulting type.

Bug Fix: Fixed bug that resulted in false negatives because diagnostics generated while analyzing a constructor call were suppressed.

Enhancement: Improved stub generator to print "x = ..." rather than include the RHS expression if x is not a type alias.

Enhancement: Added special-case handling for assignments of the form x: List[A] = [a] * y (the multiply operator on a list). This specific idiom is commonly used to initialize a list with None values.

Performance: Added perf improvements that help when dealing with unions that contain many tuples. Improved TypeVar constraint solver to better handle the case where a type is widened to include hundreds of subtypes, thus grinding performance to a halt. This occurs in one of the modules in pytorch.

Enhancement: Rewrote package type verifier based on feedback from users. Its error messages are now much clearer, it distinguishes between "exported symbols" and "other referenced symbols", it properly handles properties, and it omits warnings about missing docstrings by default (can be overridden with "--verbose" setting).

Bug Fix: Fixed bug that resulted in incorrect type evaluation for a constructor call when the class's __new__ method returns an instance of a different class.

pyright - Published 1.1.125

Published by erictraut over 3 years ago

Bug Fix: Disabled the "always False comparison" check for expressions like "sys.platform == 'win32'" because they can vary depending on environment.

Enhancement: Added error check for a class that attempts to derive from NamedTuple and other base classes. This is not supported and will generate runtime exceptions.

Enhancement: Improved type checking for generators. Fixed several false negatives and false positives relating to "yield from" expressions.

Enhancement: Changed special-case logic for self annotations used with __init__ methods to accommodate new usages in typeshed stubs.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed bug in TypeVar constraint solver that resulted in a false positive when using the built-in "filter" method with the "os.path.exists" callback.

Bug Fix: Fixed bug where "comparison chaining" was not being appropriately applied to expressions that contained "is", "is not", "in" and "not in" operators in a chain (e.g. "1" in "1" == "1").

Enhancement: Added smarter handling of empty lists ([]) and dicts ({}). Previously, these were inferred to have types list[Unknown] and dict[Unknown, Unknown], respectively. They are now provided with a known type if the variable is assigned a known list or dict type along another code path.

Bug Fix (from pylance): Made hover text, signature help, and completion suggestions show function docstring using same code.

Bug Fix (from pylance): Fixed issue with partial stub files in cases where a stub file is found but no corresponding source (.py) file is found.

pyright - Published 1.1.124

Published by erictraut over 3 years ago

Bug Fix: Fixed bug where a keyword parameter with a generic type (a TypeVar) and a default value of "..." caused the TypeVar to be assigned a value of "Any".

Bug Fix: Fixed recent regression that caused certain diagnostics to be suppressed when calling a constructor with an expected type.

Enhancement: Added missing check indicated in PEP 589 for TypedDict fields that override a parent class field by the same name with a different type.

Bug Fix: Added support for TypeVar where the bound or constrained types are literals.

Behavior Change: Changed "stubPath is not a valid directory" logging from an error to a warning. The fact that the value defaults to "typings" and most users don't have a typings folder results in confusion, so a warning is more appropriate here.

Enhancement: Updated typeshed stubs.

Bug Fix: Fixed bug that resulted in false negatives when a generic class was used within a subscript (e.g. within the type argument of another type) and no type arguments were specified for the generic class. This also resulted in such types not properly getting default values. For example, in the expression Union[int, Callable], the Callable was not being interpreted as Callable[..., Unknown].

Enhancement: Improved error message for partially-unknown lambda type.

Bug Fix: Fixed a bug in the logic for inferring the type of list expressions when the expected type is "object".

Bug Fix: Improved handling of bidirectional inference for call expressions when the expected type contains a union of literals and the function returns a generic type.

Enhancement: Added new check for a common source of bugs where an equals operator within an if statement compares two values whose literal types do not overlap and will therefore never evaluate to True.

pyright - Published 1.1.123

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in handling of "Final" type annotation with no specified type argument (e.g. "x: Final = 4").

Enhancement: Added support for inferring type of subscripted tuple when subscript is a negative integer literal.

Bug Fix: Fixed recent regression where super(A, self).x did not return an unknown type if class A had a class in its MRO that had an unknown type.

Bug Fix: Allow lowercase tuple type to be subscripted in versions of Python prior to 3.9 if it is within a quoted annotation.

Bug Fix: Fixed false positive error due to constraint solver's handling of a TypeVar used within a Callable parameter that is matched to a function parameter annotated with another TypeVar.

Enhancement: Improved handling of literals within constraint solver when used with bidirectional type inference.

Bug Fix: Fixed bug that caused false positive error when a generic call expression was used for an argument to an overloaded function and TypeVar matching errors were reported.

Enhancement: Deferred resolution of metaclass during class type resolution to improve compatibility with code generated by mypy-protobuf, which contains cyclical dependencies.

Bug Fix: Fixed bug in declaration provider that caused declaration of class variables to not be resolved correctly when accessed via a cls parameter in a class method.

Bug Fix: Fixed bug in symbol resolution when a local class mirrors the name of a class in typing (e.g. List) but is not imported from typing and is used in a context where it is forward declared without quotes.

Bug Fix (from pylance): Avoid recursing infinitely when searching for source files when there is a cyclical symlink present.

Bug Fix: Fixed type inference for "yield" expressions. The previous code was using the same logic for "yield" and "yield from".

Enhancement: Added check to determine if type variables in generic protocols use the appropriate variance.

Performance Improvement: Limited "implied else type narrowing" to expressions that have declared types. It's too expensive to infer types.

pyright - Published 1.1.122

Published by erictraut over 3 years ago

Bug Fix: Fixed false positive error in constructor method with an input parameter annotated with a class-scoped TypeVar and with a default value.

Enhancement: Improved performance of type analysis for certain code patterns that involve inferred types of variables that are used in deeply nested loops and chains of updates. In one such example, this change reduced the analysis time from ~17000ms to ~200ms.

Bug Fix: Fixed bug in the handling of the owner parameter for the __get__ method in a descriptor class. The type evaluator was using an Any type rather than the proper class type in this case.

Bug Fix: Updated TypeVar constraint solver so it tracks a "narrow bound" and "wide bound" for each TypeVar as they are being solved. This fixes several subtle bugs.

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: Added new top-level "extraPaths" config option for pythonconfig.json that specifies the default extraPaths to use when no execution environments apply to a file. Changed settings logic to use the new default extraPaths mechanism for the "python.analysis.extraPaths" setting.

Bug Fix: Fixed bug related to the handling of from . import X statement located in a file other than __init__.py. When used outside of an __init__.py file, this import looks for the __init__.py and imports the requested symbol X from it rather than looking for a submodule X.

Enhancement: Improved completion provider's handling of method overrides so it properly handles properties.

Enhancement (from pylance): Add lowercased items from __all__ in auto-imports.

Bug Fix: Fixed bug in constraint solver that occurs when a constrained TypeVar is used in conjunction with a protocol that has a contravariant TypeVar.

pyright - Published 1.1.121

Published by erictraut over 3 years ago

Bug Fix: Fixed a bug that generated a false positive error when a function (or other callable) was assigned to a Hashable protocol.

Enhancement (from pylance): Made auto-imports lazy for better completion suggestion performance.

Enhancement (from pylance): Improved readability of hover text for functions and methods with overloaded signatures.

Bug Fix: Fixed false positive error when using an instance or class variable defined within a Protocol class within a method in that same class. The previous logic was based on a misinterpretation of a sentence in PEP 544.

Bug Fix: Fixed false positive error in type checker when dealing with two types that are both unions and both contain constrained type variables.

Bug Fix: Fixed improper handling of symlinks used in editable installs. This affected auto-import functionality.

Bug Fix: Fixed recent regression that caused crash in hover provider.

Bug Fix (from pylance): Fixed issue that caused editable installs to require a restart of the language server before their effects were visible.

Bug Fix: Fixed false positive error during TypeVar constraint solving in the case where the same TypeVar is used in both the form T and Type[T] in the same signature.

Enhancement: Improved support for enums. The Python spec indicates that attributes that start and end with an underscore are not treated as enum members, nor are attributes that are assigned a descriptor object.

Enhancement: Added support for inferring the "value" and "name" fields of an enum.

Bug Fix: Added support for unparenthesized pattern subject lists in match statement.

Bug Fix: Fixed false positive error related to a type alias declared within a class.

pyright - Published 1.1.120

Published by erictraut over 3 years ago

Bug Fix: Fixed type evaluation bug that resulted in the incorrect inference of an exception type within an "except X as Y" clause when the expression X was a bound TypeVar.

Enhancement: Improved detection and error reporting for class definitions that depend on themselves (illegal cyclical dependency). Previously, pyright failed in ways that were difficult to diagnose.

Enhancement: Added support for symbolic links in import resolver both for resolution of ".pth" files and for imports themselves.

Behavior Change: Removed support for "venv" entry in execution environments since this never really worked. Clarified in documentation that import resolution within an execution environment is not transitive.

Bug Fix: Fixed bug in completion provider that caused class variables not be included as suggestions as members for the "cls" parameter in a class method.

Enhancement: Added error check for access to non-required fields in a TypedDict using a subscript with a literal string field name. Added support for "narrowing" of a TypedDict class based on guard expression of the form "S in D" where S is a string literal name of a non-required field. Improved the synthesized "get" method on a TypedDict for non-required fields; it now returns an Optional[T] (where T is the defined type for that field) rather than just T.

Enhancement: Updated to the latest typeshed stubs.

Enhancement: Added error check for a "yield" or "yield from" statement used within a list comprehension. This generates a runtime syntax error.

Bug Fix: Fixed bug in type inference for value returned by a "yield" or "yield from" statement.