Closed Corvince closed 6 months ago
Hi,
Can I start by asking why you want to run solara in Jupyter lite (genuine curiosity!). Do you want to run a solara app for people to use for instance, or do you want other to use solara in a notebook? Or only for yourself maybe?
Yes, ideally we make the split between solara-ui and solara-server, especially because of the dependencies. How do you currently solve it with the dependencies?
If you can open a PR for 1 and 2+3 separately that would be great!
Regards,
Maarten
Hi, thanks for the reply.
My main use case is creating a template to make it super easy for people to share models created with Mesa. So similar to how the JupyterLite Repo itself is a GitHub template, I want to do the same for a basic mesa ABM and a visualization frontend with Solara hosted statically on GitHub Pages. Technically, Jupyter Lite would not be required, but I figured it would be the easiest way for now.
1) Oh, I didn't know it is possible to use hot-reload while working in jupyter, thats cool. 2) + 3) Ah, I see. I will see what I can do about a PR for that!
We are working on a pyodide based solution internally actually, do you mind emailing me at maartenbreddels@widgetti.io so I can show you some (currently) private work?
@Corvince @maartenbreddels I'm also interested in this issue and would be happy to help / test if needed
@albop if you are intersted in the above, please send me an email.
Also, I am working in https://github.com/widgetti/solara/pull/585 to split off solara-ui and solara-server This will enable a much lighter weight installation for the Jupyter notebook.
Note that solara 1.31 has done the split into solara-ui and solara-server, see https://solara.dev/documentation/getting_started/installing
solara-ui should work in jupyter lite without problems.
Every few months I come back to solara and test if it is installable on JupyterLite, but the process always becomes very hacky still.
Now I decided to take a closer look at the culprits. I think it is somewhat obvious that solara.server is the main problem, so I took the look on the current state on how deeply integrated it is. So my approach was to first delete the solara.server folder and then proceed to test what needs to change to make it work in Jupyter (normal one, not lite). Here are my findings in the order they appeared:
And thats it! I think this isn't too bad at all. My assessment on how easy it is to fix them. 1. - easy Hot reload isn't necessary in Jupyter. 2. I am clueless about this one, since I am not sure what it actually does 🙃. 3. Trivial - just remove the import. 4. Depends - A clean solution probably requires some restructering
I would be happy to help implement the changes. I saw that there is already a
_using_solara_server
function that checks for the existence of solara.server. The quick solution for 1) and 4) could be to just use this to deactive the features when solara.server is not available - if this is fine as a first solution I am happy in submitting a PR (and remove 3). I would just need some more information on 2).When these changes are applied it should be possible to use solara with JupyterLite by just mocking the unavailable dependencies. So this could be possible pretty soon, before solara is split into solara-server and solara-ui (I read somewhere this is one of the plans, but probably takes some more time).