Pyanalyze

Latest version: v0.12.0

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

Scan your dependencies

Page 1 of 2

0.12.0

New features

- Add support for the `ReadOnly` type qualifier (PEP 705) and
for the `closed=True` TypedDict argument (PEP 728) (723)
- Add support for `TypeIs` from 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

- Fix some higher-order behavior of `TypeGuard` and `TypeIs` (719)
- Fix type inference when constructing user-defined generic classes
(703)
- Fix bug in type compatibility check between known-length sequence
types and literal values (701)

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_client` release
(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`/`--code` to typecheck code from
the command line (685)
- Add a `pyanalyze.extensions.EnumName` predicate and infer it
as the value for the `.name` attribute on enums. Also fix
type inference for enum "properties" on Python 3.11 and up. (682)
- Allow `pyanalyze.runtime.is_compatible` to be used to narrow
types (681, 687)
- Fix usage of `assert_type()` with `Any` and with unions of
`Annotated` objects (680)
- Support inferring `MinLen` and `MaxLen` annotations based
on `len()` checks (680)
- Expose a convenience API for runtime type checking in the
`pyanalyze.runtime` module (674)
- Support for annotations from the `annotated-types` library (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 `property` by the `incompatible_override`
check (653)
- Drop support for Python 3.7 (654)
- Add hardcoded support for `pytest.raises` to avoid false
positives (651)
- Fix crash with nested classes in stubs. For now, `Any` is
inferred for such classes (647)
- Add `disallowed_imports` configuration 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.platform` and `sys.version_info` checks (641)
- Fix compatibility between stub-only callable classes
and the bare `Callable` annotation (640)
- Add new error code `missing_generic_parameters` (off by
default) that flags missing parameters to generic types
such as `list` (637)
- Add new error code `reveal_type` for `reveal_type()`
and similar functions, which previously emitted
`inference_failure` (636)
- Take into account additional base classes declared in stub
files (fixing some false positives around `typing.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 `Literal` types with `typing_extensions` 4.6.0 (628)

0.10.1

- Fix errors with protocol matching on `typing_extensions` 4.6.0
(626)
- Fix false positive error when annotations refer to classes defined
inside functions (624)

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 `override` decorator (614)
- Add support for `__new__` methods returning `typing.Self`, fixing
various failures with the latest release of `typeshed-client` (615)
- Add support for importing stub-only modules in other stubs (615)
- Fix signature compatibility bug involving `**kwargs` and positional-only
arguments (615)
- Fix type narrowing with `in` on 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 `*args` instead
of `self` were 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_keys` decorator for `TypedDict` types
- Support more Python 3.11 features (`except*` and `get_overloads`)

Full changelog:
- Support `typing_extensions.get_overloads` and `typing.get_overloads` (589)
- Support `in` on objects with only `__iter__` (588)
- Do not call `.mro()` method on non-types (587)
- Add `class_attribute_transformers` hook (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 `TypedDict` keys (567)
- Improve type inference for f-strings containing literals (571)
- Add experimental `has_extra_keys` decorator for `TypedDict` types (568)
- Fix crash on recursive type aliases. Recursive type aliases now fall back to `Any` (565)
- Support `in` on objects with only `__getitem__` (564)
- Add support for `except*` (PEP 654) (562)
- Add type inference support for more constructs in `except` and `except*` (562)

0.8.0

Release highlights:
- Support for Python 3.11
- Drop support for Python 3.6
- Support for PEP 692 (``Unpack`` on ``**kwargs``)

Full changelog:
- Infer `async def` functions as returning `Coroutine`, 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_client` 2.1.0 is installed. (554)
- Fix false positive error certain method calls on literals (548)
- Preserve `Annotated` annotations on access to methods of
literals (541)
- `allow_call` callables are now also called if the arguments
are literals wrapped in `Annotated` (540)
- Support Python 3.11 (537)
- Fix type checking of binary operators involving unions (531)
- Improve `TypeVar` solution heuristic for constrained
typevars with multiple solutions (532)
- Fix resolution of stringified annotations in `__init__` methods (530)
- Type check `yield`, `yield from`, and `return` nodes 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 `Unpack` operator to
annotate heterogeneous `*args` and `**kwargs` parameters (523)
- Detect incompatible types for some calls to `list.append`,
`list.extend`, `list.__add__`, and `set.add` (522)
- Optimize local variables with very complex inferred types (521)

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.