Skip to content

Releases: python/typing_extensions

4.12.0rc1

16 May 19:57
0dbc7c9
Compare
Choose a tag to compare
4.12.0rc1 Pre-release
Pre-release

This release focuses on compatibility with the upcoming release of
Python 3.13. Most changes are related to the implementation of type
parameter defaults (PEP 696).

Thanks to all of the people who contributed patches, especially Alex
Waygood, who did most of the work adapting typing-extensions to the
CPython PEP 696 implementation.

Full changelog:

  • Improve the implementation of type parameter defaults (PEP 696)
    • Backport the typing.NoDefault sentinel object from Python 3.13.
      TypeVars, ParamSpecs and TypeVarTuples without default values now have
      their __default__ attribute set to this sentinel value.
    • TypeVars, ParamSpecs and TypeVarTuples now have a has_default()
      method, matching typing.TypeVar, typing.ParamSpec and
      typing.TypeVarTuple on Python 3.13+.
    • TypeVars, ParamSpecs and TypeVarTuples with default=None passed to
      their constructors now have their __default__ attribute set to None
      at runtime rather than types.NoneType.
    • Fix most tests for TypeVar, ParamSpec and TypeVarTuple on Python
      3.13.0b1 and newer.
    • Backport CPython PR #118774,
      allowing type parameters without default values to follow those with
      default values in some type parameter lists. Patch by Alex Waygood,
      backporting a CPython PR by Jelle Zijlstra.
    • It is now disallowed to use a TypeVar with a default value after a
      TypeVarTuple in a type parameter list. This matches the CPython
      implementation of PEP 696 on Python 3.13+.
    • Fix bug in PEP-696 implementation where a default value for a ParamSpec
      would be cast to a tuple if a list was provided.
      Patch by Alex Waygood.
  • Fix Protocol tests on Python 3.13.0a6 and newer. 3.13.0a6 adds a new
    __static_attributes__ attribute to all classes in Python,
    which broke some assumptions made by the implementation of
    typing_extensions.Protocol. Similarly, 3.13.0b1 adds the new
    __firstlineno__ attribute to all classes.
  • Fix AttributeError when using typing_extensions.runtime_checkable
    in combination with typing.Protocol on Python 3.12.2 or newer.
    Patch by Alex Waygood.
  • At runtime, assert_never now includes the repr of the argument
    in the AssertionError. Patch by Hashem, backporting of the original
    fix python/cpython#91720 by Jelle Zijlstra.
  • The second and third parameters of typing_extensions.Generator,
    and the second parameter of typing_extensions.AsyncGenerator,
    now default to None. This matches the behaviour of typing.Generator
    and typing.AsyncGenerator on Python 3.13+.
  • typing_extensions.ContextManager and
    typing_extensions.AsyncContextManager now have an optional second
    parameter, which defaults to Optional[bool]. The new parameter
    signifies the return type of the __(a)exit__ method, matching
    typing.ContextManager and typing.AsyncContextManager on Python
    3.13+.
  • Backport types.CapsuleType from Python 3.13.
  • Releases are now made using Trusted Publishers
    improving the security of the release process. Patch by Jelle Zijlstra.

4.12.0a2

16 May 19:19
72298f0
Compare
Choose a tag to compare
4.12.0a2 Pre-release
Pre-release

This is another alpha release to test the new release workflow.

4.12.0a1

16 May 19:09
21fde1f
Compare
Choose a tag to compare
4.12.0a1 Pre-release
Pre-release

This release primarily tests a revised release workflow. If all goes
well, release 4.12.0rc1 will follow soon.

  • Backport the typing.NoDefault sentinel object from Python 3.13.
    TypeVars, ParamSpecs and TypeVarTuples without default values now have
    their __default__ attribute set to this sentinel value.
  • TypeVars, ParamSpecs and TypeVarTuples now have a has_default()
    method, matching typing.TypeVar, typing.ParamSpec and
    typing.TypeVarTuple on Python 3.13+.
  • TypeVars, ParamSpecs and TypeVarTuples with default=None passed to
    their constructors now have their __default__ attribute set to None
    at runtime rather than types.NoneType.
  • Fix most tests for TypeVar, ParamSpec and TypeVarTuple on Python
    3.13.0b1 and newer.
  • Backport CPython PR #118774,
    allowing type parameters without default values to follow those with
    default values in some type parameter lists. Patch by Alex Waygood,
    backporting a CPython PR by Jelle Zijlstra.
  • It is now disallowed to use a TypeVar with a default value after a
    TypeVarTuple in a type parameter list. This matches the CPython
    implementation of PEP 696 on Python 3.13+.
  • Fix bug in PEP-696 implementation where default values for ParamSpecs
    would be cast to tuples if a list was provided as the default value.
    Patch by Alex Waygood.
  • Fix Protocol tests on Python 3.13.0a6 and newer. 3.13.0a6 adds a new
    __static_attributes__ attribute to all classes in Python,
    which broke some assumptions made by the implementation of
    typing_extensions.Protocol. Similarly, 3.13.0b1 adds the new
    __firstlineno__ attribute to all classes.
  • Fix AttributeError when using typing_extensions.runtime_checkable
    in combination with typing.Protocol on Python 3.12.2 or newer.
    Patch by Alex Waygood.
  • At runtime, assert_never now includes the repr of the argument
    in the AssertionError. Patch by Hashem, backporting of the original
    fix python/cpython#91720 by Jelle Zijlstra.
  • The second and third parameters of typing_extensions.Generator,
    and the second parameter of typing_extensions.AsyncGenerator,
    now default to None. This matches the behaviour of typing.Generator
    and typing.AsyncGenerator on Python 3.13+.
  • typing_extensions.ContextManager and
    typing_extensions.AsyncContextManager now have an optional second
    parameter, which defaults to Optional[bool]. The new parameter
    signifies the return type of the __(a)exit__ method, matching
    typing.ContextManager and typing.AsyncContextManager on Python
    3.13+.
  • Backport types.CapsuleType from Python 3.13.

