Closed GeorgePearse closed 4 months ago
I think it depends a bit on what you're trying to accomplish.
Jupyter Scatter uses regl-scatterplot under the hood (you could almost go as far an call Jupyter Scatter just an API layer for integration with the Jupyter and Pandas world) so it's definitely possible to replicate the interface in a web app. However, this requires fully understanding regl-scatterplot's API (which isn't the most intuitive I must confess 😅).
A more lightweight option would be voila (streamlit is unfortunately not an option as it does not support ipywidgets). I personally haven't used voila before but in a quick test it seems to render the notebook with jscatter just fine.
You can also use nbconvert to turn your notebook into a sharable HTML page if you don't need to run any computation interactively. For now just keep in mind of the selection limitation when using nbconvert.
@manzt Do you by chance know of other cool libraries for turning a notebook into a deployable web app?
This is a great answer @flekschas really appreciate it.
Had just started looking into whether voila would do the trick.
Getting it running with voila was pretty incredibly easy.
@manzt Do you by chance know of other cool libraries for turning a notebook into a deployable web app?
There are a couple dashboarding frameworks with support for widgets. I haven't built anything that substantial with any.
I believe solara is the most oriented around widgets (cc: @maartenbreddels), and allows for prototyping with notebooks.
Thank you for the mention Trevor!
Using this example:
import jscatter
import numpy as np
import pandas as pd
# Just some random float and int values
data = np.random.rand(500, 4)
df = pd.DataFrame(data, columns=['mass', 'speed', 'pval', 'group'])
# We'll convert the `group` column to strings to ensure it's recognized as
# categorical data. This will come in handy in the advanced example.
df['group'] = df['group'].map(lambda c: chr(65 + round(c)), na_action=None)
page = jscatter.plot(data=df, x='mass', y='speed')
This can be run using solara run app.py
and it will pick up the page
variable/widget.
Wow nice! Thanks for sharing the snippets!
@GeorgePearse Does that help you getting started?
@flekschas got a silly number of good options now, tooling in this space has got so much better over the last few years.
Awesome! I'll close the ticket then but please feel free to reopen it if you have more questions.
I want to hand this over to non-technical users, and stitch it together with a few python workflows.
What's my best option for this? Should I try to productionise the jupyter notebook as a web app?
Could I embed it in anything else?