typeguard 4.5.1


pip install typeguard

  Latest version

Released: Feb 19, 2026


Meta
Author: Alex Grönholm
Requires Python: >=3.9

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

Programming Language
  • Python
  • Python :: 3
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
Build Status Code Coverage Documentation Tidelift

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations, and any arbitrary objects. It can be used together with static type checkers as an additional layer of type safety, to catch type violations that could only be detected at run time.

Three principal ways to do type checking are provided, each with its pros and cons:

  1. The check_type function:

    • like isinstance(), but supports arbitrary type annotations (within limits)

    • can be used as a cast() replacement, but with actual checking of the value

  2. The check_argument_types() and check_return_type() functions:

    • debugger friendly (except when running with the pydev debugger with the C extension installed)

    • does not work reliably with dynamically defined type hints (e.g. in nested functions)

  3. Code instrumentation:

    • entire modules, or individual functions (via @typechecked) are recompiled, with type checking code injected into them

    • automatically checks function arguments, return values and assignments to annotated local variables

    • for generator functions (regular and async), checks yield and send values

    • requires the original source code of the instrumented module(s) to be accessible

Two options are provided for code instrumentation:

  1. the @typechecked function:

    • can be applied to functions individually

  2. the import hook (typeguard.install_import_hook()):

    • automatically instruments targeted modules on import

    • no manual code changes required in the target modules

    • requires the import hook to be installed before the targeted modules are imported

    • may clash with other import hooks

See the documentation for further information.

4.5.1 Feb 19, 2026
4.5.0 Feb 15, 2026
4.4.4 Jun 18, 2025
4.4.3 Jun 04, 2025
4.4.2 Feb 16, 2025
4.4.1 Nov 03, 2024
4.4.0 Oct 27, 2024
4.3.0 May 27, 2024
4.2.1 Mar 24, 2024
4.2.0 Mar 23, 2024
4.1.5 Sep 11, 2023
4.1.4 Sep 10, 2023
4.1.3 Aug 26, 2023
4.1.2 Aug 17, 2023
4.1.1 Aug 15, 2023
4.1.0 Jul 29, 2023
4.0.1 Jul 27, 2023
4.0.0 May 12, 2023
4.0.0rc6 May 07, 2023
4.0.0rc5 May 01, 2023
4.0.0rc4 Apr 15, 2023
4.0.0rc3 Apr 10, 2023
4.0.0rc2 Apr 08, 2023
4.0.0rc1 Apr 01, 2023
3.0.2 Mar 22, 2023
3.0.1 Mar 15, 2023
3.0.0 Mar 14, 2023
3.0.0rc2 Mar 01, 2023
3.0.0rc1 Feb 26, 2023
3.0.0b2 Jan 11, 2023
3.0.0b1 Jan 09, 2023
2.13.3 Dec 10, 2021
2.13.2 Nov 22, 2021
2.13.1 Nov 22, 2021
2.13.0 Oct 10, 2021
2.12.1 Jun 04, 2021
2.12.0 Apr 01, 2021
2.11.1 Feb 16, 2021
2.11.0 Feb 16, 2021
2.10.0 Oct 19, 2020
2.9.1 Jun 07, 2020
2.9.0 Jun 06, 2020
2.8.0 Jun 02, 2020
2.7.1 Dec 27, 2019
2.7.0 Dec 10, 2019
2.6.1 Nov 17, 2019
2.6.0 Nov 06, 2019
2.5.1 Sep 26, 2019
2.5.0 Aug 26, 2019
2.4.1 Jul 15, 2019
2.4.0 Jul 14, 2019
2.3.1 Apr 12, 2019
2.3.0 Mar 27, 2019
2.2.2 Aug 13, 2018
2.2.1 Aug 12, 2018
2.2.0 Jul 08, 2018
2.1.4 Jan 07, 2018
2.1.3 Mar 13, 2017
2.1.2 Mar 12, 2017
2.1.1 Dec 20, 2016
2.1.0 Dec 17, 2016
2.0.2 Dec 17, 2016
2.0.1 Dec 10, 2016
2.0.0 Dec 10, 2016
1.2.3 Sep 14, 2016
1.2.2 Aug 23, 2016
1.2.1 Jun 28, 2016
1.2.0 May 21, 2016
1.1.3 May 09, 2016
1.1.2 May 08, 2016
1.1.1 Jan 03, 2016
1.1.0 Jan 02, 2016
1.0.2 Jan 01, 2016
1.0.1 Jan 01, 2016
1.0.0 Dec 29, 2015

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
importlib_metadata (>=3.6)
typing_extensions (>=4.14.0)