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:
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
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)
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:
the @typechecked function:
can be applied to functions individually
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.
Release files for typeguard 4.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| typeguard-4.6.0.tar.gz | 82.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typeguard-4.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.2 kB
Release files / typeguard-4.6.0.tar.gz
| Download URL | typeguard-4.6.0.tar.gz |
|---|---|
| Size | 82.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7414f09111317de3e335de92cd397c5c0ca00b1cc1676de12e1d444a79b3f21
|
|
BLAKE2b-256 checksum How to use checksums |
b4de4420db493fa8fc0856d5e5c1b159c63a323d2de2317babe36b01568928e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency logRelease files / typeguard-4.6.0-py3-none-any.whl
| Download URL | typeguard-4.6.0-py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79878165bb86f2cf5d41d159a0ff1792a796cf496882d2fe1b1c6c7049b9cdd7
|
|
BLAKE2b-256 checksum How to use checksums |
8feb461d5f167b6f5c7d97696f397c82f82e3480e003fce3f0a1cd1dd26e2eb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 26, 2026.
Transparency log