agronholm / typeguard

Run-time type checker for Python
Other
1.52k stars 114 forks source link

.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml :alt: Build Status .. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github :target: https://coveralls.io/github/agronholm/typeguard?branch=master :alt: Code Coverage .. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest :target: https://typeguard.readthedocs.io/en/latest/?badge=latest :alt: Documentation

This library provides run-time type checking for functions defined with PEP 484 <https://www.python.org/dev/peps/pep-0484/>_ 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.

Two principal ways to do type checking are provided:

. The check_type function:

Two options are provided for code instrumentation:

. the @typechecked function:

See the documentation_ for further information.

.. _documentation: https://typeguard.readthedocs.io/en/latest/