Skip to main content

A library for cleaning jupyter notebooks real good

Project description

nbcleanse 🚿

A notebook cleaner to end all notebook cleaners

What?

It's a script that cleans notebooks of "redundant components" like metadata/output and etc.

Why?

Because notebooks ARE code and whatever goes into your codebase should be as lean as possible.
Many IDEs which implement a notebook inteface (VScode, Jetbrains and etc.) add data to notebooks files in order to provide some functionalities. And that's a problem:

It makes code reviews more difficult
Notebook outputs clutter file data. Even with services such as reviewNB which allow simpler code reviews on notebook, cell outputs create a lot of false positive code changes.

It is not consistant across IDEs
Different IDEs can override the same settings causign unexpected behaviour.

It is not consistant across developers
The added settings can contain assumptions about dependencies that are computer-specific (conda environment, package versions). This can create conflicts when others pull the repo.

Why nbcleanse?

Because it's lightweight, configureable and let's you know how many lines of code you've saved your repo - thus making you happy.

OK. How?

First Install:

pip install nbcleanse

Then run:

cd your/notebooks/dir/
nbcleanse

Can it do this or that?

It might! Currently supported features are:

# cleans all metadata from all notebooks in cwd
nbcleanse -m

# cleans all outputs
nbcleanse -o

# cleans all cell execution counts
nbcleanse -e

# quiet mode
nbcleanse -q

# flags are additive
nbcleanse -moeq

It'd be nice if it could do this or the other thing...

Any suggesstions are welcome. Please open an issue or a PR explaining your idea!

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

nbcleanse-0.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

nbcleanse-0.0.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file nbcleanse-0.0.3.tar.gz.

File metadata

  • Download URL: nbcleanse-0.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for nbcleanse-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d98803ebeefad7432fcd1184a9a8613496d89108eeeaf1e4448e46ee10c6e587
MD5 2a783f7057fca5f87ffc5a9109ca8f51
BLAKE2b-256 c4620693b639e4a03972bd3befa80775db186e81bdbdff73c43defe80e39190b

See more details on using hashes here.

Provenance

File details

Details for the file nbcleanse-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: nbcleanse-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for nbcleanse-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc48167fafd5236e784a8281d3afa124f2535a1e63f27c7c32c418bc310ea96d
MD5 54a09aa96d162b7e190fdf479b305ad1
BLAKE2b-256 2cd11367a4c412f8b9a7b00a1ffc14e2a49cdb7b5a37c823f033f3c42d8f27b5

See more details on using hashes here.

Provenance

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