Install & Compatibility
Where this runs
tested against v1.2.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.024s · 18.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.020s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
validate
✓ from typing_validation import validate
is_valid
✓ from typing_validation import is_valid
InvalidTypeException
✓ from typing_validation import InvalidTypeException
Basic usage: validate() raises on mismatch, is_valid() returns bool, assertion trick for performance.
from typing_validation import validate
# Validate a simple type
x: int = 10
try:
validate(x, int)
print("Valid")
except InvalidTypeException as e:
print(f"Invalid: {e}")
# Use with assertions (compiled away with -O)
from typing_validation import is_valid
if is_valid(x, int):
print("x is int")
Errors
Common errors & fixes
AttributeError: module 'typing_validation' has no attribute 'valid'
Typo: 'valid' is not exported; correct function is 'validate'.
fixChange to 'from typing_validation import validate'
ImportError: cannot import name 'validate' from 'typing_validation'
Package not installed or installed incorrectly.
fixRun 'pip install typing-validation' and ensure the virtual environment is activated.
Upgrade
Version history
1.2.12latest on PyPI · released Mar 18, 2025
Audit
Dependencies
typing_extensionsoptionalRequired for backward compatibility with Python < 3.11 (e.g., Self, TypeVarTuple)
numpyoptionalOptional: required for validation against NDArray[dtype] annotations