Text of typing.python.org › en › latest as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Static Typing with Python — typing documentation

Navigation index next | Python » typing documentation » Static Typing with Python | Theme | Static Typing with Python ¶ Tutorials ¶ Using External Libraries Guides ¶ Typing Python Libraries The Trouble (Or Lack Thereof) With Lambda Writing and Maintaining Stub Files Modernizing Superseded Typing Features Unreachable Code and Exhaustiveness Checking Type Narrowing Reasons to avoid static type checking Reference ¶ Generics Protocols and structural subtyping Typing Best Practices Testing and Ensuring Type Annotation Quality typing Module Documentation See also The documentation at https://mypy.readthedocs.io/ is relatively accessible and complete.

Specification ¶ Specification for the Python type system The Python Type System Meta-topics Type system concepts Type annotations Type forms Special types in annotations Generics Type qualifiers Class type assignability Type aliases Literals Protocols Callables Constructors Overloads Exceptions Dataclasses Typed dictionaries Tuples Named Tuples Enumerations Type narrowing Type checker directives Distributing type information Historical and deprecated features Glossary Typing PEPs ¶ Significant changes to the Python Type System Specification are proposed and discussed in Python Enhancement Proposals (PEPs).

See https://peps.python.org/topic/typing for a list of all current and historical typing-related PEPs. Indices and tables ¶ Index Search Page Discussions and Support ¶ User help forum Developer forum The #type-hinting channel on the Python Discord server The former developer mailing list has been archived: Archive of typing-sig Typing-related Tools ¶ Type Checkers ¶ mypy pyrefly pyright ty Zuban The extent to which these adhere to the specification is monitored by a conformance test suite ( results ).

Development Environments ¶ PyCharm , an IDE that supports type stubs both for type checking and code completion. Visual Studio Code , a code editor that supports type checking using mypy, pyrefly, pyright, ty, Zuban, or the Pylance extension. Linters and Formatters ¶ black , a code formatter with support for type stub files. flake8-pyi , a plugin for the flake8 linter that adds support for type stubs. ruff , a linter built for speed, with support for most of the flake8-pyi rules.

Type-Hint and Stub Integration ¶ autotyping , a tool which infers simple types from their context and inserts them as inline type-hints. merge-pyi , a thin wrapper around ApplyTypeAnnotationsVisitor from libCST that integrates .pyi signatures as inline type-hints in Python source code. pyrefly infer , a sub-command of Pyrefly which inserts the types that Pyrefly infers as inline type-hints. Table of Contents Static Typing with Python Tutorials Guides Reference Specification Typing PEPs Indices and tables Discussions and Support Typing-related Tools Type Checkers Development Environments Linters and Formatters Type-Hint and Stub Integration Next topic Using External Libraries This Page Show Source Quick search Navigation index next | Python » typing documentation » Static Typing with Python | Theme | © Copyright 2021, The Python Typing Team.

This page is licensed under the Python Software Foundation License Version 2. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. The Python Software Foundation is a non-profit corporation. Please donate. Created using Sphinx 9.1.0.