awesome-python-typing

Type checker

A collection of tools and libraries for Python type checking and static analysis.

Collection of awesome Python types, stubs, plugins, and tools to work with them.

GitHub

2k stars
48 watching
68 forks
last commit: 2 months ago
Linked from 4 awesome lists

awesomeawesome-listmypymypy-pluginsmypy-stubspep484pyipythonpython-stubspython-types

Awesome Python Typing / Static type checkers

basedmypy 143 4 days ago Based static typing with baseline functionality
basedpyright 1,192 4 days ago Pyright fork with improvements to VSCode support and various other fixes
mypy 18,511 5 days ago Optional static typing (PEP 484)
pyanalyze 343 3 days ago Extensible static analyzer and type checker
pycharm IDE for Professional Developers
pylyzer 2,483 8 days ago A fast static code analyzer & language server for Python, written in Rust
pyre Performant type-checker
pyright 13,427 6 days ago 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
pytype 4,773 8 days ago Tool to check and infer types - without requiring type annotations

Awesome Python Typing / Dynamic type checkers

beartype 2,738 9 days ago Unbearably fast runtime type-checking in pure Python
pydantic 21,145 4 days ago Data parsing using Python type hinting. Supports dataclasses
pytypes 200 over 1 year ago Provides a rich set of utilities for runtime typechecking
strongtyping 108 2 months ago Decorator which checks whether the function is called with the correct type of parameters
typedpy 16 about 2 months ago Type-safe, strict Python. Works well with standard Python
typeguard 1,545 18 days ago Another one runtime type checker
typical 181 2 months ago Data parsing and automatic type-coercion using type hinting. Supports dataclasses, standard classes, function signatures, and more
trycast 78 4 months ago Parse JSON-like values whose shape is defined by typed dictionaries (TypedDicts) and other standard Python type hints

Awesome Python Typing / Stub packages

asgiref 1,482 about 1 month ago ASGI specification, provides module with type annotations for ASGI servers
boto3-stubs Stubs for
botostubs 95 almost 2 years ago Gives you code assistance for any boto3 API in any IDE
celery-types 87 22 days ago Type stubs for and its related packages , , , , and
django-stubs 1,612 3 days ago Stubs for
djangorestframework-stubs 453 3 days ago Stubs for
grpc-stubs 36 7 months ago Stubs for
lxml-stubs 43 6 months ago Stubs for
PyQt5-stubs 68 over 1 year ago Stubs for
python-phonenumbers-stubs 2 about 3 years ago Stubs for
pythonista-stubs 13 3 months ago Stubs for
scipy-stubs 16 3 days ago Stubs for
sqlalchemy-stubs 572 5 months ago Stubs for
sqlalchemy2-stubs Official stubs and mypy plugin for
torchtyping 1,408 4 months ago Enhanced type annotations for
types-aiobotocore Stubs for
typeshed 4,380 4 days ago Collection of library stubs, with static types

Awesome Python Typing / Additional types

meiga 76 about 1 month ago Simple, typed and monad-based Result type
option 85 11 months ago Rust like Option and Result types
optype 15 6 days ago Opinionated and alternative: Flexible single-method protocols and typed operators with predictable names
phantom-types 199 15 days ago Phantom types
returns 3,594 6 days ago Make your functions return something meaningful, typed, and safe
safetywrap 44 about 4 years ago Fully typesafe, Rust-like Result and Option types
typet 22 about 5 years ago Length-bounded types, dynamic object validation
useful-types 99 about 1 month ago Collection of useful protocols and type aliases

Awesome Python Typing / Backports and improvements

future-typing 19 over 3 years ago Backport for type hinting generics in standard collections and union types as
typing-extensions 444 3 days ago Backported and experimental type hints
typing-utils 12 about 2 years ago Backport 3.8+ runtime typing utils(for eg: get_origin) & add issubtype & more

Awesome Python Typing / Tools / Linters

flake8-annotations-complexity 46 over 1 year ago Plugin for flake8 to validate annotations complexity
flake8-annotations 156 14 days ago Plugin for flake8 to check for presence of type annotations in function definitions
flake8-pyi 73 about 1 month ago Plugin for Flake8 that provides specializations for type hinting stub files
flake8-type-checking 113 8 days ago Plugin to help you guard any type-annotation-only import correctly
flake8-typing-imports 49 23 days ago Plugin which checks that typing imports are properly guarded
flake8-typing-only-imports 113 8 days ago 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-type-ignore flake8 plugin to disallow type: ignore comments in your typed Python code
wemake-python-styleguide 2,541 6 days ago The strictest and most opinionated Python linter ever
Ruff 32,812 6 days ago Extremely fast linter which supports lint rules from many other lint tools, such as flake8

Awesome Python Typing / Tools / Testing

mypy-test 5 about 1 year ago Test mypy plugins, stubs, custom types
pytest-mypy-plugins 103 5 months ago Pytest plugin for testing mypy types, stubs, and plugins
pytest-mypy-testing 30 9 months ago Pytest plugin to test mypy static type analysis
pytest-mypy 248 about 1 month ago Mypy static type checker plugin for Pytest

Awesome Python Typing / Tools / Working with types

