-
Notifications
You must be signed in to change notification settings - Fork 49
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
Support pydantic types #98
Comments
Currently I am building my user interface using the direct widget API and noticed I should avoid repetition by keeping widget constraints (type, min/max) in a central place, my data model which is a Pydantic class and has all these constraints. As a Pydantic class (from which I can generate documentation) it also can hold widget texts (Pydantic It would be nice to generate a magicgui either from a pydantic class (like magic-class from basic dataclasses), or to have something similar to |
thanks @aeisenbarth ... I have a local branch where I started to implement this. will try to get back on it soon |
it's basically possible already with the logic underlying |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/using-magicgui-to-create-pydantic-class-instances/92520/1 |
Thanks @tlambert03, that's a very useful forum post! |
As @sofroniewn suggested, pydantic's constrained types make for a natural way to express things like ranges and widget parameters as type annotations. We should detect and support pydantic types
The text was updated successfully, but these errors were encountered: