pytype

A static type analyzer for Python code

Home
User guide
Developer guide
Error classes
FAQ
Typing FAQ
Supported features
Mailing list
File a bug

View the Project on GitHub google/pytype

Hosted on GitHub Pages — Theme by orderedlist

Support

This page lists the Python versions and features supported by the latest version of pytype.

Python Version

Version Analyzes Runs In Issue
2.7 2021.08.03 2020.04.01 #545
3.5 2021.09.09 2020.10.08 #677
3.6  
3.7  
3.8  
3.9  
3.10 #1022

Features

Core

Note: pytype supports all language and stdlib features in its supported versions unless noted otherwise. This section lists features that are difficult to type for which pytype has or intends to add custom support.

Feature Supports Issues
Control Flow Analysis (“Type Narrowing”)  
collections.namedtuple  
Dataclasses  
Enums Requires --use-enum-overlay flag

Typing

Feature Version Supports Issues
PEP 484 – Type Hints 3.5  
PEP 526 – Syntax for Variable Annotations 3.6  
PEP 544 – Protocols 3.8  
PEP 561 – Distributing and Packaging Type Information 3.7 #151
PEP 563 – Postponed Evaluation of Annotations 3.7  
PEP 585 – Type Hinting Generics in Standard Collections 3.9  
PEP 586 – Literal Types 3.8 🟡 #790
PEP 589 – TypedDict 3.8 #680
PEP 591 – Adding a Final Qualifier to Typing 3.8 #680
PEP 593 – Flexible Function and Variable Annotations 3.9  
PEP 604 – Allow Writing Union Types as X | Y 3.10 #785
PEP 612 – Parameter Specification Variables 3.10 #786
PEP 613 – Explicit Type Aliases 3.11+ #787
PEP 647 – User-Defined Type Guards 3.10 #916
Custom Recursive Types 3.6 #407
Generic Type Aliases 3.6  
Type Annotation Inheritance 3.6 #81

Third-Party Libraries

Note: This section does not list all third-party libraries that pytype supports, only the ones that are difficult to type for which pytype has or intends to add custom support.

Feature Supports Issues
Attrs  
Flax 🟡 Google-internal
Numpy 🟡 Minimal type stub
Tensorflow 🟡 Minimal, Google-internal