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 details)

Uploaded Source

File details

Details for the file nbclear-0.1.0.tar.gz.

File metadata

  • Download URL: nbclear-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for nbclear-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee95483e1c1f41cab759b56b13d67d40cb84f2d05cf1fe5bf58d1a787ad6e41f
MD5 8f7d14e278f5183b3bc76005f628fe2c
BLAKE2b-256 df4810e45615c45da9c420256bbc5575007f27677a2c423b81ad9596af02b71b

See more details on using hashes here.

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