Skip to main content

A tool to automatically remove the outputs from Jupyter notebooks.

Project description

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.

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

nbclear-0.1.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page