nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

[BUG] nbdev_install_hooks not installing nbdev_clean hook

Open jnareb opened this issue 2 years ago • 1 comments

The nbdev_install_hooks, contrary to the documentation and expectations, do not install nbdev_clean hook: only nbdev_merge (in .gitattributes and .gitconfig) and nbdev_trust (in .git/hooks/post-merge).

Because the Git-Friendly Jupyter does not provide any information about what this command should do, and reference documentation is next to useless in that regard, I am not able to fix the issue myself.

I use nbdev version 2.3.12

jnareb avatar May 26 '23 23:05 jnareb

This affected me in https://forums.fast.ai/t/ci-test-yaml-failing/113820

It doesn't look like nbdev_install_hooks even attempts to install nbdev_clean. https://github.com/fastai/nbdev/blob/main/nbs/api/11_clean.ipynb

It also looks like there's some stuff in there for a "pre_save_hook from Jupyter's file save hook API". So maybe at some point in the past nbdev_install_hooks actually installed nbdev_clean (I looked as far as Aug `22 commits and couldn't find it there), and the documentation was never updated to reflect a change to relying on jupyter?

Is adding a simple one-line file nbdev_clean to .git/pre-commit a solution in the meantime?

Or should we be relying on some jupyter file save hook to clean the notebooks for some reason?

JamesHarrisonBaggs avatar Nov 16 '24 14:11 JamesHarrisonBaggs