jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook

Home Page:https://ipywidgets.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option for "Clear Widget State" in JupyterLab

kolibril13 opened this issue · comments

It's great that there's an option to save a widget state in JupyterLab.
It would be nice if there was an option to clear a widget state as well, as saved widget states can drastically increase the notebook size. Not ideal for version control.

In the past, I had the assumption that "Clear all notebook outputs" would also clear the stored widget states, but that's not the case.

When working on a notebook where "Save widget state automatically" is activated, I realized that it's only possible to remove the state data by making a fresh notebook and copying the notebook content cell by cell.

@jtpio mentioned such an option here jtpio/ipylab#137 (comment), together with the idea of a new Save Widget State, next to the already existing Save Widget State Automatically (toggle)

Thinking of version control, it might be also worth considering saving the widget state not in the notebook itself, but instead in an external widget_state.json file. I remember in the past there was an option to Download Widget State in the classic jupyter notebook https://ipywidgets.readthedocs.io/en/8.1.2/embedding.html#widget-state-json
Keeping a widget_state.json with all the widget state data in a gitignore would keep the notebook small in size without losing the state.

Isn't this a duplicate of #3672? (linked in jtpio/ipylab#137 (comment))

It is, sorry for the dublicate.