{"id":24096,"library":"nb-clean","title":"nb-clean","description":"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.","status":"active","version":"4.0.1","language":"python","source_language":"en","source_url":"https://github.com/srstevenson/nb-clean","tags":["jupyter","notebook","clean","version-control","git"],"install":[{"cmd":"pip install nb-clean","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[],"quickstart":{"code":"# Clean a notebook in-place\nnb-clean clean notebook.ipynb\n\n# Check if a notebook is clean\nnb-clean check notebook.ipynb","lang":"bash","description":"nb-clean is a command-line tool; there is no Python API to import."},"warnings":[{"fix":"Upgrade Python to >=3.9 or pin nb-clean to <4.0.0.","message":"Version 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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade Python to >=3.8 or pin nb-clean to <3.0.0.","message":"Version 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.","severity":"breaking","affected_versions":">=3.0.0, <4.0.0"},{"fix":"Use appropriate flags: -o (preserve cell outputs), -c (preserve execution counts), -n (preserve notebook metadata).","message":"By 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use the flag with a comma-separated list: --preserve-cell-metadata key1,key2","cause":"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.","error":"nb-clean: error: unrecognized arguments: --preserve-cell-metadata"},{"fix":"Do not import; run as a CLI command: nb-clean clean notebook.ipynb","cause":"Trying to import nb-clean as a Python module. nb-clean is a command-line tool, not a library.","error":"ModuleNotFoundError: No module named 'nb_clean'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}