Need help with typeguard?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

756 Stars 67 Forks Other 257 Commits 34 Opened issues


Run-time type checker for Python

Services available


Need anything else?

Contributors list

.. image:: :target: :alt: Build Status .. image:: :target: :alt: Code Coverage .. image:: :target:

This library provides run-time type checking for functions defined with

PEP 484 
_ argument (and return) type annotations.

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

. the

  • 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)

    . the

  • automatically type checks yields and sends of returned generators (regular and async)

  • adds an extra frame to the call stack for every call to a decorated function

    . the stack profiler hook (
    with TypeChecker('packagename'):
    ) (deprecated):

  • emits warnings instead of raising

  • requires very few modifications to the code

  • multiple TypeCheckers can be stacked/nested

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

  • may cause problems with badly behaving debuggers or profilers

  • cannot distinguish between an exception being raised and a

    being returned

    . the import hook (

  • automatically annotates classes and functions with

    on import
  • no code changes required in target modules

  • requires imports of modules you need to check to be deferred until after the import hook has been installed

  • may clash with other import hooks

See the documentation_ for further instructions.

.. _documentation:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.