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

Enable option to raise exception if magicgui cannot determine widget for provided value/annotation #476

Merged
merged 3 commits into from
Oct 24, 2022

Conversation

Czaki
Copy link
Contributor

@Czaki Czaki commented Oct 23, 2022

This PR adds the option to raise exceptions if magicgui cannot determine a widget or a given type.

By default, the exception is not raised if using magicgui decorator but is raised if create_widget is called directly. Is it OK for you @tlambert03

closes #473

@codecov
Copy link

codecov bot commented Oct 23, 2022

Codecov Report

Merging #476 (e6352a3) into main (9e29739) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #476      +/-   ##
==========================================
+ Coverage   88.08%   88.09%   +0.01%     
==========================================
  Files          31       31              
  Lines        4189     4193       +4     
==========================================
+ Hits         3690     3694       +4     
  Misses        499      499              
Impacted Files Coverage Δ
magicgui/_magicgui.py 96.29% <ø> (ø)
magicgui/signature.py 96.66% <100.00%> (+0.03%) ⬆️
magicgui/type_map.py 95.72% <100.00%> (+0.04%) ⬆️
magicgui/widgets/_bases/create_widget.py 97.36% <100.00%> (+0.07%) ⬆️
magicgui/widgets/_function_gui.py 94.04% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tlambert03
Copy link
Member

yeah, I think this looks good to me. It's a shame this has to go all the way through signature.py and everything... but I took a look and I agree it seems to be the way to do it. (would probably be a bit easier with the pattern proposed in #474 ... but we can just make sure to respect the same intention as whatever you implement here when that is implemented)

let me know when this is ready for final review (could be now?)

@Czaki
Copy link
Contributor Author

Czaki commented Oct 23, 2022

let me know when this is ready for final review (could be now?)

there is no test (i will add) but you could review everything else.

@Czaki
Copy link
Contributor Author

Czaki commented Oct 23, 2022

ready

Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@tlambert03 tlambert03 merged commit 12d788b into pyapp-kit:main Oct 24, 2022
@tlambert03 tlambert03 added the enhancement New feature or request label Oct 26, 2022
@tlambert03 tlambert03 changed the title Enable option to raise excpetion if magicgui cannot determine widget for provided value/annotation Enable option to raise exception if magicgui cannot determine widget for provided value/annotation Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verbose fail on lack of matching widget for provided type
2 participants