python-args, inspired by attrs, removes the boilerplate of processing arguments to functions and methods.
Decorating your functions with python-args decorators like
can make your code more composable, more readable, and easier to test. Along
with this, functions decorated with python-args can be used to by other tools
and frameworks to build more expressive interfaces. The
libraries are two examples.
python-args decorators are as follows:
@arg.validators(*validation_funcs): Runs validation functions that can take the same named arguments as the decorated function. When decorating a function with
arg.validators, you not only de-couple your function from argument validation logic, but
python-argswill allow other interfaces to only run the validators of your function.
@arg.defaults(**arg_default_funcs): Sets arguments to default values. The default functions can similarly take the same named parameters of the decorated function.
@arg.parametrize(**parametrize_funcs): Runs a function multiple times for a particular input.
@arg.contexts(*context_funcs): Enters context managers before a function. Context managers can take the same named parameters as the decorated function.