Skip to main content

A Python CLI to check that a Jupyter Notebook's Outputs' have been cleared.

Project description

JupyterClearCheck

Build Status License PyPI version

A Python CLI to check that a Jupyter Notebook's Outputs' have been cleared.

Why does this exist?

During the development of a Jupyter Notebook, it is common to run cells multiple times. Every time a cell is run, its output is stored in the .ipynb file format. Because the outputs are saved, this can cause merge conflicts in version control systems like Git when multiple people are working on the same notebook.

nbconvert can be used to clear the outputs of a notebook, but to our knowledge, there was no package to check if the outputs have been cleared. This package aims to fill that gap.

This package can be used in a CI/CD pipeline to ensure that the outputs of a notebook have been cleared before merging a pull request reducing merge conflicts on the outputs of a notebook.

Installation

This package is available on PyPI and can be installed using pip.

pip install JupyterClearCheck

Usage

You can run the command via jupyterclearcheck or python -m jupyterclearcheck.

$ jupyterclearcheck --help

usage: jupyterclearcheck [-h] --notebook NOTEBOOK

Check a Jupyter Notebook for output cells.

options:
  -h, --help           show this help message and exit
  --notebook NOTEBOOK  Path to the Jupyter Notebook file

The notebook parameter is required and should be the path to the Jupyter Notebook file.

Contributing

We welcome contributions! Thank you in advance for your help. Feel free to submit a pull request or open an issue.

Getting Started for Development

We use Python 3.9 and PDM for dependency management. To get started, install Python 3.9 and then install PDM using pip.

pip install pdm

Once this step is done, PDM can be used to run commands related to the development of this package.

  • Install dependencies: pdm install
  • Run linting and formatting: pdm run lint_and_format
  • Checking linting, formatting, and type annotations: pdm run check
  • Run tests: pdm run test
  • Build package: pdm build

Running CI pipeline locally

The CI pipeline can be run locally using the following scripts:

  • Windows: ./build_and_test.sh
  • Linux/MacOS: ./build_and_test.cmd.

Future Work

  • Add shellcheck to lint bash scripts currently in use
  • Add pre-commit hook
  • Add markdown lint
  • Publish on conda-forge

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

jupyterclearcheck-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

jupyterclearcheck-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file jupyterclearcheck-0.2.0.tar.gz.

File metadata

  • Download URL: jupyterclearcheck-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.18.1 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for jupyterclearcheck-0.2.0.tar.gz
Algorithm Hash digest
SHA256 68e0fd81e6aa17ef01ddc42f27365101ef3e70812a41d5154f994dc21a14c6f4
MD5 a537f433648d2fa555e8dc96184b0ed1
BLAKE2b-256 cfdd4c7842b71f83b35ce82f124d6362e57a0135e68aa1c0d0b9f932b40784cd

See more details on using hashes here.

File details

Details for the file jupyterclearcheck-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: jupyterclearcheck-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.18.1 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for jupyterclearcheck-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4aa48729c91f6d6770b5051e2a045cc4c6f22a318cd79cea2f3019fbcf425559
MD5 32c362cc394b09be77b1212108e7700c
BLAKE2b-256 8e0c523ff7c706807b2aff9c1da2fcad7b4f8d4e8d2adb95f64929f87f738cc3

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