Home

typingextensions

typing_extensions is an open-source Python library that provides backports and extensions to the typing module. It offers implementations of typing constructs that were introduced in newer Python releases or as provisional features, making them available on older interpreters and enabling experimentation.

Typical features include Literal for exact values, TypedDict for dict-typed records, Protocol for structural subtyping, Final

Usage is straightforward: install via pip install typing_extensions, then import types from typing_extensions, e.g., from typing_extensions

Compatibility: typing_extensions is designed to be source-compatible with the typing module, and its members are often

Relationship: It is separate from the standard typing module but complements it. It is widely used in

Maintenance: The project is community-driven, with releases coordinated with Python's typing evolution. It is hosted on

to
declare
constants,
Annotated
for
metadata
attached
to
types,
and
runtime_checkable
to
permit
isinstance
checks
on
Protocols.
It
also
includes
several
utility
types
and
helpers
that
appear
in
typing
in
newer
Python
versions.
import
Literal,
TypedDict,
Protocol,
runtime_checkable,
Annotated.
Importing
from
typing_extensions
avoids
feature
gaps
when
targeting
older
Python
versions
or
when
adopting
new
typing
features
early.
available
on
Python
versions
that
do
not
yet
ship
equivalent
features
in
the
standard
library,
as
well
as
on
newer
versions.
open-source
projects
to
ensure
type
hints
remain
portable
across
Python
versions
until
the
standard
library
catches
up.
PyPI
and
GitHub,
with
contributors
maintaining
compatibility
across
Python
versions.