A simple runtime type checker for Python functions.
It validates function arguments and return values using type annotations.
- Runtime type checking for function arguments
- Return type validation
- Supports modern Python typing:
list[T]dict[K, V]tupleset,frozensetUnion(|)Literal
pip install strongpyor (using uv)
uv add strongpy>>> from strongpy import strong
>>> @strong
... def add(x: int, y: int) -> int:
... return x + y
>>> add(1, 2)
3
>>> add("1", 2)
Traceback (most recent call last):
File "example.py", line 10, in <module>
add("1", 2)
TypeError: argument 'x' expected int, got strint,str,float,boollist[T]dict[K, V]tuple[T, ...]set[T]frozenset[T]Union(int | str)LiteralAnyNeverNoReturn
Strong is designed to be:
- simple
- explicit
- predictable
No magic, no runtime inference — only annotations.
- Python ≥ 3.13
MIT