Skip to content

AnH0ang/nb_move_imports

Repository files navigation

nb_move_imports


PyPI version Python version Release Pipeline Test Code Quality License: MIT pre-commit

Move import statements in jupyter notebook to the first cell

Use nb_move_imports

To run the script on a specific jupyter notebook run:

nb_move_imports path/to/notebook.ipynb

Skip processing of cells

In order to skip a cell you have to tag it with the IGNORE_MV_IMPORTS tag.

Precommit Hook

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