Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"bind" is ignored if annotated with not-registered type. #559

Closed
hanjinliu opened this issue May 11, 2023 · 1 comment · Fixed by #560
Closed

"bind" is ignored if annotated with not-registered type. #559

hanjinliu opened this issue May 11, 2023 · 1 comment · Fixed by #560
Labels
bug Something isn't working

Comments

@hanjinliu
Copy link
Contributor

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
@tlambert03
Copy link
Member

thanks for reporting @hanjinliu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants