widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.62k stars 105 forks source link

Run Python on the clients machine. #623

Open SuperPauly opened 2 weeks ago

SuperPauly commented 2 weeks ago

I want to make a Jupyter style notebook where Python runs on the clients machine.

But looking over the documentation I can not see any premade components or details weather this is possible. I've done it before in Streamlit but I want to move away from it.

I have seen Pyodide and other Jupyter Kernels and was wondering is it possible to run Python code on the client?

iisakkirotko commented 2 weeks ago

Hi @SuperPauly!

To clarify - you'd like to have a hosted solara app, where some computation (within a component?) is done on the client's machine? There isn't such a feature built into Solara currently, although Solara should be compatible with Pyodide.

SuperPauly commented 2 weeks ago

Hi @SuperPauly!

To clarify - you'd like to have a hosted solara app, where some computation (within a component?) is done on the client's machine? There isn't such a feature built into Solara currently, although Solara should be compatible with Pyodide.

Yeah so I want to make a dashboard that displays data, let's say inside a Dataframe. I then want a section below the Dataframe that is like a Python/Jupyter code cell that I can import sklearn, tensorflow, pytorch or any other data modules. Then import the modules write some code, then run the cell, the output/results will be shown on the Dataframe above.

So the only way is to write the code on the front end and then send it to the backend to be run?

iisakkirotko commented 2 weeks ago

Running python code within a Solara app in a context aware way is tricky.

Depending on how much integration you would need between the surrounding app (if you would need one at all) and the code block, pycafe might be a solution. It's still in it's early stages, so there might be missing/incomplete features, but if there are any features you need / want to know if they'll be available in the future, you can get in touch with me via iisakki.rotko@widgetti.io.

SuperPauly commented 2 weeks ago

Running python code within a Solara app in a context aware way is tricky.

Depending on how much integration you would need between the surrounding app (if you would need one at all) and the code block, pycafe might be a solution. It's still in it's early stages, so there might be missing/incomplete features, but if there are any features you need / want to know if they'll be available in the future, you can get in touch with me via iisakki.rotko@widgetti.io.

Yeah context and security could be an issue unless I hook it up to a Docker container. I might try Pyodide, the Pycafe library looks interesting so I've booked marked it for now.