✨ make autoui compatible with solara
Opened this issue · 5 comments
Is your feature request related to a problem? Please describe.
it would be great to use autoui in solara
Describe the solution you'd like
import solara as sl
from ipyautoui import AutoVjsf
from pydantic import BaseModel
class SolaraApp(BaseModel):
name: str
value: int
@sl.component
def page():
AutoVjsf.element(schema=SolaraApp.schema(), value=dict(name="foo", value=12))
should display the correct form.
Describe alternatives you've considered
I tried to use it in its current form and get the following error:
AttributeError: property 'schema' of 'AutoVjsf' object has no setter
Additional context
solara seams like a really great way to build UIs with ipywidgets.
agree this would be great...
not 100% about everything that is involved...
you could try using Vjsf
rather than AutoVjsf
i.e.
from ipyautoui.autovjsf import Vjsf
as this has a schema trait....?
the AutoVjsf
just adds stuff like the save button bar and show / hide raw etc., but Vjsf
is doing all the work in terms of making the form
I will give it a try. Is there something similar for the ipywidget based version as well?
currently in AutoObject
(AutoUi = autoui
is now just a builder function that returns AutoObject
typically) schema
is not a trait so the form would not update on change: #192.
I assume that this would be a min requirement of solara to work in the way you are hoping ...
solara also wraps ipywidget based syntax in react-like syntax they use in reacton https://reacton.solara.dev/en/latest/libraries/. I think for ipyautoui
to work natively in solara we'd need to find a way to do that.
I think that this relies on the objects using traits to instantiate and control the widget state... which broadly speaking ipyautoui
does... but I think we'd need to dig into reacton's requirements a little more to try and make them work together.
I created a branch/ PR #291 where I did an initial test in making an ipyautoui reacton wrapper...
it doesn't work... but some things do work...
I'd love to see this progressed, but realistically I'm not gonna be able to put much time towards at least for the foreseeable...
If you're interested / willing to have a look in more detail I'll try and help where I can.
Thanks for the work!
After working some more on our prototype, we found that working with the vue components is the better fit for solara. So probably it is not worth the effort to work in the ipywidgets version in the first place.
The vjsf component works just finde even with dynamic schema changes.
glad its working for you with Vjfs
I'm gonna re-open the issue as this is something I'd like to target in the future...