com2ann 141 8 months ago Tool for translation of type comments to type annotations
merge-pyi 4,773 8 days ago Part of pytype toolchain, applies stub files onto source code
mypy-baseline 55 about 1 month ago Integrate mypy with existing codebase. A CLI tool that filters out existing type errors and reports only new ones
mypy-protobuf 653 8 days ago Tool to generate mypy stubs from protobufs
mypy-silent 14 14 days ago Silence mypy by adding or removing code comments
mypyc 18,511 5 days ago Compiles mypy-annotated, statically typed Python modules into CPython C extensions
retype 142 over 2 years ago Another tool to apply stubs to code
typeforce 19 about 2 years ago CLI tool that enriches your Python environment with type annotations, empowering mypy
typesplainer 82 over 1 year ago A Python type explainer
typing-inspect 350 3 months ago The typing_inspect module defines experimental API for runtime inspection of types defined in the module
typing-json Lib for working with typed objects and JSON

Awesome Python Typing / Tools / Helper tools to add annotations to existing code

autotyping 238 about 2 months ago Automatically add simple return type annotations for functions (bool, None, Optional)
infer-types 85 over 1 year ago CLI tool to automatically infer and add type annotations into Python code
jsonschema-gentypes 40 17 days ago Generate Python types based on TypedDict from a JSON Schema
monkeytype 4,779 4 months ago 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
no_implicit_optional 82 12 months ago A codemod to make your implicit optional type hints compliant
pyannotate 1,428 over 2 years ago Insert annotations into your source code based on call arguments and return types observed at runtime
PyTypes 11 about 2 years ago Infer Types by Python Tracing
pyre infer 6,859 6 days ago Pyre has a powerful feature for migrating codebases to a typed format. The command-line option ingests a file or directory, makes educated guesses about the types used, and applies the annotations to the files
pytest-annotate 109 over 2 years ago Pyannotate plugin for pytest
pytest-monkeytype 43 over 4 years ago MonkeyType plugin for pytest
pytype annotate-ast 4,773 8 days ago A work-in-progress tool to annotate the nodes of an AST with their Python types
type4py 61 about 1 year ago Deep Similarity Learning-Based Type Inference
typilus 59 almost 2 years ago A deep learning algorithm for predicting types in Python. Also available as a
auto-optional 17 almost 2 years ago Makes typed arguments Optional when the default argument is

Awesome Python Typing / Tools / Mypy plugins

kubernetes-typed 20 2 months ago Plugin for kubernetes type checking
loguru-mypy 19 7 months ago Plugin for support
mypy-zope 39 17 days ago Plugin for support
mypy/plugins 18,511 5 days ago Plugins already integrated into mypy
numpy Plugin for support
pynamodb-mypy 4 about 2 years ago Plugin for support

Awesome Python Typing / Integrations

emacs-flycheck-mypy 38 over 4 years ago Mypy integration for Emacs
mypy-playground 71 3 days ago Online playground for mypy
mypy-pycharm-plugin 314 over 3 years ago Mypy integration for PyCharm
pylance 1,719 7 days ago PyRight integration for VSCode
vim-mypy 97 about 5 years ago Mypy integration for Vim
nbQA 1,051 11 days ago Run type checkers (e.g. Mypy) on Jupyter Notebooks

Awesome Python Typing / Articles / PEPs

PEP-3107 Function Annotations
PEP-482 Literature Overview for Type Hints
PEP-483 The Theory of Type Hints
PEP-484 Type Hints
PEP-526 Syntax for Variable Annotations
PEP-544 Protocols: Structural subtyping (static duck typing)
PEP-557 Data Classes
PEP-560 Core support for typing module and generic types
PEP-561 Distributing and Packaging Type Information
PEP-563 Postponed Evaluation of Annotations
PEP-585 Type Hinting Generics In Standard Collections
PEP-586 Literal Types
PEP-589 TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys
PEP-591 Adding a final qualifier to typing
PEP-593 Flexible function and variable annotations
PEP-604 Complementary syntax for Union[]
PEP-612 Parameter Specification Variables
PEP-613 Explicit Type Aliases

Awesome Python Typing / Articles / Third-party articles

1-minute guide to real constants in Python Full tutorial about constants and inheritance
Simple dependent types in Python Full tutorial about types
Testing mypy stubs, plugins, and types Full tutorial about testing mypy types
Our journey to type checking 4 million lines of Python Dropbox has been one of the first companies to adopt Python static type checking at this scale
PyTest MonkeyType Introduction Type Annotate an existing Python Django Codebase with MonkeyType
The state of type hints in Python As of May 2018
Type hints cheat sheet Cheat sheet on writing type annotations by MyPy team
Typechecking Django and DRF Full tutorial about type-checking django
Type Check Your Django Application An article based on two recent talks on adding type checks to Django
typing Official Python documentation for module
Python-typing-koans 119 almost 3 years ago A set of examples to learn optional static typing in Python
Python Type Checking (Guide) In this guide, you will get a look into Python type checking
Adding type hints to urllib3 Tests are not enough: Case study adding type hints to urllib3
Adam Johnsons Blog Adam Johnson blogs about typing practices
ParamSpec Guide Newly released feature in allows you do a lot of advanced typing things with functions and their signatures
Static Typing Python Decorators Accurately static typing decorators in Python is an icky business. The wrapper function obfuscates type information required to statically determine the types of the parameters and the return values of the wrapped function

Awesome Python Typing / Communities

python/typing Official typing gitter chat
TypedDjango Official organisation gitter chat
PythonRu#typing Russian slack chat (invites are ) about types
awesome-python 225,227 3 months ago Curated list of awesome Python frameworks, libraries, software and resources
python-typecheckers 62 over 2 years ago List of Python type checkers: static and runtime

Backlinks from these awesome lists:

More related projects: