I want numba to be an optional dependency, so that it's fast if installed or slow if not. So when numba is not installed, I want @njit
to be a dummy decorator that does nothing.
If I follow these directions and use:
def njit(func):
return func
Then when the decorator is called like @njit(cache=True, nogil=True)
I get errors about:
TypeError: njit() got an unexpected keyword argument 'cache'
If I try to catch the args and ignore them using
def njit(func, *args, **kwargs):
return func
then I get:
missing 1 required positional argument: 'func'
How do I just make a dummy decorator that does nothing and ignores kwargs?