|
| 1 | +================= |
| 2 | +Typing Extensions |
| 3 | +================= |
| 4 | + |
| 5 | +.. image:: https://badges.gitter.im/python/typing.svg |
| 6 | + :alt: Chat at https://gitter.im/python/typing |
| 7 | + :target: https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge |
| 8 | + |
| 9 | +Overview |
| 10 | +======== |
| 11 | + |
| 12 | +The ``typing_extensions`` module contains both backports of changes made to |
| 13 | +the ``typing`` module since Python 3.5.0 as well as experimental types that |
| 14 | +will be eventually added to the ``typing`` module once stabilized. |
| 15 | + |
| 16 | +This module is intended to be used by people who: |
| 17 | + |
| 18 | +1. Are using Python 3.5+ and cannot upgrade to newer versions of Python. |
| 19 | + Since the ``typing`` module was (provisionally) added to the Python standard |
| 20 | + library in 3.5, users who are unable to upgrade cannot take advantage of |
| 21 | + new additions to typing such as ``typing.Text`` or ``typing.Coroutine``. |
| 22 | +2. Are interested in using experimental additions to the ``typing`` module. |
| 23 | + |
| 24 | +Users of other Python versions should continue to install and use |
| 25 | +use the ``typing`` module from PyPi instead of using this one unless |
| 26 | +specifically writing code that must be compatible with multiple Python |
| 27 | +versions or requires experimental types. |
| 28 | + |
| 29 | +Included items |
| 30 | +============== |
| 31 | + |
| 32 | +This module currently contains the following: |
| 33 | + |
| 34 | +All Python versions: |
| 35 | +-------------------- |
| 36 | + |
| 37 | +- ``ClassVar`` |
| 38 | +- ``Collection`` |
| 39 | +- ``ContextManager`` |
| 40 | +- ``Counter`` |
| 41 | +- ``DefaultDict`` |
| 42 | +- ``Deque`` |
| 43 | +- ``NewType`` |
| 44 | +- ``NoReturn`` |
| 45 | +- ``overload`` (note that older versions of ``typing`` only let you use ``overload`` in stubs) |
| 46 | +- ``Text`` |
| 47 | +- ``Type`` |
| 48 | +- ``TYPE_CHECKING`` |
| 49 | + |
| 50 | +Python 3.3+ only: |
| 51 | +----------------- |
| 52 | + |
| 53 | +- ``ChainMap`` |
| 54 | + |
| 55 | +Python 3.5+ only: |
| 56 | +----------------- |
| 57 | + |
| 58 | +- ``AsyncIterable`` |
| 59 | +- ``AsyncIterator`` |
| 60 | +- ``AsyncContextManager`` |
| 61 | +- ``Awaitable`` |
| 62 | +- ``Coroutine`` |
| 63 | + |
| 64 | +Python 3.6+ only: |
| 65 | +----------------- |
| 66 | + |
| 67 | +- ``AsyncGenerator`` |
| 68 | + |
| 69 | +Other Notes and Limitations |
| 70 | +=========================== |
| 71 | + |
| 72 | +There are a few types whose interface was modified between different |
| 73 | +versions of typing. For example, ``typing.Sequence`` was modified to |
| 74 | +subclass ``typing.Reversible`` as of Python 3.5.3. |
| 75 | + |
| 76 | +These changes are _not_ backported to prevent subtle compatibility |
| 77 | +issues when mixing the differing implementations of modified classes. |
| 78 | + |
| 79 | +Running tests |
| 80 | +============= |
| 81 | + |
| 82 | +To run tests, navigate into the appropriate source directory and run |
| 83 | +``test_typing_extensions.py``. You will also need to install the latest |
| 84 | +version of ``typing`` if you are using a version of Python that does not |
| 85 | +include ``typing`` as a part of the standard library. |
| 86 | + |
0 commit comments