Remove empty code and markdown cells from Jupyter notebooks (ideal for pre-commit hooks)
Project description
nbstrip-empty-cells
v0.1.3
- Minor edits to documentation and README formatting.
- CLI refference:
nbstrip-empty-cellfromv0.1.0,v0.1.1->nbstrip-empty-cells nbstrip-empty-cellsworks inv0.1.2&v0.1.3
What this Hook Does
This hook automatically removes empty code and markdown cells from Jupyter notebooks before they are committed. It helps keep your notebooks clean and version control diffs minimal.
Why use this Tool:
- Avoid noisy diffs from empty cells.
- Keep your notebooks clean and readable, especially in version control.
- Seamlessly integrates with your Git workflow via pre-commit
- Safe to run on mixed repositories — non-.ipynb files are ignored.
Example usage with pre-commit & pip
Add to your .pre-commit-config.yaml in your notebook repository:
- repo: https://github.com/Drew5040/nbstrip-empty-cell
rev: v0.1.3
hooks:
- id: nbstrip-empty-cells
Then install pre-commit in your local repository:
pre-commit install
Update all hook versions:
pre-commit autoupdate
Then run the hook (nbstrip-empty-cells) manually on all files (safe to do so):
pre-commit run --all-files
Installation & Usage via pip & CLI (Optional)
pip install nbstrip-empty-cells
nbstrip-empty-cells notebook1.ipynb notebook2.ipynb
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbstrip_empty_cells-0.1.3.tar.gz.
File metadata
- Download URL: nbstrip_empty_cells-0.1.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
164f38ba747cdc2955888bda695d6289272b7349fa5f6adb3f5d3bc919908ad9
|
|
| MD5 |
fadf2ba37ae413ea6e5efebf4ddd7868
|
|
| BLAKE2b-256 |
5e884b5e0bd7721da1264a474035383ad384cc9ff1e62b777df2e8ea8bc702ef
|
File details
Details for the file nbstrip_empty_cells-0.1.3-py3-none-any.whl.
File metadata
- Download URL: nbstrip_empty_cells-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e291f86d51bff16ac3d90c3b6c638cc785501f1dd9c7d872228bc13c4190d3e
|
|
| MD5 |
1b49d208d2552277ab94143e032c3ec3
|
|
| BLAKE2b-256 |
ba0768facf7c5ac1008308172a311921c258cd34ea6533a9f9e3443fd4e336f1
|