vscode-jupyter icon indicating copy to clipboard operation
vscode-jupyter copied to clipboard

Save notebook widget state

Open vblua opened this issue 4 years ago • 9 comments

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

vblua avatar Jan 15 '21 09:01 vblua

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.

joyceerhl avatar Jan 21 '21 21:01 joyceerhl

Thanks for the feedback! However, we don't have plans on adding this functionality at this time.

greazer avatar Oct 18 '21 21:10 greazer

re-opening this so we can track this issue, ad it relates to saving widget state that's supported in jupyter notebook and lab.

DonJayamanne avatar Aug 22 '22 13:08 DonJayamanne

This would be really helpful, especially for commonly used libs like tqdm progress bar

gsnidero avatar Mar 24 '23 10:03 gsnidero

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!

sgbaird avatar Jun 14 '23 04:06 sgbaird

Hi @greazer. Just following up to see if this has been bumped up in the priority list or still not planned for. Thanks!

ma-sadeghi avatar Feb 26 '24 10:02 ma-sadeghi

Bumping this issue as it would be very helpful for documentation

johnwalz97 avatar Mar 12 '24 17:03 johnwalz97

Also wanted to upvote this issue, it is important to be able to generate interactive documentation with notebooks!

Phlya avatar May 30 '24 09:05 Phlya

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).

sgbaird avatar May 30 '24 09:05 sgbaird