4.11.0

05 Apr 12:36
d4d929d
Compare
Choose a tag to compare

Release 4.11.0 (April 5, 2024)

This feature release provides improvements to various recently
added features, most importantly type parameter defaults (PEP 696).

There are no changes since 4.11.0rc1.

Changes since 4.10.0:

  • Fix tests on Python 3.13.0a5. Patch by Jelle Zijlstra.
  • Fix the runtime behavior of type parameters with defaults (PEP 696).
    Patch by Nadir Chowdhury.
  • Fix minor discrepancy between error messages produced by typing
    and typing_extensions on Python 3.10. Patch by Jelle Zijlstra.
  • When include_extra=False, get_type_hints() now strips ReadOnly from the annotation.

4.11.0rc1

24 Mar 14:05
94bec44
Compare
Choose a tag to compare
  • Fix tests on Python 3.13.0a5. Patch by Jelle Zijlstra.
  • Fix the runtime behavior of type parameters with defaults (PEP 696).
    Patch by Nadir Chowdhury.
  • Fix minor discrepancy between error messages produced by typing
    and typing_extensions on Python 3.10. Patch by Jelle Zijlstra.
  • When include_extra=False, get_type_hints() now strips ReadOnly from the annotation.

4.10.0

26 Feb 14:39
ed81f2b
Compare
Choose a tag to compare

Release 4.10.0 (February 25, 2024)

This feature release adds support for PEP 728 (TypedDict with extra
items) and PEP 742 (TypeIs).

There are no changes since 4.10.0rc1.

4.10.0rc1

18 Feb 02:59
06b23e3
Compare
Choose a tag to compare

Release 4.10.0rc1 (February 17, 2024)

  • Add support for PEP 728, supporting the closed keyword argument and the
    special __extra_items__ key for TypedDict. Patch by Zixuan James Li.
  • Add support for PEP 742, adding typing_extensions.TypeIs. Patch
    by Jelle Zijlstra.
  • Drop runtime error when a read-only TypedDict item overrides a mutable
    one. Type checkers should still flag this as an error. Patch by Jelle
    Zijlstra.
  • Speedup issubclass() checks against simple runtime-checkable protocols by
    around 6% (backporting python/cpython#112717, by Alex
    Waygood).
  • Fix a regression in the implementation of protocols where typing.Protocol
    classes that were not marked as @runtime_checkable would be unnecessarily
    introspected, potentially causing exceptions to be raised if the protocol had
    problematic members. Patch by Alex Waygood, backporting
    python/cpython#113401.

4.9.0

10 Dec 01:16
fc461d6
Compare
Choose a tag to compare

This feature release adds typing_extensions.ReadOnly, as specified
by PEP 705, and makes various other improvements, especially to
@typing_extensions.deprecated().

There are no changes since 4.9.0rc1.

4.9.0rc1

29 Nov 18:16
f82d636
Compare
Choose a tag to compare
4.9.0rc1 Pre-release
Pre-release
  • 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 of typing_extensions.NewType.__call__ now exactly matches the
    signature of typing.NewType.__call__. Patch by Alex Waygood.
  • Fix bug with using @deprecated on a mixin class. Inheriting from a
    deprecated class now raises a DeprecationWarning. Patch by Jelle Zijlstra.
  • @deprecated now gives a better error message if you pass a non-str
    argument to the msg parameter. Patch by Alex Waygood.
  • @deprecated is now implemented as a class for better introspectability.
    Patch by Jelle Zijlstra.
  • Exclude __match_args__ from Protocol members.
    Backport of python/cpython#110683 by Nikita Sobolev.
  • When creating a typing_extensions.NamedTuple class, ensure __set_name__
    is called on all objects that define __set_name__ and exist in the values
    of the NamedTuple class's class dictionary. Patch by Alex Waygood,
    backporting python/cpython#111876.
  • Improve the error message when trying to call issubclass() against a
    Protocol that has non-method members. Patch by Alex Waygood (backporting
    python/cpython#112344, by Randolph Scholz).

4.8.0

18 Sep 04:03
c17c499
Compare
Choose a tag to compare

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 a TypeError on Python
    versions <3.11. Patch by James Hilton-Balfe

No changes since 4.8.0rc1.