Releases: quora/pyanalyze
Releases · quora/pyanalyze
0.13.1
0.13.0 failed to upload due to a change in PyPI, but as it had already been tagged, this is release 0.13.1.
- Use Trusted Publishing to publish releases (#806)
Changelog for version 0.13.0:
- Flag use of generators that are immediately discarded (#800)
- Fix crash on some occurrences of
ParamSpecin stub files (#797) - Fix crash when Pydantic 1 is installed (#793)
- Fix error on use of TypeVar defaults in stubs (PEP 696). The
default is still ignored, but now the TypeVar is treated as
if it has no default. (#791) - Add new error code
unsafe_comparison, which gets triggered
when two values are compared that can never be equal. (#784) - Improve representation of known module, function, and type objects
in error messages (#788) - Add a mechanism to allow overriding the global variables in an
analyzed module. Use this mechanism to set the type of
qcore.testing.AnythingtoAny. (#786) - Rename the
is_compatibleandget_compatibility_errorfunctions
tois_assignableandget_assignability_errorto align with the
terminology in the typing spec (#785) - Fix binary operations involving unions wrapped in
Annotated(#779) - Fix various issues with Python 3.13 and 3.14 support (#773)
- Improve
ParamSpecsupport (#772, #777) - Fix handling of stub functions with positional-only parameters with
defaults (#769) - Recognize exhaustive pattern matching (#766)
- Narrow the types of variables assigned within complex patterns (#766)
- New error code
generator_returnis raised when a generator does not
return an iterable type, or an async generator does not return an async
iterable type (#756) - Fix type narrowing for certain conditionals using
or(#755) - Fix incorrect
undefined_nameerrors when a class is nested in a nested
function and uses a name from the outer function (#750) - Fix incorrect
possibly_undefined_nameerror on certain uses of the
walrus operator (#749) - Fix narrowing on
isinstancecalls with arguments that are not
instances oftype, such as unions and certain typing special forms (#747) - Detect invalid calls to
isinstance(#747) - Support calls to
TypeVarand several other typing constructs in
code that is not executed (e.g., underif TYPE_CHECKING) (#746) - Fix spurious errors for the class-based syntax for creating
NamedTupleclasses (#746) - Make error registry into a custom class instead of an enum, removing
dependency onaenum(#739) - Treat subclasses of
intas subclasses offloatandcomplextoo (#738) - Fix crash on encountering certain decorators in stubs (#734)
- Fix inference of signature for certain secondary methods (#732)
0.13.0
- Flag use of generators that are immediately discarded (#800)
- Fix crash on some occurrences of
ParamSpecin stub files (#797) - Fix crash when Pydantic 1 is installed (#793)
- Fix error on use of TypeVar defaults in stubs (PEP 696). The
default is still ignored, but now the TypeVar is treated as
if it has no default. (#791) - Add new error code
unsafe_comparison, which gets triggered
when two values are compared that can never be equal. (#784) - Improve representation of known module, function, and type objects
in error messages (#788) - Add a mechanism to allow overriding the global variables in an
analyzed module. Use this mechanism to set the type of
qcore.testing.AnythingtoAny. (#786) - Rename the
is_compatibleandget_compatibility_errorfunctions
tois_assignableandget_assignability_errorto align with the
terminology in the typing spec (#785) - Fix binary operations involving unions wrapped in
Annotated(#779) - Fix various issues with Python 3.13 and 3.14 support (#773)
- Improve
ParamSpecsupport (#772, #777) - Fix handling of stub functions with positional-only parameters with
defaults (#769) - Recognize exhaustive pattern matching (#766)
- Narrow the types of variables assigned within complex patterns (#766)
- New error code
generator_returnis raised when a generator does not
return an iterable type, or an async generator does not return an async
iterable type (#756) - Fix type narrowing for certain conditionals using
or(#755) - Fix incorrect
undefined_nameerrors when a class is nested in a nested
function and uses a name from the outer function (#750) - Fix incorrect
possibly_undefined_nameerror on certain uses of the
walrus operator (#749) - Fix narrowing on
isinstancecalls with arguments that are not
instances oftype, such as unions and certain typing special forms (#747) - Detect invalid calls to
isinstance(#747) - Support calls to
TypeVarand several other typing constructs in
code that is not executed (e.g., underif TYPE_CHECKING) (#746) - Fix spurious errors for the class-based syntax for creating
NamedTupleclasses (#746) - Make error registry into a custom class instead of an enum, removing
dependency onaenum(#739) - Treat subclasses of
intas subclasses offloatandcomplextoo (#738) - Fix crash on encountering certain decorators in stubs (#734)
- Fix inference of signature for certain secondary methods (#732)
0.12.0
New features
- Add support for the
ReadOnlytype qualifier (PEP 705) and
for theclosed=TrueTypedDict argument (PEP 728) (#723) - Add support for
TypeIsfrom PEP 742 (#718) - More PEP 695 support: generic classes and functions. Scoping rules
are not yet fully implemented. (#703) - Add special handling for
dict.__delitem__(#723, #726)
Compatibility fixes
- Make tests pass with latest release of
typeshed_client(#727) - Fix Protocol compatibility issue with Python 3.13 and an upcoming
release of typing-extensions (#716)
Other bugs
0.11.0
- Partial support for PEP 695-style type aliases. Scoping changes
are not yet fully implemented. (#690, #692) - Fix tests to account for new
typeshed_clientrelease
(#694) - Add option to disable all error codes (#659)
- Add hacky fix for bugs with hashability on type objects (#689)
- Show an error on calls to
typing.Any(#688) - Add command-line option
-c/--codeto typecheck code from
the command line (#685) - Add a
pyanalyze.extensions.EnumNamepredicate and infer it
as the value for the.nameattribute on enums. Also fix
type inference for enum "properties" on Python 3.11 and up. (#682) - Allow
pyanalyze.runtime.is_compatibleto be used to narrow
types (#681, #687) - Fix usage of
assert_type()withAnyand with unions of
Annotatedobjects (#680) - Support inferring
MinLenandMaxLenannotations based
onlen()checks (#680) - Expose a convenience API for runtime type checking in the
pyanalyze.runtimemodule (#674) - Support for annotations from the
annotated-typeslibrary (#673) - Detect undefined attributes on Pydantic models (#670)
- Remove duplicate "attribute_is_never_set" error for classes
with predefined attributes (#670) - Add hook for overriding the value inferred for attributes on
literals (#669) - Support classes that set a
__signature__attribute to
define their constructor signature (such as Pydantic models) (#665) - Declare support for Python 3.12. Not all new features in
Python 3.12 are supported yet. (#656) - Fix treatment of
@propertyby theincompatible_override
check (#653) - Drop support for Python 3.7 (#654)
- Add hardcoded support for
pytest.raisesto avoid false
positives (#651) - Fix crash with nested classes in stubs. For now,
Anyis
inferred for such classes (#647) - Add
disallowed_importsconfiguration option to disallow
imports of specific modules (#645, #646) - Consider an annotated assignment without a value to be
an exported name (#644) - Improve the location where
missing_parameter_annotation
errors are reported (#643) - Add support for suppressing errors in blocks based on
sys.platformandsys.version_infochecks (#641) - Fix compatibility between stub-only callable classes
and the bareCallableannotation (#640) - Add new error code
missing_generic_parameters(off by
default) that flags missing parameters to generic types
such aslist(#637) - Add new error code
reveal_typeforreveal_type()
and similar functions, which previously emitted
inference_failure(#636) - Take into account additional base classes declared in stub
files (fixing some false positives aroundtyping.IO) (#635, #639) - Fix crash on stubs that contain dict or set literals (#634)
- Remove more old special cases and improve robustness of
annotation parsing (#630) - Remove dependency on
typing_inspect(#629) - Fix use of
Literaltypes withtyping_extensions4.6.0 (#628)
0.10.1
0.10.0
- Infer the signature for built-in static methods, such as
dict.fromkeys(#619) - Fix type inference for subscripting on
Sequence(#618) - Improve support for Cythonized methods (#617)
- Add support for the PEP 698
@overridedecorator (#614) - Add support for
__new__methods returningtyping.Self, fixing
various failures with the latest release oftypeshed-client(#615) - Add support for importing stub-only modules in other stubs (#615)
- Fix signature compatibility bug involving
**kwargsand positional-only
arguments (#615) - Fix type narrowing with
inon enum types in the negative case (#606) - Fix crash when
getattr()on a module object throws an error (#603) - Fix handling of positional-only arguments using
/syntax in stubs (#601) - Fix bug where objects with a
__call__method that takes*argsinstead
ofselfwere not considered callable (#600) - Better typechecking support for async generators (#594)
0.9.0
Release highlights:
- Support for PEP 702 (
@typing.deprecated) (#578) - Add experimental
@has_extra_keysdecorator forTypedDicttypes - Support more Python 3.11 features (
except*andget_overloads)
Full changelog:
- Support
typing_extensions.get_overloadsandtyping.get_overloads(#589) - Support
inon objects with only__iter__(#588) - Do not call
.mro()method on non-types (#587) - Add
class_attribute_transformershook (#585) - Support for PEP 702 (
@typing.deprecated) (#578) - Simplify import handling; stop trying to import modules at type checking time (#566)
- Suggest using keyword arguments on calls with too many positional arguments (#572)
- Emit an error for unknown
TypedDictkeys (#567) - Improve type inference for f-strings containing literals (#571)
- Add experimental
@has_extra_keysdecorator forTypedDicttypes (#568) - Fix crash on recursive type aliases. Recursive type aliases now fall back to
Any(#565) - Support
inon objects with only__getitem__(#564) - Add support for
except*(PEP 654) (#562) - Add type inference support for more constructs in
exceptandexcept*(#562)
0.8.0
Release highlights:
- Support for Python 3.11
- Drop support for Python 3.6
- Support for PEP 692 (
Unpackon**kwargs)
Full changelog:
- Infer
async deffunctions as returningCoroutine, not
Awaitable(#557, #559) - Drop support for Python 3.6 (#554)
- Require
typeshed_client>=2.1.0. Older versions will throw
false-positive errors around context managers when
typeshed_client2.1.0 is installed. (#554) - Fix false positive error certain method calls on literals (#548)
- Preserve
Annotatedannotations on access to methods of
literals (#541) allow_callcallables are now also called if the arguments
are literals wrapped inAnnotated(#540)- Support Python 3.11 (#537)
- Fix type checking of binary operators involving unions (#531)
- Improve
TypeVarsolution heuristic for constrained
typevars with multiple solutions (#532) - Fix resolution of stringified annotations in
__init__methods (#530) - Type check
yield,yield from, andreturnnodes in generators (#529) - Type check calls to comparison operators (#527)
- Retrieve attributes from stubs even when a runtime
equivalent exists (#526) - Fix attribute access to stub-only names (#525)
- Remove a number of unnecessary special-cased signatures
(#499) - Add support for use of the
Unpackoperator to
annotate heterogeneous*argsand**kwargsparameters (#523) - Detect incompatible types for some calls to
list.append,
list.extend,list.__add__, andset.add(#522) - Optimize local variables with very complex inferred types (#521)
0.7.0
Release highlights:
- Support for PEP 673 (
Self) - Support for PEP 675 (
LiteralString) - Support for
assert_typeand other additions totypingin Python 3.11
Full changelog:
- Remove
SequenceIncompleteValue(#519) - Add implementation function for
dict.pop(#517) - Remove
WeakExtension(#517) - Fix propagation of no-return-unless constraints from calls
to unions (#518) - Initial support for variable-length heterogeneous sequences
(required for PEP 646). More precise types are now inferred
for heterogeneous sequences containing variable-length
objects. (#515, #516) - Support
LiteralString(PEP 675) (#514) - Add
unused_assignmenterror code, separated out from
unused_variable. Enable these error codes and
possibly_undefined_nameby default (#511) - Fix handling of overloaded methods called on literals (#513)
- Partial support for running on Python 3.11 (#512)
- Basic support for checking
Finaland for checking re-assignments
to variables declared with a specific type (#505) - Correctly check the
selfargument to@propertygetters (#506) - Correctly track assignments of variables inside
tryblocks
and insidewithblocks that may suppress exceptions (#504) - Support mappings that do not inherit from
collections.abc.Mapping
(#501) - Improve type inference for calls to
set(),list(), and
tuple()with union arguments (#500) - Remove special-cased signatured for
sorted()(#498) - Support type narrowing on
bool()calls (#497) - Support context managers that may suppress exceptions (#496)
- Fix type inference for
withassignment targets on
Python 3.7 and higher (#495) - Fix bug where code after a
whileloop is considered
unreachable if allbreakstatements are inside ofif
statements (#494) - Remove support for detecting properties that represent
synchronous equivalents of asynq methods (#493) - Enable exhaustive checking of enums and booleans (#492)
- Fix type narrowing in else branch if constraint is stored in a
variable (#491) - Fix incorrectly inferred
Neverreturn type for some function
implementations (#490) - Infer precise call signatures for
TypedDicttypes (#487) - Add mechanism to prevent crashes on objects
with unusual__getattr__methods (#486) - Infer callable signatures for objects with a
__getattr__method (#485, #488) - Do not treat attributes that raise an exception on access
as nonexistent (#481) - Improve detection of unhashable dict keys and set members (#469)
- The
inandnot inoperators always return
booleans (#480) - Allow
NotImplementedto be returned from special
methods that support it (#479) - Fix bug affecting type compatibility between
generics and literals (#474) - Add support for
typing.Neverandtyping_extensions.Never(#472) - Add
inferred_any, an extremely noisy error code
that triggers whenever the type checker infers something asAny(#471) - Optimize type compatibility checks on large unions (#469)
- Detect incorrect key types passed to
dict.__getitem__(#468) - Pick up the signature of
open()from typeshed correctly (#463) - Do not strip away generic parameters explicitly set to
Any(#467) - Fix bug that led to some overloaded calls incorrectly
resolving toAny(#462) - Support
__init__and__new__signatures from typeshed (#430) - Fix incorrect type inferred for indexing operations on
subclasses oflistandtuple(#461) - Add plugin providing a precise type for
dict.getcalls (#460) - Fix internal error when an
__eq__method throws (#461) - Fix handling of
async defmethods in stubs (#459) - Treat Thrift enums as compatible with protocols that
intis compatible with (#457) - Assume that dataclasses have no dynamic attributes (#456)
- Treat Thrift enums as compatible with
int(#455) - Fix treatment of
TypeVarwith bounds or constraints
as callables (#454) - Improve
TypeVarsolution algorithm (#453) - Cache decisions about whether classes implement protocols (#450)
- Fix application of multiple suggested changes per file
when an earlier change has added or removed lines (#449) - Treat
NoReturnlikeAnyin**kwargscalls (#446) - Improve error messages for overloaded calls (#445)
- Infer
NoReturninstead ofAnyfor unreachable code (#443) - Make
NoReturncompatible with all other types (#442) - Fix treatment of walrus operator in
and,or, andif/else
expressions (#441) - Refactor
isinstance()support (#440) - Exclude
Any[unreachable]from unified values (#439) - Add support for
reveal_locals()(#436) - Add support for
assert_error()(#435) - Add support for
assert_type()(#434) reveal_type()anddump_value()now return their argument,
the anticipated behavior fortyping.reveal_type()in Python
3.11 (#433)- Fix return type of async generator functions (#431)
- Type check function decorators (#428)
- Handle
NoReturninasync deffunctions (#427) - Support PEP 673 (
typing_extensions.Self) (#423) - Updates for compatibility with recent changes in typeshed (#421):
- Fix override compatibility check for unknown callables
- Fix usage of removed type
_typeshed.SupportsLessThan
- Remove old configuration abstraction (#414)
0.6.0
Release highlights:
- Support for configuration through
pyproject.toml. The old
configuration mechanism will be removed in the next release. - Support for experimental new type evaluation mechanism, providing
a more powerful replacement for overloads. - Support for suggesting annotations for unannotated code.
Full changelog:
- Support generic type evaluators (#409)
- Implement return annotation behavior for type evaluation
functions (#408) - Support
extend_configoption inpyproject.toml(#407) - Remove the old method return type check. Use the new
incompatible_overridecheck instead (#404) - Migrate remaining config options to new abstraction (#403)
- Fix stub classes with references to themselves in their
base classes, such asos._ScandirIteratorin typeshed (#402) - Fix type narrowing on the
elsecase ofissubclass()
(#401) - Fix indexing a list with an index typed as a
TypeVar(#400) - Fix "This function should have an @asynq() decorator"
false positive on lambdas (#399) - Fix compatibility between Union and Annotated (#397)
- Fix potential incorrect inferred return value for
unannotated functions (#396) - Fix compatibility between Thrift enums and TypeVars (#394)
- Fix accessing attributes on Unions nested within
Annotated (#393) - Fix interaction of
register_error_code()with new
configuration mechanism (#391) - Check against invalid
Signatureobjects and prepare
for refactoringSignaturecompatibility logic (#390) - Treat
intandfloatas compatible withcomplex,
as specified in PEP 484 (#389) - Do not error on boolean operations on values typed
asobject(#388) - Support type narrowing on enum types and
bool
inmatchstatements (#387) - Support some imports from stub-only modules (#386)
- Support type evaluation functions in stubs (#386)
- Support
TypedDictin stubs (#386) - Support
TypeAlias(PEP 612) (#386) - Small improvements to
ParamSpecsupport (#385) - Allow
CustomCheckto customize what values
a value can be assigned to (#383) - Fix incorrect inference of
selfargument on
some nested methods (#382) - Fix compatibility between
CallableandAnnotated
(#381) - Fix inference for nested
async deffunctions (#380) - Fix usage of type variables in function parameters
with defaults (#378) - Support the Python 3.10
matchstatement (#376) - Support the walrus (
:=) operator (#375) - Initial support for proposed new "type evaluation"
mechanism (#374, #379, #384, #410) - Create command-line options for each config option (#373)
- Overhaul treatment of function definitions (#372)
- Support positional-only arguments
- Infer more precise types for lambda functions
- Infer more precise types for nested functions
- Refactor related code
- Add check for incompatible overrides in child classes
(#371) - Add
pyanalyze.extensions.NoReturnGuard(#370) - Infer call signatures for
Type[X](#369) - Support configuration in a
pyproject.tomlfile (#368) - Require
typeshed_client2.0 (#361) - Add JSON output for integrating pyanalyze's output with other
tools (#360) - Add check that suggests parameter and return types for untyped
functions, using the newsuggested_parameter_typeand
suggested_return_typecodes (#358, #359, #364) - Extract constraints from multi-comparisons (
a < b < c) (#354) - Support positional-only arguments with the
__prefix
outside of stubs (#353) - Add basic support for
ParamSpec(#352) - Fix error on use of
AbstractAsyncContextManager(#350) - Check
withandasync withstatements (#344) - Improve type compatibility between generics and literals (#346)
- Infer signatures for method wrapper objects (bound methods
of builtin types) (#345) - Allow storing type narrowing constraints in variables (#343)
- The first argument to
__new__and__init_subclass__
does not need to beself(#342) - Drop dependencies on
attrsandmypy_extensions(#341) - Correct location of error for incompatible parameter (#339)