NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #414 most downloaded on PyPI
Run-time type checker for Python
Last release 2 months ago
26 Jul 2026
Release timing varies
gaps range from 2 weeks to 8 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
77 releases · first in 2015
Added support for type checking against the PEP 661 sentinel type (built-in on Python 3.15 and available on typing_extensions for earlier Pythons)
sentinel type (built-in on Python 3.15 and available on typing_extensions for earlier Pythons)typeguard-packages-ignore option (--typeguard-packages-ignore on the command line) to the pytest plugin to exclude specific packages from type checking (#523)typing and typing_extensions in the import hook/instrumenter (#489; PR by @ShipItAndPray)x: int, then if (x := ...)) being instrumented as an unpacking target, which raised TypeError for a non-iterable value and silently replaced an iterable value with list(value) (#557)type[SomeProtocol] where the protocol declares non-ClassVar (instance) attributes; only ClassVar members are now required on the class itself (#499)Literal checks depending on the order of the arguments, where a bool would not match if an == equal int came first (Literal[1, True] rejected True, but Literal[True, 1] accepted it) (#566; PR by @uttam12331)tuple[()]) down to a bare tuple, causing any tuple (including non-empty ones) to pass the check (#565; PR by @chuenchen309)One column per quarter.
Fixed IndexError raised from check_signature_compatible when the subject method has no positional parameters ( #550 ; PR by @HackedRico )
IndexError raised from check_signature_compatible when the subject method has no positional parameters (#550; PR by @HackedRico)Fixed iterable unpacking incorrectly calculating the cut-off offset of the item list when assigning remaining values to the star variable
Restored the check_argument_types() and check_return_type() functions that were dropped in v3.0.0, for users who want more fine-grained control over r
check_argument_types() and check_return_type() functions that were dropped in v3.0.0, for users who want more fine-grained control over run-time type checking (#437)extra_items in TypedDict, allowing users to specify the types for the values of "leftover" keys in a typed dict (keys that weren't explicitly defined in the TypedDict subclass) (#538)NameError when evaluating forward references on Python 3.14 (#536; PR by @dionhaefner)TypeCheckError when checking TypedDict with Required[...] annotations (#533; PR by @dionhaefner)type Foo = list[int]) not being resolved during type checking (#526)x, = ("foo",)) falsely raising TypeCheckedError (#535)Fixed IndexError when using @typechecked on more than one function with the same name under certain circumstances
Fixed @typechecked unable to find the target function or method if it or the containing class had PEP 695 type parameters on them
Fixed TypeCheckError in unpacking assignment involving properties of a parameter of the function ( #506 ; regression introduced in v4.4.1)
TypeCheckError in unpacking assignment involving properties of a parameter of the function (#506; regression introduced in v4.4.1)TypeError when using an assignment expression (#510; PR by @JohannesK71083)ValueError: no signature found for builtin when checking against a protocol and a matching attribute in the subject is a built-in function (#504)Changed the signature of typeguard_ignore() to be compatible with typing.no_type_check() (PR by @jolaf )
typeguard_ignore() to be compatible with typing.no_type_check() (PR by @jolaf)TypeError when checking a class against type[Self] (#481)type[SomeProtocol]) (#498)Self checks in instance/class methods that have positional-only argumentstypes.UnionType (#467)NotRequired not being run unless the NotRequired is a forward reference (#454)Added proper checking for method signatures in protocol checks
Added support for checking against static protocols
Fixed deprecation warning in the test suite on Python 3.13 (\#444)
Added support for specifying options for the pytest plugin via pytest config files (\#440)
Optional[...] being removed from the AST if it was located within a subscript (#442)TypedDict from typing_extensions not being recognized as one (#443)typing types (dict[str, int], List[str], etc.) not passing checks against type or Type (#432, PR by Yongxin Wang)NotRequired[...]) in TypedDict when using forward references (#424)MultiValueDict (#419)Fixed Callable erroneously rejecting a callable that has the requested amount of positional arguments but they have defaults (\#400)
Fixed AttributeError where the transformer removed elements from a PEP 604 union (\#384)
AttributeError where the transformer removed elements from a PEP 604 union (#384)AttributeError: 'Subscript' object has no attribute 'slice' when encountering an annotation with a subscript containing an ignored type (imported within an if TYPE_CHECKING: block) (#397)typing.Union) where one of the elements is an ignored type (shadowed by an argument, variable assignment or an if TYPE_CHECKING import) (#394, #395)__new__() in cases such as enums where this method is already invoked before the class has finished initializing (#398)- Fixed @typechecked optimization causing compilation of instrumented code to fail when any block was left empty by the AST transformer (eg if or try
Dropped Python 3.7 support
Fixed @typechecked optimization causing compilation of instrumented code to fail when any block was left empty by the AST transformer (eg if or try / except blocks) ( #352 )
Fixed placement of injected typeguard imports with respect to future imports and module docstrings ( #385 )
- Fixed Any being removed from a subscript that still contains other elements
Fixed Any being removed from a subscript that still contains other elements ( #373 )
- Fixed suppress_type_checks() causing annotated variable assignments to always assign None
Fixed suppress_type_checks() causing annotated variable assignments to always assign None ( #380 )
- Added support for passing a tuple as expected_type to check_type() , making it more of a drop-in replacement for isinstance()
Added support for passing a tuple as expected_type to check_type() , making it more of a drop-in replacement for isinstance() ( #371 )
Fixed regression where Literal inside a Union had quotes stripped from its contents, thus typically causing NameError to be raised when run ( #372 )
- Fixed handling of typing_extensions.Literal on Python 3.8 and 3.9 when typing_extensions>=4.6.0 is installed ( #363 ; PR by Alex Waygood)
Fixed handling of typing_extensions.Literal on Python 3.8 and 3.9 when typing_extensions>=4.6.0 is installed ( #363 ; PR by Alex Waygood)
Fixed NameError when generated type checking code references an imported name from a method ( #362 )
Fixed docstrings disappearing from instrumented functions ( #359 )
Fixed @typechecked failing to instrument functions when there are more than one function within the same scope ( #355 )
Fixed frozenset not being checked ( #367 )
- No changes
No changes
- Fixed @typechecked optimization causing compilation of instrumented code to fail when an if block was left empty by the AST transformer
Fixed @typechecked optimization causing compilation of instrumented code to fail when an if block was left empty by the AST transformer ( #352 )
Fixed the AST transformer trying to parse the second argument of typing.Annotated as a forward reference ( #353 )
- Added InstrumentationWarning to the public API
Added InstrumentationWarning to the public API
Changed @typechecked to skip instrumentation in optimized mode, as in typeguard
- Fixed imports guarded by if TYPE_CHECKING: when used with subscripts ( SomeType[...] ) being replaced with Any[...] instead of just Any
Fixed imports guarded by if TYPE_CHECKING: when used with subscripts ( SomeType[...] ) being replaced with Any[...] instead of just Any
Fixed instrumentation inadvertently mutating a function’s annotations on Python 3.7
- Fixed typing.Literal subscript contents being evaluated as forward references
Fixed typing.Literal subscript contents being evaluated as forward references
Fixed resolution of forward references in type aliases
- The .pyc files now use a version-based optimization suffix in the file names so as not to cause the interpreter to load potentially faulty/incompati
The .pyc files now use a version-based optimization suffix in the file names so as not to cause the interpreter to load potentially faulty/incompatible cached bytecode generated by older versions
Fixed typed variable positional and keyword arguments causing compilation errors on Python 3.7 and 3.8
Fixed compilation error when a type annotation contains a type guarded by if TYPE_CHECKING:
- BACKWARD INCOMPATIBLE check_type() no longer uses the global configuration. It now uses the default configuration values, unless overridden with an…
BACKWARD INCOMPATIBLE check_type() no longer uses the global configuration. It now uses the default configuration values, unless overridden with an explicit config argument.
BACKWARD INCOMPATIBLE Removed CallMemo from the API
BACKWARD INCOMPATIBLE Required checkers to use the configuration from memo.config , rather than the global configuration
Added keyword arguments to @typechecked , allowing users to override settings on a per-function basis
Added support for using suppress_type_checks() as a decorator
Added support for type checking against nonlocal classes defined within the same parent function as the instrumented function
Changed instrumentation to statically copy the function annotations to avoid having to look up the function object at run time
Improved support for avoiding type checks against imports declared in if TYPE_CHECKING: blocks
Fixed check_type not returning the passed value when checking against Any , or when type checking is being suppressed
Fixed suppress_type_checks() not ending the suppression if the context block raises an exception
Fixed checking non-dictionary objects against a TypedDict annotation (PR by Tolker-KU)
- Improved warnings by ensuring that they target user code and not Typeguard internal code
Improved warnings by ensuring that they target user code and not Typeguard internal code
Fixed warn_on_error() not showing where the type violation actually occurred
Fixed local assignment to *args or **kwargs being type checked incorrectly
Fixed TypeError on check_type(..., None)
Fixed unpacking assignment not working with a starred variable ( x, *y = ... ) in the target tuple
Fixed variable multi-assignment ( a = b = c = ... ) being type checked incorrectly
- Fixed assignment unpacking ( a, b = ... ) being checked incorrectly
Improved the documentation
Fixed assignment unpacking ( a, b = ... ) being checked incorrectly
Fixed @typechecked attempting to instrument wrapper decorators such as @contextmanager when applied to a class
Fixed py.typed missing from the wheel when not building from a git checkout
- BACKWARD INCOMPATIBLE Dropped the argname , memo , globals and locals arguments from check_type()
BACKWARD INCOMPATIBLE Dropped the argname , memo , globals and locals arguments from check_type()
BACKWARD INCOMPATIBLE Removed the check_argument_types() and check_return_type() functions (use @typechecked instead)
BACKWARD INCOMPATIBLE Moved install_import_hook to be directly importable from the typeguard module
BACKWARD INCOMPATIBLE Changed the checking of collections (list, set, dict, sequence, mapping) to only check the first item by default. To get the old behavior, set typeguard.config.collection_check_strategy to CollectionCheckStrategy.ALL_ITEMS
BACKWARD INCOMPATIBLE Type checking failures now raise typeguard.TypeCheckError instead of TypeError
Dropped Python 3.5 and 3.6 support
Dropped the deprecated profiler hook ( TypeChecker )
Added a configuration system
Added support for custom type checking functions
Added support for PEP 604 union types ( X | Y ) on all Python versions
Added support for generic built-in collection types ( list[int] et al) on all Python versions
Added support for checking arbitrary Mapping types
Added support for the Self type
Added support for typing.Never (and typing_extensions.Never )
Added support for Never and NoReturn in argument annotations
Added support for LiteralString
Added support for TypeGuard
Added support for the subclassable Any on Python 3.11 and typing_extensions
Added the possibility to have the import hook instrument all packages
Added the suppress_type_checks() context manager function for temporarily disabling type checks
Much improved error messages showing where the type check failed
Made it possible to apply @typechecked on top of @classmethod / @staticmethod (PR by jacobpbrugh)
Changed check_type() to return the passed value, so it can be used (to an extent) in place of typing.cast() , but with run-time type checking
Replaced custom implementation of is_typeddict() with the implementation from typing_extensions v4.1.0
Emit InstrumentationWarning instead of raising RuntimeError from the pytest plugin if modules in the target package have already been imported
Fixed TypeError when checking against TypedDict when the value has mixed types among the extra keys (PR by biolds)
Fixed incompatibility with typing_extensions v4.1+ on Python 3.10 (PR by David C.)
Fixed checking of Tuple[()] on Python 3.11 and tuple[()] on Python 3.9+
Fixed integers 0 and 1 passing for Literal[False] and Literal[True] , respectively
Fixed type checking of annotated variable positional and keyword arguments ( *args and **kwargs )
Fixed checks against unittest.Mock and derivatives being done in the wrong place
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
- Fixed TypeError when using typeguard within exec() (where __module__ is None ) (PR by Andy Jones)
Fixed TypeError when using typeguard within exec() (where module is None ) (PR by Andy Jones)
Fixed TypedDict causing TypeError: TypedDict does not support instance and class checks on Python 3.8 with standard library (not typing_extensions ) typed dicts
- Fixed typing_extensions being imported unconditionally on Python < 3.9 (bug introduced in 2.13.1)
Fixed typing_extensions being imported unconditionally on Python < 3.9 (bug introduced in 2.13.1)
- Fixed @typechecked replacing abstract properties with regular properties
Fixed @typechecked replacing abstract properties with regular properties
Fixed any generic type subclassing Dict being mistakenly checked as TypedDict on
- Added support for returning NotImplemented from binary magic methods ( __eq__() et al)
Added support for returning NotImplemented from binary magic methods ( eq() et al)
Added support for checking union types (e.g. Type[Union[X, Y]] )
Fixed error message when a check against a Literal fails in a union on Python 3.10
Fixed NewType not being checked on Python 3.10
Fixed unwarranted warning when @typechecked is applied to a class that contains unannotated properties
Fixed TypeError in the async generator wrapper due to changes in aiter() protocol
Fixed broken TypeVar checks – variance is now (correctly) disregarded, and only bound types and constraints are checked against (but type variable resolution is not done)
- Fixed AttributeError when __code__ is missing from the checked callable (PR by epenet)
Fixed AttributeError when code is missing from the checked callable (PR by epenet)
- Added @typeguard_ignore decorator to exclude specific functions and classes from runtime type checking (PR by Claudio Jolowicz)
Added @typeguard_ignore decorator to exclude specific functions and classes from runtime type checking (PR by Claudio Jolowicz)
- Fixed compatibility with Python 3.10
Fixed compatibility with Python 3.10
- Added support for type checking class properties (PR by Ethan Pronovost)
Added support for type checking class properties (PR by Ethan Pronovost)
Fixed static type checking of @typechecked decorators (PR by Kenny Stauffer)
Fixed wrong error message when type check against a bytes declaration fails
Allowed memoryview objects to pass as bytes (like MyPy does)
Shortened tracebacks (PR by prescod)
- Added support for Python 3.9 (PR by Csergő Bálint)
Added support for Python 3.9 (PR by Csergő Bálint)
Added support for nested Literal
Added support for TypedDict inheritance (with some caveats; see the user guide on that for details)
An appropriate TypeError is now raised when encountering an illegal Literal value
Fixed checking NoReturn on Python < 3.8 when typing_extensions was not installed
Fixed import hook matching unwanted modules (PR by Wouter Bolsterlee)
Install the pytest plugin earlier in the test run to support more use cases (PR by Wouter Bolsterlee)
- Fixed ImportError on Python < 3.8 when typing_extensions was not installed
Fixed ImportError on Python < 3.8 when typing_extensions was not installed
- Upped the minimum Python version from 3.5.2 to 3.5.3
Upped the minimum Python version from 3.5.2 to 3.5.3
Added support for typing.NoReturn
Added full support for typing_extensions (now equivalent to support of the typing module)
Added the option of supplying check_type() with globals/locals for correct resolution of forward references
Fixed erroneous TypeError when trying to check against non-runtime typing.Protocol (skips the check for now until a proper compatibility check has been implemented)
Fixed forward references in TypedDict not being resolved
Fixed checking against recursive types
- Added support for the Mock and MagicMock types (PR by prescod)
Added support for the Mock and MagicMock types (PR by prescod)
Added support for typing_extensions.Literal (PR by Ryan Rowe)
Fixed unintended wrapping of untyped generators (PR by prescod)
Fixed checking against bound type variables with check_type() without a call memo
Fixed error message when checking against a Union containing a Literal
- Fixed @typechecked returning None when called with always=True and Python runs in optimized mode
Fixed @typechecked returning None when called with always=True and Python runs in optimized mode
Fixed performance regression introduced in v2.7.0 (the getattr_static() call was causing a 3x slowdown)
- Added support for typing.Protocol subclasses
Added support for typing.Protocol subclasses
Added support for typing.AbstractSet
Fixed the handling of total=False in TypedDict
Fixed no error reported on unknown keys with TypedDict
Removed support of default values in TypedDict , as they are not supported in the spec
- Fixed import errors when using the import hook and trying to import a module that has both a module docstring and __future__ imports in it
Fixed import errors when using the import hook and trying to import a module that has both a module docstring and future imports in it
Fixed AttributeError when using @typechecked on a metaclass
Fixed @typechecked compatibility with built-in function wrappers
Fixed type checking generator wrappers not being recognized as generators
Fixed resolution of forward references in certain cases (inner classes, function-local classes)
Fixed AttributeError when a class has contains a variable that is an instance of a class that has a call() method
Fixed class methods and static methods being wrapped incorrectly when @typechecked is applied to the class
Fixed AttributeError when @typechecked is applied to a function that has been decorated with a decorator that does not properly wrap the original (PR by Joel Beach)
Fixed collections with mixed value (or key) types raising TypeError on Python 3.7+ when matched against unparametrized annotations from the typing module
Fixed inadvertent TypeError when checking against a type variable that has constraints or a bound type expressed as a forward reference
- Deprecated TypeChecker (will be removed in v3.0)
Added a PEP 302 import hook for annotating functions and classes with @typechecked
Added a pytest plugin that activates the import hook
Added support for typing.TypedDict
Deprecated TypeChecker (will be removed in v3.0)
- Fixed incompatibility between annotated Iterable , Iterator , AsyncIterable or AsyncIterator return types and generator/async generator functions
Fixed incompatibility between annotated Iterable , Iterator , AsyncIterable or AsyncIterator return types and generator/async generator functions
Fixed TypeError being wrapped inside another TypeError (PR by russok)
- Added yield type checking via TypeChecker for regular generators
Added yield type checking via TypeChecker for regular generators
Added yield, send and return type checking via @typechecked for regular and async generators
Silenced TypeChecker warnings about async generators
Fixed bogus TypeError on Type[Any]
Fixed bogus TypeChecker warnings when an exception is raised from a type checked function
Accept a bytearray where bytes are expected, as per python/typing#552
Added policies for dealing with unmatched forward references
Added support for using @typechecked as a class decorator
Added check_return_type() to accompany check_argument_types()
Added Sphinx documentation
- Fixed broken packaging configuration
Fixed broken packaging configuration
- Added support for empty tuples ( Tuple[()] )
Added PEP 561 support
Added support for empty tuples ( Tuple[()] )
Added support for typing.Literal
Make getting the caller frame faster (PR by Nick Sweeting)
- Fixed thread safety issue with the type hints cache (PR by Kelsey Francis)
Fixed thread safety issue with the type hints cache (PR by Kelsey Francis)
- Added support for typing.IO and derivatives
Added support for typing.IO and derivatives
Fixed return type checking for coroutine functions
Dropped support for Python 3.4
- Fixed false positive when checking a callable against the plain typing.Callable on Python 3.7
Fixed false positive when checking a callable against the plain typing.Callable on Python 3.7
- Argument type annotations are no longer unioned with the types of their default values, except in the case of None as the default value (although PE
Argument type annotations are no longer unioned with the types of their default values, except in the case of None as the default value (although PEP 484 still recommends against this)
Fixed some generic types ( typing.Collection among others) producing false negatives on
- Fixed compatibility with Python 3.7
Fixed compatibility with Python 3.7
Removed support for Python 3.3
Added support for typing.NewType (contributed by reinhrst)
- Removed support for backports.typing, as it has been removed from PyPI
Removed support for backports.typing, as it has been removed from PyPI
Fixed checking of the numeric tower (complex -> float -> int) according to PEP 484
- Fixed type checks against generic classes
Fixed type checks against generic classes
Your coding agent can read these notes before it upgrades. Set up the MCP server →