I use widgets in a Jupyter notebook and save their state (e.g. the "Settings -> Save Widget state automatically" is checked) to the notebook file. For the sake of git versioning this notebook, I want to clear the widget state again.
I tried:
- Uncheck the setting in the Jupyter lab frontend, restart the kernel, save again.
- Uncheck the setting, restart kernel, save, then (horrible) delete the "widgets" field from the json file.
The first approach just saves the state again. For the second non-usable approach the field "widgets" just gets restored every time I save the notebook.
A preferred solution would be to disable the state saving from within Jupyter lab.
Used versions:
- Jupyterlab 3.4.2
- Jupyterlab_widgets 1.1.0
- IPyWidgets 7.7.0
- Python 3.10
PS: I ended up in using a pre-commit hook, which I patched to remove also the state pre-commit-jupyter