checksignature
a function decorator for enforcing function signatures
Setup
Ensure nox is installed.
pip install nox
Run nox to build, install, and run checksignature tests.
Usage
Decorate any funciton with @checksignature.
@checksignature
def function(a: str, b: int, c, **kwargs):
return a, b, c, kwargs
Upon invocation of function, the signature check is evaluated.
function('one', 2, 3.0, **{'four': 4}) #=> functions as usual--no problem.
function(1, 2, 3.0, **{'four': 4}) #=> raises a TypeError