Skip to main content
https://travis-ci.org/kynan/nbstripout.svg?branch=master

nbstripout: strip output from Jupyter and IPython notebooks

Opens a notebook, strips its output, and writes the outputless version to the original file.

Useful mainly as a git filter or pre-commit hook for users who don’t want to track output in VCS.

This does mostly the same thing as the Clear All Output command in the notebook UI.

Based on https://gist.github.com/minrk/6176788.

Usage

Strip output from IPython / Jupyter notebook (modifies the files in-place):

nbstripout FILE.ipynb [FILE2.ipynb ...]

Force processing of non .ipynb files:

nbstripout -f FILE.ipynb.bak

Use as part of a shell pipeline:

FILE.ipynb | nbstripout > OUT.ipynb

Set up the git filter and attributes as described in the manual installation instructions below:

nbstripout install

Remove the git filter and attributes:

nbstripout uninstall

Print the version:

nbstripout version

Show this help page:

nbstripout help

Manual filter installation

Set up a git filter using nbstripout as follows:

git config filter.nbstripout.clean '/path/to/nbstripout'
git config filter.nbstripout.smudge cat
git config filter.nbstripout.required true

Create a file .gitattributes or .git/info/attributes with:

*.ipynb filter=nbstripout

Mercurial usage

Mercurial does not have the equivalent of smudge filters. One can use an encode/decode hook but this has some issues. An alternative solution is to provide a set of commands that first run nbstripout, then perform these operations. This is the approach of the mmf-setup package.

Metadata

Release files for nbstripout 0.2.5

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

Source distribution (sdist)

Source distribution for nbstripout 0.2.5
File Size Uploaded Provenance Actions
nbstripout-0.2.5.tar.gz 8.2 kB Without provenance Details for nbstripout-0.2.5.tar.gz

Release files / nbstripout-0.2.5.tar.gz

Download URL nbstripout-0.2.5.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4ee9401f406cc2394dfed00f4e4a07e462294eef41950fd222ce2a84a99d8535
BLAKE2b-256 checksum
How to use checksums
4d1af2b2aca37f46f516d0cd9474a70b6811e7c957e48eefadf022ae7f130570
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nbstripout 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.5 This release

1 release file No provenance

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