Skip to content

Update typing-extensions README #951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 69 additions & 52 deletions typing_extensions/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ Typing Extensions
Overview
========

The ``typing_extensions`` module contains both backports of ``typing`` features
as well as experimental types that will eventually be added to the ``typing``
module, such as ``Protocol`` (see PEP 544 for details about protocols and
static duck typing) or ``TypedDict`` (see PEP 589).

Users of other Python versions should continue to install and use
the ``typing`` module from PyPi instead of using this one unless
specifically writing code that must be compatible with multiple Python
versions or requires experimental types.
The ``typing_extensions`` module serves two related purposes:

- Enable use of new type system features on older Python versions. For example,
``typing.TypeGuard`` is new in Python 3.10, but ``typing_extensions`` allows
users on Python 3.6 through 3.9 to use it too.
- Enable experimentation with new type system PEPs before they are accepted and
added to the ``typing`` module.

New features may be added to ``typing_extensions`` as soon as they are specified
in a PEP that has been added to the `python/peps <https://github.com/python/peps>`_
repository. If the PEP is accepted, the feature will then be added to ``typing``
for the next CPython release. No typing PEP has been rejected so far, so we
haven't yet figured out how to deal with that possibility.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we'll remove it in the next major version. But I have no strong feelings regarding this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me too, but we can figure that out when we get to it.


Starting with version 4.0.0, ``typing_extensions`` uses
`Semantic Versioning <https://semver.org/>`_. The
Expand All @@ -31,49 +35,62 @@ Included items

This module currently contains the following:

- ``Annotated``
- ``AsyncContextManager``
- ``AsyncGenerator``
- ``AsyncIterable``
- ``AsyncIterator``
- ``Awaitable``
- ``ChainMap``
- ``ClassVar``
- ``Concatenate``
- ``ContextManager``
- ``Coroutine``
- ``Counter``
- ``DefaultDict``
- ``Deque``
- ``final``
- ``Final``
- ``Literal``
- ``NewType``
- ``NoReturn``
- ``NotRequired``
- ``overload``
- ``OrderedDict``
- ``ParamSpec``
- ``ParamSpecArgs``
- ``ParamSpecKwargs``
- ``Protocol``
- ``Required``
- ``runtime_checkable``
- ``Self``
- ``Text``
- ``Type``
- ``TypedDict``
- ``TypeAlias``
- ``TypeGuard``
- ``TYPE_CHECKING``

Python 3.7+
-----------

- ``get_origin``
- ``get_args``
- ``get_type_hints``

- Experimental features

- ``NotRequired`` (see PEP 655)
- ``Required`` (see PEP 655)
- ``Self`` (see PEP 673)

- In ``typing`` since Python 3.10

- ``Concatenate`` (see PEP 612)
- ``ParamSpec`` (see PEP 612)
- ``ParamSpecArgs`` (see PEP 612)
- ``ParamSpecKwargs`` (see PEP 612)
- ``TypeAlias`` (see PEP 610)
- ``TypeGuard`` (see PEP 647)

- In ``typing`` since Python 3.9

- ``Annotated`` (see PEP 593)

- In ``typing`` since Python 3.8

- ``final`` (see PEP 591)
- ``Final`` (see PEP 591)
- ``Literal`` (see PEP 586)
- ``Protocol`` (see PEP 544)
- ``runtime_checkable`` (see PEP 544)
- ``TypedDict`` (see PEP 589)
- ``get_origin`` (``typing_extensions`` provides this function only in Python 3.7+)
- ``get_args`` (``typing_extensions`` provides this function only in Python 3.7+)

- In ``typing`` since Python 3.7

- ``OrderedDict``

- In ``typing`` since Python 3.5 or 3.6 (see `the typing documentation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separating out 3.5 and 3.6 is hard because things were added in patch releases (for example, ChainMap was new in 3.5.4 and 3.6.1). Listing out all the details about that doesn't seem useful.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially since we don't support 3.5 anymore.

<https://docs.python.org/3.10/library/typing.html>`_ for details)

- ``AsyncContextManager``
- ``AsyncGenerator``
- ``AsyncIterable``
- ``AsyncIterator``
- ``Awaitable``
- ``ChainMap``
- ``ClassVar`` (see PEP 526)
- ``ContextManager``
- ``Coroutine``
- ``Counter``
- ``DefaultDict``
- ``Deque``
- ``NewType``
- ``NoReturn``
- ``overload``
- ``Text``
- ``Type``
- ``TYPE_CHECKING``
- ``get_type_hints`` (``typing_extensions`` provides this function only in Python 3.7+)

Other Notes and Limitations
===========================
Expand Down