Skip to content

Commit 89ec0e9

Browse files
authored
gh-106745: typing docs: Clarify that removal of PEP-585 aliases is not currently planned (#106748)
1 parent aeef859 commit 89ec0e9

File tree

1 file changed

+45
-25
lines changed

1 file changed

+45
-25
lines changed

Doc/library/typing.rst

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,6 +3101,7 @@ Constant
31013101
.. versionadded:: 3.5.2
31023102

31033103
.. _generic-concrete-collections:
3104+
.. _deprecated-aliases:
31043105

31053106
Deprecated aliases
31063107
------------------
@@ -3109,16 +3110,21 @@ This module defines several deprecated aliases to pre-existing
31093110
standard library classes. These were originally included in the typing
31103111
module in order to support parameterizing these generic classes using ``[]``.
31113112
However, the aliases became redundant in Python 3.9 when the
3112-
corresponding pre-existing classes were enhanced to support ``[]``.
3113+
corresponding pre-existing classes were enhanced to support ``[]`` (see
3114+
:pep:`585`).
31133115

3114-
The redundant types are deprecated as of Python 3.9 but no
3115-
deprecation warnings are issued by the interpreter.
3116-
It is expected that type checkers will flag the deprecated types
3117-
when the checked program targets Python 3.9 or newer.
3116+
The redundant types are deprecated as of Python 3.9. However, while the aliases
3117+
may be removed at some point, removal of these aliases is not currently
3118+
planned. As such, no deprecation warnings are currently issued by the
3119+
interpreter for these aliases.
31183120

3119-
The deprecated types will be removed from the :mod:`typing` module
3120-
no sooner than the first Python version released 5 years after the release of Python 3.9.0.
3121-
See details in :pep:`585`—*Type Hinting Generics In Standard Collections*.
3121+
If at some point it is decided to remove these deprecated aliases, a
3122+
deprecation warning will be issued by the interpreter for at least two releases
3123+
prior to removal. The aliases are guaranteed to remain in the typing module
3124+
without deprecation warnings until at least Python 3.14.
3125+
3126+
Type checkers are encouraged to flag uses of the deprecated types if the
3127+
program they are checking targets a minimum Python version of 3.9 or newer.
31223128

31233129
.. _corresponding-to-built-in-types:
31243130

@@ -3651,20 +3657,34 @@ Certain features in ``typing`` are deprecated and may be removed in a future
36513657
version of Python. The following table summarizes major deprecations for your
36523658
convenience. This is subject to change, and not all deprecations are listed.
36533659

3654-
+-------------------------------------+---------------+-------------------+----------------+
3655-
| Feature | Deprecated in | Projected removal | PEP/issue |
3656-
+=====================================+===============+===================+================+
3657-
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
3658-
| collections | | | |
3659-
+-------------------------------------+---------------+-------------------+----------------+
3660-
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
3661-
+-------------------------------------+---------------+-------------------+----------------+
3662-
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
3663-
+-------------------------------------+---------------+-------------------+----------------+
3664-
| ``typing.Hashable`` and | 3.12 | Undecided | :gh:`94309` |
3665-
| ``typing.Sized`` | | | |
3666-
+-------------------------------------+---------------+-------------------+----------------+
3667-
| ``typing.TypeAlias`` | 3.12 | Undecided | :pep:`695` |
3668-
+-------------------------------------+---------------+-------------------+----------------+
3669-
| ``typing.no_type_check_decorator`` | 3.13 | 3.15 | :gh:`106309` |
3670-
+-------------------------------------+---------------+-------------------+----------------+
3660+
.. list-table::
3661+
:header-rows: 1
3662+
3663+
* - Feature
3664+
- Deprecated in
3665+
- Projected removal
3666+
- PEP/issue
3667+
* - ``typing`` versions of standard collections
3668+
- 3.9
3669+
- Undecided (see :ref:`deprecated-aliases` for more information)
3670+
- :pep:`585`
3671+
* - :class:`typing.ByteString`
3672+
- 3.9
3673+
- 3.14
3674+
- :gh:`91896`
3675+
* - :data:`typing.Text`
3676+
- 3.11
3677+
- Undecided
3678+
- :gh:`92332`
3679+
* - :class:`typing.Hashable` and :class:`typing.Sized`
3680+
- 3.12
3681+
- Undecided
3682+
- :gh:`94309`
3683+
* - :data:`typing.TypeAlias`
3684+
- 3.12
3685+
- Undecided
3686+
- :pep:`695`
3687+
* - :func:`@typing.no_type_check_decorator <no_type_check_decorator>`
3688+
- 3.13
3689+
- 3.15
3690+
- :gh:`106309`

0 commit comments

Comments
 (0)