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

Overview

Awesome Python Typing Awesome Gitter

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

Contents

Full list of typed projects on PyPi is here.

Static type checkers

  • mypy - Optional static typing (PEP 484).
  • pyanalyze - Extensible static analyzer and type checker.
  • pycharm - IDE for Professional Developers.
  • pyre - Performant type-checker.
  • pyright - 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 - Tool to check and infer types - without requiring type annotations.

Dynamic type checkers

  • beartype - Unbearably fast O(1) runtime type-checking in pure Python.
  • pydantic - Data parsing using Python type hinting. Supports dataclasses.
  • pytypes - Provides a rich set of utilities for runtime typechecking.
  • strongtyping - Decorator which checks whether the function is called with the correct type of parameters.
  • typeguard - Another one runtime type checker.
  • typical - Data parsing and automatic type-coercion using type hinting. Supports dataclasses, standard classes, function signatures, and more.

Stub packages

Additional types

  • meiga - Simple, typed and monad-based Result type.
  • option - Rust like Option and Result types.
  • phantom-types - Phantom types.
  • returns - Make your functions return something meaningful, typed, and safe.
  • safetywrap - Fully typesafe, Rust-like Result and Option types.
  • typet - Length-bounded types, dynamic object validation.

Backports and improvements

  • typed-ast - Modified fork of CPython's ast module that parses # type: comments.
  • typing-extensions - Backported and experimental type hints.
  • typing-utils - Backport 3.8+ runtime typing utils(for eg: get_origin) & add issubtype & more.
  • typingplus - Backport support, dynamic is_instance and cast for abstract types.

Tools

Linters

Testing

Working with types

  • com2ann - Tool for translation of type comments to type annotations.
  • merge-pyi - Part of pytype toolchain, applies stub files onto source code.
  • mypy-protobuf - Tool to generate mypy stubs from protobufs.
  • mypy-silent - Silence mypy by adding or removing code comments.
  • mypyc - Compiles mypy-annotated, statically typed Python modules into CPython C extensions.
  • retype - Another tool to apply stubs to code.
  • pep585-upgrade - Pre-commit hook configured to automatically upgrade your type hints to the new native types implemented in PEP 585.
  • typing-inspect - The typing_inspect module defines experimental API for runtime inspection of types defined in the typing module.
  • typing-json - Lib for working with typed objects and JSON.

Helper tools to add annotations to existing code

  • autotyper - Automatically add simple return type annotations for functions (bool, None, Optional).
  • monkeytype - 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.
  • pyannotate - Insert annotations into your source code based on call arguments and return types observed at runtime.
  • pyre infer - 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.
  • pytest-annotate - Pyannotate plugin for pytest.
  • pytest-monkeytype - MonkeyType plugin for pytest.
  • pytype annotate-ast - A work-in-progress tool to annotate the nodes of an AST with their Python types.
  • type4py - Deep Similarity Learning-Based Type Inference.
  • typilus - A deep learning algorithm for predicting types in Python. Also available as a GitHub action

Mypy plugins

Integrations

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.

Third-party articles

Communities

Related

  • awesome-python - Curated list of awesome Python frameworks, libraries, software and resources.
  • python-typecheckers - List of Python type checkers: static and runtime.
Owner
TypedDjango
We make types for Django framework!
TypedDjango
The official GitHub mirror of https://gitlab.com/pycqa/flake8

Flake8 Flake8 is a wrapper around these tools: PyFlakes pycodestyle Ned Batchelder's McCabe script Flake8 runs all the tools by launching the single f

Python Code Quality Authority 2.6k Jan 03, 2023
Enforce the same configuration across multiple projects

Nitpick Flake8 plugin to enforce the same tool configuration (flake8, isort, mypy, Pylint...) across multiple Python projects. Useful if you maintain

Augusto W. Andreoli 315 Dec 25, 2022
A Python Parser

parso - A Python Parser Parso is a Python parser that supports error recovery and round-trip parsing for different Python versions (in multiple Python

Dave Halter 520 Dec 26, 2022
A static type analyzer for Python code

pytype - 🦆 ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Pymxs, the 3DsMax bindings of Maxscript to Python doesn't come with any stubs

PyMXS Stubs generator What Pymxs, the 3DsMax bindings of Maxscript to Python doe

Frieder Erdmann 19 Dec 27, 2022
Check for python builtins being used as variables or parameters

Flake8 Builtins plugin Check for python builtins being used as variables or parameters. Imagine some code like this: def max_values(list, list2):

Gil Forcada Codinachs 98 Jan 08, 2023
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 04, 2023
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

beartype 1.4k Jan 01, 2023
A static-analysis bot for Github

Imhotep, the peaceful builder. What is it? Imhotep is a tool which will comment on commits coming into your repository and check for syntactic errors

Justin Abrahms 221 Nov 10, 2022
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 Dec 16, 2022
Naming Convention checker for Python

PEP 8 Naming Conventions Check your code against PEP 8 naming conventions. This module provides a plugin for flake8, the Python code checker. (It repl

Python Code Quality Authority 411 Dec 23, 2022
Python classes with types validation at runtime.

typedclasses Python classes with types validation at runtime. (Experimental & Under Development) Installation You can install this library using Pytho

Izhar Ahmad 8 Feb 06, 2022
Pyright extension for coc.nvim

coc-pyright Pyright extension for coc.nvim Install :CocInstall coc-pyright Note: Pyright may not work as expected if can't detect project root correct

Heyward Fann 1.1k Jan 02, 2023
Utilities for pycharm code formatting (flake8 and black)

Pycharm External Tools Extentions to Pycharm code formatting tools. Currently supported are flake8 and black on a selected code block. Usage Flake8 [P

Haim Daniel 13 Nov 03, 2022
Flake8 Type Annotation Checking

flake8-annotations flake8-annotations is a plugin for Flake8 that detects the absence of PEP 3107-style function annotations and PEP 484-style type co

S. Co1 118 Jan 05, 2023
mypy plugin for loguru

loguru-mypy A fancy plugin to boost up your logging with loguru mypy compatibility logoru-mypy should be compatible with mypy=0.770. Currently there

Tomasz Trębski 13 Nov 02, 2022
Flake8 wrapper to make it nice, legacy-friendly, configurable.

THE PROJECT IS ARCHIVED Forks: https://github.com/orsinium/forks It's a Flake8 wrapper to make it cool. Lint md, rst, ipynb, and more. Shareable and r

Life4 232 Dec 16, 2022
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
Rust like Option and Result types in Python

Option Rust-like Option and Result types in Python, slotted and fully typed. An Option type represents an optional value, every Option is either Some

45 Dec 13, 2022
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providi

Facebook 6.2k Jan 04, 2023