Pytype

Latest version: v2024.10.11

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

Scan your dependencies

Page 9 of 34

2022.11.18

Updates:
* Allow NoReturn to appear anywhere.
* Add basic TypeGuard support.

Bug fixes:
* Improve imports handling in the pytd printer.
* Do a better job of catching bad parameterized types in pyi files.
* Fix constant folding for python-3.9+ literals compiling to LIST_EXTEND.
* Stop accidentally converting bound to unbound functions.

2022.11.10

Updates:
* Add an optional no-return-any flag to disallow Any as a return type.
* Add a mechanism to allow per-file opting in to feature flags, via a file-level
`features` directive, for example, ` pytype: features=no-return-any`.

Bug fixes:
* Do not let a kwarg in **args interfere with a posonly arg of the same name,
pyi edition.
* Interpret special characters in serialized (pyi or pickle) Literal[""] type
definitions correctly.

2022.10.26

Updates:
* Implement basic exhaustiveness checking for pattern matches over enums.
* Performance improvements:
* Avoid expensive variable filtering in a couple of places.
* Switch fully to argument-by-argument call matching for PyTDFunction.

Bug fixes:
* Relax an overly strict TypeVar consistency check.
* Track TypeVar unions in the matcher.
* Emit `node/kind record` and `subkind class` facts instead of `node/kind class`
* Add a missing parameter type to bytearray.__add__.

2022.10.13

Updates:
* Add a flag, --mapping-is-not-sequence, to forbid matching mappings against
the Sequence protocol.
* Add a library for serializing the CFG.
* Fully support pattern matching in 3.10, aside from exhaustiveness checks.
* Make some performance improvements around type-checking of function call
arguments for functions defined in the same file.

Bug fixes:
* Store more information in matcher._recursive_annots_cache.
* Fix "appears only once" TypeVar error on overloads in generic classes.
* Do not let a kwarg in **args interfere with a posonly arg of the same name.
* Re-resolve LateType instances that resolve to another LateType.

2022.09.27

Updates:
* Slightly improve pytype's numpy stub.
* Remove --overriding-parameter-type-checks flag that is now enabled by default.
* Add partial support for pattern matching.
* Add `Attrs` protocol and `__attrs_attrs__` member to attr overlay.

Bug fixes:
* Fix infinite recursion caused by annotated __new__ methods.
* Take nested classes into account when re-resolving dependencies in load_pytd.
* Support empty generic protocols.
* Correct type annotations for IO objects: `seek` and `truncate`.
* Define __new__ instead of __init__ for np.ndarray.

2022.09.19

Updates:
* Rework arg parsing to make using pytype as a library in tools easier.
* Move typegraph and cfg graph visualisation to a separate frontend binary.
* Add a feature flag, --always-use-return-annotations, to always use return type
annotations when analyzing function calls.
* Default --overriding-parameter-type-checks to True. This flag will be removed
in an upcoming release.

Bug fixes:
* Add an OrderedCode object to LOAD_FOLDED_CONST.
* Treat LiteralString as str in pyi files.
* xref:
* Replace `record` into `package` kind and add `childof` edge from `file`.
* Do not add a defines/binding edge for `a.x = ...` if `a` is not `self`.

Page 9 of 34

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.