Nb-clean

Latest version: v4.0.1

Safety actively analyzes 714973 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 5

2.0.2

This patch release changes the build backend to `poetry-core` in order to make PEP 517 builds faster, and not require Poetry and all its dependencies be installed.

2.0.1

This patch release bumps the `nbformat` version required in order to provide support for using path-like objects.

2.0.0

This major release significantly refactors the codebase. This enables `nb-clean` to be used as a Python library in addition to as a command line tool, and introduces unit tests for both.

When using the `nb-clean` CLI, it is no longer required to pass flags to indicate input and output files, as `nb-clean` will operate on all files passed as positional arguments in place. If no positional arguments are passed, the input notebook is read from standard input and, for the `check` subcommand, the output notebook is written to standard output.

To support this and improve usability, the command line interface has changed. If you upgrade from a previous release, you'll need to migrate to the new interface. The following table maps from the command line interface of `nb-clean` 1.6.0 to that of `nb-clean` 2.0.0.

| Description | `nb-clean` 1.6.0 | `nb-clean` 2.0.0 |
| --------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------- |
| Clean notebook | `nb-clean clean -i/--input notebook.ipynb \| sponge notebook.ipynb` | `nb-clean clean notebook.ipynb` |
| Clean notebook (remove empty cells) | `nb-clean clean -i/--input notebook.ipynb -e/--remove-empty` | `nb-clean clean -e/--remove-empty-cells notebook.ipynb` |
| Clean notebook (preserve cell metadata) | `nb-clean clean -i/--input notebook.ipynb -m/--preserve-metadata` | `nb-clean clean -m/--preserve-cell-metadata notebook.ipynb` |
| Check notebook | `nb-clean check -i/--input notebook.ipynb` | `nb-clean check notebook.ipynb` |
| Check notebook (remove empty cells) | `nb-clean check -i/--input notebook.ipynb -e/--remove-empty` | `nb-clean check -e/--remove-empty-cells notebook.ipynb` |
| Check notebook (preserve cell metadata) | `nb-clean check -i/--input notebook.ipynb -m/--preserve-metadata` | `nb-clean check -m/--preserve-cell-metadata notebook.ipynb` |
| Add Git filter to clean notebooks | `nb-clean configure-git` | `nb-clean add-filter` |
| Remove Git filter | `nb-clean unconfigure-git` | `nb-clean remove-filter` |

1.6.0

This minor release adds optional functionality to preserve cell metadata. The `configure-git`, `clean`, and `check` subcommands now support an optional `-m`/`--preserve-metadata` flag. When this is set, `nb-clean configure-git` and `nb-clean clean` won't remove cell metadata from notebooks, and `nb-clean check` won't fail if the notebook contains cell metadata.

1.5.0

This minor release adds optional functionality to remove empty cells. The `configure-git`, `clean`, and `check` subcommands now support an optional `-e`/`--remove-empty` flag. When this is set, `nb-clean configure-git` and `nb-clean clean` will remove empty cells from notebooks in addition to removing cell execution counts, metadata, and outputs, and `nb-clean check` will fail if the notebook contains empty cells.

1.4.3

This patch release fixes an incorrect error message when calling `nb-clean unconfigure-git` in a Git repository which did not have the `nb-clean` filter installed. Previously, it would be reported that the working directory was not a Git repository. Now it's correctly reported that an `nb-clean` section is not present in the repository's Git configuration file.

Page 3 of 5

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.