"bind" is ignored if annotated with not-registered type.
hanjinliu opened this issue · comments
Describe the bug
If an argument is intended to be provided by the "bind" option but at the same time annotated with a type that is not registered in the type map, magicgui fails to get values from the argument.
To Reproduce
This works.
def _provide_array(*_):
return np.arange(10)
@magicgui(arr={"bind": _provide_array})
def f(arr):
print(arr.mean())
f()
But this does not.
def _provide_array(*_):
return np.arange(10)
@magicgui(arr={"bind": _provide_array})
def f(arr: np.ndarray): # <--- annotation
print(arr.mean())
f()
Expected behavior
It should work even with not-registered annotation.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: Windows
- backend: PyQt5 5.15.9
- magicgui version 0.7.2
thanks for reporting @hanjinliu