Releases: python/typing_extensions
Releases · python/typing_extensions
4.9.0rc1
- Add support for PEP 705, adding
typing_extensions.ReadOnly. Patch
by Jelle Zijlstra. - All parameters on
NewType.__call__are now positional-only. This means that
the signature oftyping_extensions.NewType.__call__now exactly matches the
signature oftyping.NewType.__call__. Patch by Alex Waygood. - Fix bug with using
@deprecatedon a mixin class. Inheriting from a
deprecated class now raises aDeprecationWarning. Patch by Jelle Zijlstra. @deprecatednow gives a better error message if you pass a non-str
argument to themsgparameter. Patch by Alex Waygood.@deprecatedis now implemented as a class for better introspectability.
Patch by Jelle Zijlstra.- Exclude
__match_args__fromProtocolmembers.
Backport of python/cpython#110683 by Nikita Sobolev. - When creating a
typing_extensions.NamedTupleclass, ensure__set_name__
is called on all objects that define__set_name__and exist in the values
of theNamedTupleclass's class dictionary. Patch by Alex Waygood,
backporting python/cpython#111876. - Improve the error message when trying to call
issubclass()against a
Protocolthat has non-method members. Patch by Alex Waygood (backporting
python/cpython#112344, by Randolph Scholz).
4.8.0
Changes since 4.7.1:
- Add
typing_extensions.Doc, as proposed by PEP 727. Patch by
Sebastián Ramírez. - Drop support for Python 3.7 (including PyPy-3.7). Patch by Alex Waygood.
- Fix bug where
get_original_bases()would return incorrect results when
called on a concrete subclass of a generic class. Patch by Alex Waygood
(backporting python/cpython#107584, by James
Hilton-Balfe). - Fix bug where
ParamSpec(default=...)would raise aTypeErroron Python
versions <3.11. Patch by James Hilton-Balfe
No changes since 4.8.0rc1.
4.8.0rc1
- Add
typing_extensions.Doc, as proposed by PEP 727. Patch by
Sebastián Ramírez. - Drop support for Python 3.7 (including PyPy-3.7). Patch by Alex Waygood.
- Fix bug where
get_original_bases()would return incorrect results when
called on a concrete subclass of a generic class. Patch by Alex Waygood
(backporting python/cpython#107584, by James
Hilton-Balfe). - Fix bug where
ParamSpec(default=...)would raise aTypeErroron Python
versions <3.11. Patch by James Hilton-Balfe
4.7.1
- Fix support for
TypedDict,NamedTupleandis_protocolon PyPy-3.7 and
PyPy-3.8. Patch by Alex Waygood. Note that PyPy-3.7 and PyPy-3.8 are unsupported
by the PyPy project. The next feature release of typing-extensions will
drop support for PyPy-3.7 and may also drop support for PyPy-3.8.
4.7.0
This is a feature release. Major changes include:
- All non-deprecated names from
typingare now re-exported bytyping_extensionsfor convenience - Add
typing_extensions.get_protocol_membersandtyping_extensions.is_protocol - Declare support for Python 3.12
- This will be the last feature release to support Python 3.7, which recently reached its end-of-life
Full changelog of versions 4.7.0 and 4.7.0rc1:
Release 4.7.0 (June 28, 2023)
- This is expected to be the last feature release supporting Python 3.7,
which reaches its end of life on June 27, 2023. Version 4.8.0 will support
only Python 3.8.0 and up. - Fix bug where a
typing_extensions.Protocolclass that had one or more
non-callable members would raiseTypeErrorwhenissubclass()
was called against it, even if it defined a custom__subclasshook__
method. The correct behaviour -- which has now been restored -- is not to
raiseTypeErrorin these situations if a custom__subclasshook__method
is defined. Patch by Alex Waygood (backporting
python/cpython#105976).
Release 4.7.0rc1 (June 21, 2023)
- Add
typing_extensions.get_protocol_membersand
typing_extensions.is_protocol(backport of CPython PR #104878).
Patch by Jelle Zijlstra. typing_extensionsnow re-exports all names in the standard library's
typingmodule, except the deprecatedByteString. Patch by Jelle
Zijlstra.- Due to changes in the implementation of
typing_extensions.Protocol,
typing.runtime_checkablecan now be used ontyping_extensions.Protocol
(previously, users had to usetyping_extensions.runtime_checkableif they
were usingtyping_extensions.Protocol). - Align the implementation of
TypedDictwith the implementation in the
standard library on Python 3.9 and higher.
typing_extensions.TypedDictis now a function instead of a class. The
private functions_check_fails,_dict_new, and_typeddict_new
have been removed.is_typeddictnow returnsFalsewhen called with
TypedDictitself as the argument. Patch by Jelle Zijlstra. - Declare support for Python 3.12. Patch by Jelle Zijlstra.
- Fix tests on Python 3.13, which removes support for creating
TypedDictclasses through the keyword-argument syntax. Patch by
Jelle Zijlstra. - Fix a regression introduced in v4.6.3 that meant that
issubclass(object, typing_extensions.Protocol)would erroneously raise
TypeError. Patch by Alex Waygood (backporting the CPython PR
python/cpython#105239). - Allow
Protocolclasses to inherit fromtyping_extensions.Bufferor
collections.abc.Buffer. Patch by Alex Waygood (backporting
python/cpython#104827, by Jelle Zijlstra). - Allow classes to inherit from both
typing.Protocolandtyping_extensions.Protocol
simultaneously. Since v4.6.0, this causedTypeErrorto be raised due to a
metaclass conflict. Patch by Alex Waygood. - Backport several deprecations from CPython relating to unusual ways to
createTypedDicts andNamedTuples. CPython PRs #105609 and #105780
by Alex Waygood;typing_extensionsbackport by Jelle Zijlstra.- Creating a
NamedTupleusing the functional syntax with keyword arguments
(NT = NamedTuple("NT", a=int)) is now deprecated. - Creating a
NamedTuplewith zero fields using the syntaxNT = NamedTuple("NT")
orNT = NamedTuple("NT", None)is now deprecated. - Creating a
TypedDictwith zero fields using the syntaxTD = TypedDict("TD")
orTD = TypedDict("TD", None)is now deprecated.
- Creating a
- Fix bug on Python 3.7 where a protocol
Xthat had a memberawould not be
considered an implicit subclass of an unrelated protocolYthat only has a
membera. Where the members ofXare a superset of the members ofY,
Xshould always be considered a subclass ofYiffYis a
runtime-checkable protocol that only has callable members. Patch by Alex
Waygood (backporting CPython PR
python/cpython#105835).
4.7.0rc1
This is a pre-release; please test it! 4.7.0 final is expected in one week (June 28).
Changelog:
- Add
typing_extensions.get_protocol_membersand
typing_extensions.is_protocol(backport of CPython PR #104878).
Patch by Jelle Zijlstra. typing_extensionsnow re-exports all names in the standard library's
typingmodule, except the deprecatedByteString. Patch by Jelle
Zijlstra.- Due to changes in the implementation of
typing_extensions.Protocol,
typing.runtime_checkablecan now be used ontyping_extensions.Protocol
(previously, users had to usetyping_extensions.runtime_checkableif they
were usingtyping_extensions.Protocol). - Align the implementation of
TypedDictwith the implementation in the
standard library on Python 3.9 and higher.
typing_extensions.TypedDictis now a function instead of a class. The
private functions_check_fails,_dict_new, and_typeddict_new
have been removed.is_typeddictnow returnsFalsewhen called with
TypedDictitself as the argument. Patch by Jelle Zijlstra. - Declare support for Python 3.12. Patch by Jelle Zijlstra.
- Fix tests on Python 3.13, which removes support for creating
TypedDictclasses through the keyword-argument syntax. Patch by
Jelle Zijlstra. - Fix a regression introduced in v4.6.3 that meant that
issubclass(object, typing_extensions.Protocol)would erroneously raise
TypeError. Patch by Alex Waygood (backporting the CPython PR
python/cpython#105239). - Allow
Protocolclasses to inherit fromtyping_extensions.Bufferor
collections.abc.Buffer. Patch by Alex Waygood (backporting
python/cpython#104827, by Jelle Zijlstra). - Allow classes to inherit from both
typing.Protocolandtyping_extensions.Protocol
simultaneously. Since v4.6.0, this causedTypeErrorto be raised due to a
metaclass conflict. Patch by Alex Waygood. - Backport several deprecations from CPython relating to unusual ways to
createTypedDicts andNamedTuples. CPython PRs #105609 and #105780
by Alex Waygood;typing_extensionsbackport by Jelle Zijlstra.- Creating a
NamedTupleusing the functional syntax with keyword arguments
(NT = NamedTuple("NT", a=int)) is now deprecated. - Creating a
NamedTuplewith zero fields using the syntaxNT = NamedTuple("NT")
orNT = NamedTuple("NT", None)is now deprecated. - Creating a
TypedDictwith zero fields using the syntaxTD = TypedDict("TD")
orTD = TypedDict("TD", None)is now deprecated.
- Creating a
- Fix bug on Python 3.7 where a protocol
Xthat had a memberawould not be
considered an implicit subclass of an unrelated protocolYthat only has a
membera. Where the members ofXare a superset of the members ofY,
Xshould always be considered a subclass ofYiffYis a
runtime-checkable protocol that only has callable members. Patch by Alex
Waygood (backporting CPython PR
python/cpython#105835).