Wipe clean your Jupyter Notebooks!
Project description
nbwipers
nbwipers is a command line tool to wipe clean jupyter notebooks, written in Rust.
The interface and functionality are based on nbsripout and the idea to implement it in rust comes from nbstripout-fast.
Usage
nbwipers has a few subcommands that provide functionality related to cleaning Jupyter notebooks.
clean
: clean a single notebook. This is more-or-less equivalent tonbstripout
check
: check notebooks in a given path for elements that would be removed byclean
. This could be used in a CI context to enforce clean notebooks.clean-all
clean all notebooks in a given path. This one should be used carefully!install
register nbwipers as a git filter foripynb
files. Equivalent tonbstripout --install
The full options can be found in CommandLineHelp.md
.
Examples
To set up nbwipers as a git filter in your repository, use
nbwipers install local
To check the notebooks in your folder
nbwipers check .
Motivation
A working copy of a Jupyter notebook contains
- Code written by the author
- Notebook outputs: tables, logs, tracebacks, images, widgets and so on...
- Execution counts
- Metadata, such as whether cells are collapsed, scrollable etc.
Of these categories of data, only the first — code written by the author — should definitely be tracked by version control, since it is the product of the author's intension and hard work. The other categories of data are subject to change outside of the explicit intensions of the author, and are generally noisy from a version control perspective.
Moreover, including notebook outputs in version control
- makes diffs harder to interpret, as they will contain lots of unintended changes
- increases the risk of a tricky merge conflict if different users run the same cell and get a slightly different result
- increases the amount of data committed, which can degrade repository performance
- risks leaking sensitive data
By using nbwipers or nbstripout as a git filter, the problematic parts of the notebook are removed from the version of the file that git sees, while leaving your working copy intact.
Acknowledgements
nbwipers relies on inspiration and code from several projects.
For the projects whose code was used please see LICENSE
for the third-party notices.
nbsripout
strip output from Jupyter and IPython notebooks
nbstripout is an invaluable tool for working with Jupyter Notebooks in the context of version control. This project forms the basis of the interface and logic of this project and is also the source of the testing examples.
nbstripout-fast
A much faster version of nbstripout by writing it in rust (of course).
nbstripout-fast, like this project, implements the functionality of nbstripout in Rust, while also allowing repo-level configuration in a YAML file.
With nbwipers I hoped to recreate the idea of nbstripout-fast, but with the ability to install as a git filter, and configuration via pyproject.toml
.
ruff
An extremely fast Python linter and code formatter, written in Rust.
Ruff is quickly becoming the linter for python code, thanks to its performance, extensive set of rules and its ease of use. It was a definite source of knowledge for the organisation of the configuration and the file discovery. The schema for Jupyter Notebooks, and some of the file discovery code was adapted from Ruff.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for nbwipers-0.1.0-py3-none-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1aa7561b323621ea7ea12983d835be569ea0512a46c2a21702291090f745550 |
|
MD5 | 419bc310a9c2fd1517e8eaa0f598c158 |
|
BLAKE2b-256 | 3a38139182335ef4128faacf9552a660643726867983657d3085f71d317bf521 |
Hashes for nbwipers-0.1.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9852aaf91ea0650975c9687382fe01b4bc89ed4cf3982370606fe44100f4382b |
|
MD5 | 5791e6b3970317ef9a82ef98da2f6611 |
|
BLAKE2b-256 | 81985bf8ae368016a89c1394e4bbea7c1bde7fb86f8d7bf68f05a761a5b9df86 |
Hashes for nbwipers-0.1.0-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4861b9881525782af68155a6c00a35fe7e06fa8e0d107df5cac4cbf2c839477b |
|
MD5 | 75eb86471b8a05eeb4fdece04af887d3 |
|
BLAKE2b-256 | 61303dd622b765d09d8da9c9476b08d3da758b2e3d4bf092354fd2e4a74484b6 |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c63850fba902f6ef552c527a25a4cf6440afe3cac300f34041a3eb39d75e731 |
|
MD5 | fdef1867c7af976485339f23eb212972 |
|
BLAKE2b-256 | 45c31784ccf31eec5b280ec39417522911fe43e89e588fa85d7f160e24bd58a1 |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6010cec695599362299bf86faa6e625e659869bb8df23b9a009a444b6e800a9 |
|
MD5 | 24a4d5c1a52e69c4eecabecb48280284 |
|
BLAKE2b-256 | c631dc7cfdef4d4f414d38c2910a2dd3e46e00a5619a68e9cd7a99c0e4fc1b6f |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d5536ee9082675b501db4679ea90cdfa8702b9e807a6fa38815d9706f18fa35 |
|
MD5 | 8767a54f5d56efd56153e9a539481abc |
|
BLAKE2b-256 | 2d939b7b01d1e30ddcc8300a9a2b17c02e652607dbbf374e2a1e854f3c547917 |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d9f28c18148132221c551cabf0baea4a496aadb213a231c25bbf11842352f8f |
|
MD5 | 5a32ee904bc6119e0f47c1536ba630f5 |
|
BLAKE2b-256 | 3f916f56229a36e329e64635140c0fdb281aab80a56700358adad16ca9bdaf0c |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ad3b321e3b2b736447f1af97b31d093ad78f5db0f98960765b65d7151fffce |
|
MD5 | 2e31eebeb2072e62970f657f6ee8d448 |
|
BLAKE2b-256 | 7d556c072680f646a01e3529fe54461850387a11cb302f8b3a0570583a4badba |
Hashes for nbwipers-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cfec9b16c5172d47f5f5f75cc4840be0d0bde2ecb9cb904e47a7f18a3c960ec |
|
MD5 | 638d5e7cb8f4273378b62729e0b62472 |
|
BLAKE2b-256 | 67803d2ae19fb3e78ef61cef08ab8b2af94114c499b1eb837026eb196ddd1a18 |
Hashes for nbwipers-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d91d53357a8d4bcaeafb94c981cd19cfe1b50090a1de37e77b969df5b94779 |
|
MD5 | ba297d36d5b08838a8d8537588f3c928 |
|
BLAKE2b-256 | 689380f10493f8c6d1e0e3546562fc346e01017b7b8348262f4079dcfc1c1c01 |
Hashes for nbwipers-0.1.0-py3-none-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f613dc0da9eb966c33a8351fecce21be59123b70f1c27de1ce70cc6bd05482ea |
|
MD5 | f0f131763078f3f4b5f3b825b2208931 |
|
BLAKE2b-256 | 06e5caeae7cbf4a88c31db79f71e612bdeaa03a72811b10fc15be5f5c1b1cb5b |