Move import statements in jupyter notebook to the first cell
To run the script on a specific jupyter notebook run:
nb_move_imports path/to/notebook.ipynb
In order to skip a cell you have to tag it with the IGNORE_MV_IMPORTS
tag.
Add this section to your pre-commit-config.yaml
so that the nb_move_imports script is executed before each commit with pre-commit.
- repo: https://github.com/AnH0ang/nb_move_imports
rev: 0.4.5
hooks:
- id: nb_move_imports
name: nb_move_imports