Python > Typing
Optional static typing for Python.
Contents
Static type checkers
Based static typing with baseline functionality.
Pyright fork with improvements to VSCode support and various other fixes.
Extensible static analyzer and type checker.
A fast static code analyzer & language server for Python, written in Rust.
Fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fast incremental updates when files are modified.
Tools
Mypy plugins
Plugins already integrated into mypy.
Plugin for Kubernetes CRD type checking.
Plugin for loguru support.
Plugin for zope.interface support.
Plugin for PynamoDB support.
Helper tools to add annotations to existing code
A work-in-progress tool to annotate the nodes of an AST with their Python types.
Automatically add simple return type annotations for functions (bool, None, Optional).
CLI tool to automatically infer and add type annotations into Python code.
Generate Python types based on TypedDict from a JSON Schema.
Collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type annotations directly to your code based on the types collected at runtime.
A codemod to make your implicit optional type hints PEP 484 compliant.
Insert annotations into your source code based on call arguments and return types observed at runtime.
Infer Types by Python Tracing.
Pyre has a powerful feature for migrating codebases to a typed format. The infer command-line option ingests a file or directory, makes educated guesses about the types used, and applies the annotations to the files.
Pyannotate plugin for pytest.
MonkeyType plugin for pytest.
A tool that generates types for your function arguments and return values. RightTyper lets your code run at nearly full speed with almost no memory overhead.
Deep Similarity Learning-Based Type Inference.
A deep learning algorithm for predicting types in Python. Also available as a GitHub action
Makes typed arguments Optional when the default argument is None.
Linters
Plugin for flake8 to validate annotations complexity.
Plugin for flake8 to check for presence of type annotations in function definitions.
Plugin for Flake8 that provides specializations for type hinting stub files.
Plugin to help you guard any type-annotation-only import correctly.
Plugin which checks that typing imports are properly guarded.
flake8 plugin that helps identify which imports to put into type-checking blocks, and how to adjust your type annotations once imports are moved.
flake8 plugin to disallow type: ignore comments in your typed Python code.
The strictest and most opinionated Python linter ever.
Extremely fast linter which supports lint rules from many other lint tools, such as flake8.
Testing
Test mypy plugins, stubs, custom types.
Pytest plugin for testing mypy types, stubs, and plugins.
Pytest plugin to test mypy static type analysis.
Mypy static type checker plugin for Pytest.
Working with types
Tool for translation of type comments to type annotations.
Integrate mypy with existing codebase. A CLI tool that filters out existing type errors and reports only new ones.
Tool to generate mypy stubs from protobufs.
Silence mypy by adding or removing code comments.
Another tool to apply stubs to code.
CLI tool that enriches your Python environment with type annotations, empowering mypy.
A Python type explainer.
The typing_inspect module defines experimental API for runtime inspection of types defined in the typing module.
Dynamic type checkers
Unbearably fast O(1) runtime type-checking in pure Python.
Data parsing using Python type hinting. Supports dataclasses.
Provides a rich set of utilities for runtime typechecking.
Decorator which checks whether the function is called with the correct type of parameters.
Type-safe, strict Python. Works well with standard Python.
Another one runtime type checker.
Data parsing and automatic type-coercion using type hinting. Supports dataclasses, standard classes, function signatures, and more.
Parse JSON-like values whose shape is defined by typed dictionaries (TypedDicts) and other standard Python type hints.
Stub packages
ASGI specification, provides asgiref.typing module with type annotations for ASGI servers.
Gives you code assistance for any boto3 API in any IDE.
Type stubs for Celery and its related packages django-celery-results, ampq, kombu, billiard, vine and ephem.
Stubs for Django.
Stubs for DRF.
Stubs for grpc.
Stubs for lxml.
Stubs for PyQt5.
Stubs for phonenumbers.
Stubs for Pythonista.
Stubs for SciPy.
Stubs for SQLAlchemy.
Enhanced type annotations for PyTorch.
Stubs for aiobotocore.
Collection of library stubs, with static types.
Type stubs for Celery and its related packages django-celery-results, ampq, kombu, billiard, vine and ephem.
Stubs for [boto3](https://github.com/boto/boto3).
Additional types
Simple, typed and monad-based Result type.
Rust like Option and Result types.
Opinionated collections.abc and operators alternative: Flexible single-method protocols and typed operators with predictable names.
Phantom types.
Make your functions return something meaningful, typed, and safe.
Fully typesafe, Rust-like Result and Option types.
Length-bounded types, dynamic object validation.
Collection of useful protocols and type aliases.
Backports and improvements
Backport for type hinting generics in standard collections and union types as X | Y.
Backported and experimental type hints.
Backport 3.8+ runtime typing utils(for eg: get_origin) & add issubtype & more.
Integrations
Mypy integration for Emacs.
Online playground for mypy.
Mypy integration for PyCharm.
PyRight integration for VSCode.
Mypy integration for Vim.
Run type checkers (e.g. Mypy) on Jupyter Notebooks.