Skip to content
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

Save notebook widget state #4404

Open
vblua opened this issue Jan 15, 2021 · 9 comments
Open

Save notebook widget state #4404

vblua opened this issue Jan 15, 2021 · 9 comments
Assignees
Labels
feature-request Request for new features or functionality ipywidgets Rendering, loading, saving, anything to do with IPyWidgets

Comments

@vblua
Copy link

vblua commented Jan 15, 2021

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 vblua added the bug Issue identified by VS Code Team member as probable bug label Jan 15, 2021
@joyceerhl
Copy link
Contributor

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.

@greazer greazer added the ipywidgets Rendering, loading, saving, anything to do with IPyWidgets label Aug 3, 2021
@greazer
Copy link
Member

greazer commented Oct 18, 2021

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

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Aug 22, 2022

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 DonJayamanne reopened this Aug 22, 2022
@github-actions github-actions bot added the triage-needed Issue needs to be triaged label Aug 22, 2022
@DonJayamanne DonJayamanne self-assigned this Aug 22, 2022
@DonJayamanne DonJayamanne added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Dec 5, 2022
@gsnidero
Copy link

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

@sgbaird
Copy link

sgbaird commented Jun 14, 2023

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!

@ma-sadeghi
Copy link

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

@johnwalz97
Copy link

Bumping this issue as it would be very helpful for documentation

@Phlya
Copy link

Phlya commented May 30, 2024

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

@sgbaird
Copy link

sgbaird commented May 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality ipywidgets Rendering, loading, saving, anything to do with IPyWidgets
Projects
None yet
Development

No branches or pull requests

9 participants