Skip to main content

nbclear

A tool (and pre-commit hook) to automatically remove the output from all code cells in all Jupyter notebooks.

Installation

pip install nbclear

As a pre-commit hook

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo: https://github.com/ozen/nbclear
    rev: v0.1.0
    hooks:
    -   id: nbclear

Behavior

The tool opens the notebook and clears the outputs of cells in the memory.
If there are no changes in the notebook, it quits without further action.
If there are changes, it moves the original file notebook.ipynb to notebook.ipynb~ and saves the cleared notebook to notebook.ipynb.
If the backup cannot be created, it prints the error and quits.

Release files for nbclear 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbclear 0.1.0
File Size Uploaded
nbclear-0.1.0.tar.gz 3.3 kB Details

Release files / nbclear-0.1.0.tar.gz

Download URL nbclear-0.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ee95483e1c1f41cab759b56b13d67d40cb84f2d05cf1fe5bf58d1a787ad6e41f
BLAKE2b-256 checksum
How to use checksums
df4810e45615c45da9c420256bbc5575007f27677a2c423b81ad9596af02b71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2.post20201201 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page