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

✨ make autoui compatible with solara #289

Open
tharwan opened this issue Feb 21, 2024 · 5 comments · May be fixed by #291
Open

✨ make autoui compatible with solara #289

tharwan opened this issue Feb 21, 2024 · 5 comments · May be fixed by #291
Labels
enhancement New feature or request

Comments

@tharwan
Copy link

tharwan commented Feb 21, 2024

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.

@tharwan tharwan added the enhancement New feature or request label Feb 21, 2024
@jgunstone
Copy link
Collaborator

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

@tharwan
Copy link
Author

tharwan commented Feb 21, 2024

I will give it a try. Is there something similar for the ipywidget based version as well?

@jgunstone
Copy link
Collaborator

jgunstone commented Feb 22, 2024

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.

@tharwan
Copy link
Author

tharwan commented Feb 22, 2024

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.

@tharwan tharwan closed this as completed Feb 22, 2024
@jgunstone
Copy link
Collaborator

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...

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 a pull request may close this issue.

2 participants