Enforcer is a lightweight Python decorator for enforcing type hints at runtime. It ensures that function arguments match their specified types, providing a simple and intuitive solution for runtime type validation.
- Enforce type hints at runtime for functions.
- Lightweight and dependency-free.
- Compatible with Python 3.7 and later.
You can install Enforcer via pip : pip install static-type-enforcer==0.1.0
from enforcer import enforce_types
@enforce_types
def greet(name: str, age: int):
print(f"{name} is {age} years old!")
# Valid call
greet("Alice", 25)
# Invalid call
greet("Alice", "twenty-five") # Raises TypeError
Contributions are welcome! Please check the issues for tasks that need help.