-
Notifications
You must be signed in to change notification settings - Fork 114
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
Better compatibility with existing notebooks #539
Comments
maartenbreddels
added a commit
that referenced
this issue
Mar 11, 2024
feat: improve matplotlib support - as Jupyter Several improvements: ## Default backend We do this by checking if the env var 'MPLBACKEND' is not set, and if so, we set it to module://matplotlib_inline.backend_inline ## Support for display(figure) This makes it behave more like the Jupyter notebook environment. ## Support matplotlib pylab interface in solara server This makes code that 'just works' in the notebook also work in solara server. We patch global dicts with scoped dicts. See #539
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc @koaning
While preparing a demo of https://github.com/koaning/drawdata using the original notebook to run on solara-server, we need to make the following changes.
Assign the widget to display to the page variable
This is mentioned in the tutorial for script: https://solara.dev/docs/tutorial/ipywidgets
And also mentioned here: https://solara.dev/docs/reference/notebook-support
But, in notebook, we often display the last expression. I think we can do that if no
Page
orpage
variable is found.We needed to modify the notebook like this:
Improved matplotlib support
Although we support matplotlib: https://solara.dev/api/matplotlib
Often, we find people using the pyplot interface, and expect plt.show to work. Although this uses a global object, and we live in a shared process (virtual kernels), this can be properly scoped.
We needed the following diff
I think we can fix both issues, and run the notebook unmodified as:
The text was updated successfully, but these errors were encountered: