Save notebook widget state
Is there a possibility to save notebook widget state during export to html ? The widget appears very well but it disappears when I export the notebook in html format. Thanks
Thanks for the suggestion! We don't have plans to prioritize implementing this now, and if this issue receives upvotes from the community we will reconsider.
Thanks for the feedback! However, we don't have plans on adding this functionality at this time.
re-opening this so we can track this issue, ad it relates to saving widget state that's supported in jupyter notebook and lab.
This would be really helpful, especially for commonly used libs like tqdm progress bar
I came here via https://docs.readthedocs.io/en/stable/guides/jupyter.html#rendering-interactive-widgets related to retaining ipywidgets features in Jupyter notebooks that get used in Sphinx documentation. I.e., the documentation derived from notebooks can be interactive.
- The classical Jupyter Notebook interface provides a “Save Notebook Widget State” action in the “Widgets” menu, as explained in the ipywidgets documentation. You need to click it before exporting your notebook to HTML.
- JupyterLab provides a “Save Widget State Automatically” option in the “Settings” menu. You need to leave it checked so that widget state is automatically saved.
- In Visual Studio Code it’s not possible to save the widget state at the time of writing (June 2021).
Just highlighting an additional reason why it would be nice to be able to save the state. Maybe there's some workaround that could be integrated into a GitHub action to run the notebook and save the widget state. If someone has a suggestion, open to hearing it!
Hi @greazer. Just following up to see if this has been bumped up in the priority list or still not planned for. Thanks!
Bumping this issue as it would be very helpful for documentation
Also wanted to upvote this issue, it is important to be able to generate interactive documentation with notebooks!
I came here via https://docs.readthedocs.io/en/stable/guides/jupyter.html#rendering-interactive-widgets related to retaining ipywidgets features in Jupyter notebooks that get used in Sphinx documentation. I.e., the documentation derived from notebooks can be interactive.
- The classical Jupyter Notebook interface provides a “Save Notebook Widget State” action in the “Widgets” menu, as explained in the ipywidgets documentation. You need to click it before exporting your notebook to HTML.
- JupyterLab provides a “Save Widget State Automatically” option in the “Settings” menu. You need to leave it checked so that widget state is automatically saved.
- In Visual Studio Code it’s not possible to save the widget state at the time of writing (June 2021).
Just highlighting an additional reason why it would be nice to be able to save the state. Maybe there's some workaround that could be integrated into a GitHub action to run the notebook and save the widget state. If someone has a suggestion, open to hearing it!
As a follow up I ended up using HTML and JavaScript to display Jinja2 templates, then included as raw HTML within Sphinx pages, and hosted on readthedocs. In addition to difficulty of saving notebooks with widget state preserved from VS Code, I think I may have also run into some issues with getting the behavior I wanted in the actual widget. Since I had very little experience with JavaScript before that, I relied heavily on ChatGPT, sometimes asking for a conversion from a Python function I wrote to do the same thing 😅. I tried for a pure-Python solution, but it just wasn't feasible for me.
See an example of these interactive docs at https://honegumi.readthedocs.io/ (scroll about halfway down the page to the grid selection interface).