strongtyping
Decorator which checks whether the function is called with the correct type of parameters
What it is and what it does
strongtyping is a runtime type-checking decorator for Python functions that validates arguments against their type annotations at call time. When a function is decorated with @match_typing, the decorator intercepts calls and checks that each argument matches its declared type; if not, it raises a TypeMismatch exception. This catches type errors that static type checkers like mypy might miss, particularly in dynamic code paths or when working with external data.
The package includes specialized support for async functions via @a_match_typing, which preserves the coroutine interface while performing the same validation. Since version 3.13.6, the core logic is compiled with mypyc for performance. The library targets Python 3.14 and above, uses ujson for serialization, and includes pytest and ruff in its development stack. It's maintained actively and documented on readthedocs.
Use it for:
- Validate API endpoint parameters at runtime before processing, catching type errors from client requests.
- Enforce type contracts in data processing pipelines where external or user-provided data enters functions.
- Debug type-related bugs in dynamic code by catching mismatches early rather than at point of failure.
- Protect async functions from type errors in concurrent workflows where static analysis may be incomplete.
- Supplement mypy or other static checkers in codebases where runtime type safety is critical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A runtime type-checking decorator that validates function arguments against their type annotations and raises TypeMismatch on mismatch, with dedicated async support and mypyc compilation for performance.
Yes, if you target Python 3.14+ and need runtime type validation as a safety layer. The active maintenance, zero known vulnerabilities, and mypyc performance boost make it solid for production use. The CC-BY-ND-4.0 license is permissive but requires attribution. Not suitable if you're on Python 3.13 or earlier.
Install
strongtyping on PyPI
pip
pip install strongtypinguv
uv add strongtypingpoetry
poetry add strongtypingInstalling strongtyping
Before you install
Medium install friction due to compiled wheels for specific Python versions. Active maintenance with recent release (17 days old) and steady repository activity. Requires Python 3.14 or above, which limits adoption to very recent Python versions.
License in practice
Licensed under CC-BY-ND-4.0, a permissive license that allows use and modification but requires attribution and prohibits derivative works. Suitable for most projects, though the non-derivative restriction may constrain some use cases.
Quickstart
pip install strongtyping
from strongtyping.strong_typing import match_typing
@match_typing
def add(left: int, right: int) -> int:
return left + right
result = add(1, 2) # 3
add(1, "2") # raises TypeMismatch
Requires Python 3.14 or above; older Python versions are not supported.
Verify before relying
- Whether mypyc compilation provides the claimed 5x performance boost in real-world usage patterns.
- How TypeMismatch exceptions integrate with existing error handling and logging frameworks.
- Whether the AI Agent Skills integration provides practical value beyond documentation.
Package facts
| License | CC-BY-ND-4.0 (permissive) |
| Python support | capped below the current Python release (>=3.14) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — ujson, librt, typing-extensions, pytest, ruff |
| Maintenance | actively maintained — 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 142,255/month — #11,220 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: strongtyping-3.14.5-cp314-cp314-macosx_10_15_x86_64.whl; strongtyping-3.14.5-cp314-cp314-macosx_11_0_arm64.whl; strongtyping-3.14.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; strongtyping-3.14.5-cp314-cp314-win_amd64.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
overridesProvides a @override decorator that validates…
permissive · top 1,000 on PyPI
mypyMypy is a static type checker for Python that…
permissive · top 1,000 on PyPI
func_argsProvides sentinel values (REQ and OPT) and…
permissive · top 5,000 on PyPI
mypy-extensionsProvides type system extensions for Python…
unclear · top 1,000 on PyPI
retry-decoratorProvides a decorator to automatically retry a…
permissive · top 15,000 on PyPI
typepyTypepy checks, validates, and converts Python…
permissive · top 5,000 on PyPI
makefunDynamically creates Python functions at runtime…
permissive · top 5,000 on PyPI
types-decoratorProvides type stubs for the `decorator`…
permissive · top 5,000 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
fastjsonschemaValidates JSON data against JSON Schema…
permissive · top 1,000 on PyPI