-
Notifications
You must be signed in to change notification settings - Fork 147
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
Use in static documentation sites? #449
Comments
Over at Mesa we're working on a Solara-based front-end. We're now considering deploying examples and tutorials using JupyterLite, which uses Pyodide under the hood. We would love Solara to support this environment, since most our users are modellers but not necessarily. It would lower the barrier to entry significantly if they could start with running examples and models from the browser. |
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. We are also working on something that enables you to run solara conveniently in the browser, if jupyter lite does not suite your need, please contact me at maartenbreddels@widgetti.io if you want to do user-testing. Regards, Maarten |
I tested solara in Jupyterlite (https://jupyterlite.readthedocs.io/en/stable/_static/lab/index.html) with the following code: %pip install "solara-ui[all]"
import solara
# Declare reactive variables at the top level. Components using these variables
# will be re-executed when their values change.
sentence = solara.reactive("Solara makes our team more productive.")
word_limit = solara.reactive(10)
@solara.component
def Page():
# Calculate word_count within the component to ensure re-execution when reactive variables change.
word_count = len(sentence.value.split())
solara.SliderInt("Word limit", value=word_limit, min=2, max=20)
solara.InputText(label="Your sentence", value=sentence, continuous_update=True)
# Display messages based on the current word count and word limit.
if word_count >= int(word_limit.value):
solara.Error(f"With {word_count} words, you passed the word limit of {word_limit.value}.")
elif word_count >= int(0.8 * word_limit.value):
solara.Warning(f"With {word_count} words, you are close to the word limit of {word_limit.value}.")
else:
solara.Success("Great short writing!")
# The following line is required only when running the code in a Jupyter notebook:
Page() And I met the issue of
Please check. |
I'm really impressed with solara so far. Thank you so much for your time.
I have a project which has a static site for documentation. I have some example notebooks in there that are run to generate the HTML using mkdocs and mkdocs-jupyter. Before, I was using plain old altair charts. But now I want to make them more interactive with solara components. However, now the staticly built example pages don't render the widgets correctly, because there is no backend to connect to. It says
Cannot show widget. You probably want to rerun the code cell above (Click in the code cell, and press Shift+Enter ⇧+↩).
The example page I'm taking about is here (cell number 3, where it usesdistribution_dashboard()
)Do you have suggestions as to how I can present these examples with the live widgets still working? Can we make solara work with jupyterlite? If I try pip installing Solara in jupyterlite there are a few dependencies like watchdog that don't have wasm wheels and this Solara fails to install. Can we make these deps optional (no filesystem in jupyterlite anyways...) or otherwise fix them?
Should I put these examples in a binder or colab instance and just link to them? It would be very nice if I didn't have to link out, and the examples could just live on the static github pages site.
The text was updated successfully, but these errors were encountered: