Closed yasirroni closed 1 year ago
I expect this can be done by writing a function that:
model
argument passed to the pre-save hook from a dictionary to a nbformat.notebooknode.NotebookNode
;NotebookNode
to the clean_notebook
function from nb-clean;This function could then be bound to c.ContentsManager.pre_save_hook
in your jupyter_notebook_config.py
.
Let's wait until there's a concrete use case to implement this though, as there's a maintenance cost to any new code. Hence I'll close this issue for now and it can be reopened if the need arises.
Then maybe, a simple snippet example of jupyter_notebook_config.py in this issue? So that user can just copy paste it without the need of us implementing installation inside nb-clean add-jupyter-hook
It is nice to have
git-filter
andpre-commit
. But, how about save hook so that it is running on save?See https://jupyter-notebook.readthedocs.io/en/stable/extending/savehooks.html
What is the benefit? It will not cause
git diff
if you just open a notebook (because opening a notebook will add metadata) and save. Running it will also not adddiff
if nothing changed.