An open API service indexing awesome lists of open source software.

awesome-python-typing

Collection of awesome Python types, stubs, plugins, and tools to work with them.
https://github.com/typeddjango/awesome-python-typing

Last synced: 11 days ago
JSON representation

Additional types

  • meiga - Simple, typed and monad-based Result type.
  • option - Rust like Option and Result types.
  • optype - Opinionated collections.abc and operators alternative: Flexible single-method protocols and typed operators with predictable names.
  • phantom-types - Phantom types.
  • returns - Make your functions return something meaningful, typed, and safe.
  • safetywrap - Fully typesafe, Rust-like Result and Option types.
  • useful-types - Collection of useful protocols and type aliases.
  • annotated-types - Reusable constraint types to use with typing.Annotated.
  • annotated-doc - Document parameters, class attributes, return types, and variables inline, with typing.Annotated.

Articles

PEPs

  • PEP-3107 - Function Annotations.
  • PEP-482 - Literature Overview for Type Hints.
  • 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

Backports and improvements

  • future-typing - Backport for type hinting generics in standard collections and union types as X | Y.
  • typing-utils - Backport 3.8+ runtime typing utils(for eg: get_origin) & add issubtype & more.
  • typing-extensions - Backported and experimental type hints.

Dynamic type checkers

  • beartype - Unbearably fast $O(1)$ runtime type-checking in pure Python.
  • 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.
  • typedpy - Type-safe, strict Python. Works well with standard Python.
  • typeguard - Another one runtime type checker.
  • trycast - Parse JSON-like values whose shape is defined by typed dictionaries (TypedDicts) and other standard Python type hints.
  • type_enforced - Fast runtime type enforcement for annotations with no dependencies. Includes fast $O(1)$ and full $O(n)$ operations.
  • pydantic - Data parsing using Python type hinting. Supports dataclasses.

Integrations

Related

Static type checkers

  • PyCharm - IDE for Professional Developers.
  • basedmypy - Based static typing with baseline functionality.
  • basedpyright - Pyright fork with improvements to VSCode support and various other fixes.
  • mypy - Optional static typing (PEP 484).
  • pyanalyze - Extensible static analyzer and 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.
  • ty - An extremely fast Python type checker, written in Rust, from the creators of Ruff and uv.
  • pyrefly - A fast type checker and language server for Python.
  • pycroscope - A semi-static type checker for Python code. It imports the modules it type checks, enabling pycroscope to understand many dynamic constructs that other type checkers will reject. This makes it possible to extend pycroscope with plugins that interact directly with your code.
  • zuban - A Mypy-compatible Python type checker and Language Server built in Rust.
  • pylyzer - A fast static code analyzer & language server for Python, written in Rust.

Stub packages

Tools

Helper tools to add annotations to existing code

  • 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.
  • autotyping - Automatically add simple return type annotations for functions (bool, None, Optional).
  • infer-types - CLI tool to automatically infer and add type annotations into Python code.
  • no_implicit_optional - A codemod to make your implicit optional type hints PEP 484 compliant.
  • pyannotate - Insert annotations into your source code based on call arguments and return types observed at runtime.
  • pytest-annotate - Pyannotate plugin for pytest.
  • pytest-monkeytype - MonkeyType plugin for pytest.
  • auto-optional - Makes typed arguments Optional when the default argument is None.
  • RightTyper - 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.
  • pytype annotate-ast - A work-in-progress tool to annotate the nodes of an AST with their Python types.
  • jsonschema-gentypes - Generate Python types based on TypedDict from a JSON Schema.

Linters

  • flake8-annotations-complexity - Plugin for flake8 to validate annotations complexity.
  • flake8-annotations - Plugin for flake8 to check for presence of type annotations in function definitions.
  • flake8-type-checking - Plugin to help you guard any type-annotation-only import correctly.
  • flake8-typing-imports - Plugin which checks that typing imports are properly guarded.
  • wemake-python-styleguide - The strictest and most opinionated Python linter ever.
  • flake8-typing-only-imports - flake8 plugin that helps identify which imports to put into type-checking blocks, and how to adjust your type annotations once imports are moved.
  • Ruff - Extremely fast linter which supports lint rules from many other lint tools, such as flake8.
  • flake8-pyi - Plugin for Flake8 that provides specializations for type hinting stub files.
  • flake8-type-ignore - flake8 plugin to disallow type: ignore comments in your typed Python code.

Mypy plugins

Testing

Working with types

  • mypyc - Compiles mypy-annotated, statically typed Python modules into CPython C extensions.
  • com2ann - Tool for translation of type comments to type annotations.
  • mypy-baseline - Integrate mypy with existing codebase. A CLI tool that filters out existing type errors and reports only new ones.
  • retype - Another tool to apply stubs to code.
  • typeforce - CLI tool that enriches your Python environment with type annotations, empowering mypy.
  • typing-inspect - The typing_inspect module defines experimental API for runtime inspection of types defined in the typing module.
  • typesplainer - A Python type explainer.
  • mypy-protobuf - Tool to generate mypy stubs from protobufs.
  • mypy-silent - Silence mypy by adding or removing code comments.
  • typing-json - Lib for working with typed objects and JSON.