Registry / devops / nb-clean

nb-clean

JSON →
library4.0.1pypypiunverified

A tool to clean Jupyter notebooks for version control, removing cell outputs, execution counts, and metadata. Current version is 4.0.1, released March 2025. Release cadence is irregular, with major versions dropping support for old Python releases.

pip install nb-clean
INSTALL
IMPORT
SIG · NB-CLEAN
N
nb-clean
devopspythonv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

nb-clean is a command-line tool; there is no Python API to import.

# Clean a notebook in-place nb-clean clean notebook.ipynb # Check if a notebook is clean nb-clean check notebook.ipynb
nb-clean --version
Debug
Known issues
breakingVersion 4.0.0 drops support for Python 3.8. Users on Python 3.8 must stay on nb-clean <4.0.0 or upgrade Python.
fix
Upgrade Python to >=3.9 or pin nb-clean to <4.0.0.
affects: >=4.0.0
breakingVersion 3.0.0 drops support for Python 3.7. Users on Python 3.7 must stay on nb-clean <3.0.0 or upgrade Python.
fix
Upgrade Python to >=3.8 or pin nb-clean to <3.0.0.
affects: >=3.0.0, <4.0.0
gotchaBy default, nb-clean removes all cell outputs, execution counts, and cell metadata. If you want to preserve outputs, use the --preserve-cell-outputs flag. Preserving execution counts requires --preserve-execution-counts, and preserving notebook metadata (like kernel info) requires --preserve-notebook-metadata.
fix
Use appropriate flags: -o (preserve cell outputs), -c (preserve execution counts), -n (preserve notebook metadata).
affects: all
Errors
Common errors & fixes
nb-clean: error: unrecognized arguments: --preserve-cell-metadata
The --preserve-cell-metadata flag expects a value to specify which metadata keys to preserve, but the user passed it without a value or with a space-separated list.
fix
Use the flag with a comma-separated list: --preserve-cell-metadata key1,key2
ModuleNotFoundError: No module named 'nb_clean'
Trying to import nb-clean as a Python module. nb-clean is a command-line tool, not a library.
fix
Do not import; run as a CLI command: nb-clean clean notebook.ipynb
Upgrade
Version history
4.0.1latest on PyPI · released Oct 19, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
nb-clean — pip install nb-clean · libregistry