Command
Clean Notebook
Cleans a Jupyter notebook: removes dead cells, fixes run order, moves reusable code into modules and checks it runs top to bottom.
11. Copy it to `<name>.backup.ipynb` before touching anything.
22. Read all cells with `jupyter nbconvert --to script` or by parsing the JSON. List cells that are empty, commented-out experiments, duplicated, or never referenced by later cells.
33. Find hidden state: variables used before they are defined in file order, cells that depend on a manual run order, and hard-coded absolute paths or credentials. Move paths to variables at the top.
44. Propose the cleanup list and ask for approval before deleting any cell.
55. Move functions used by more than one cell into `<name>_lib.py` beside the notebook with docstrings, and import them. Keep exploratory plotting in the notebook.
python
Clean Notebook
Commandpython
Free