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.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jupyterclearcheck-0.2.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.1 CPython/3.10.12 Linux/6.8.0-1014-azure

File hashes

Hashes for jupyterclearcheck-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dada5bc8a531bdae9ccd6c6939c63bc13c3f8c0f209a7a3633fca32d3f9e07f4
MD5 a942ac97c64e922069de6233cdf4d9cd
BLAKE2b-256 b5940c93df220594a7647377ce04eaf4ec4d43acaa5fa22cea052cb26ecaddef

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jupyterclearcheck-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd72e727b232cc4a863c43d4a07ae93434d2dd10947f30422eeb93faad738a19
MD5 e7310b94e4230df683c0f9a5f33b98d9
BLAKE2b-256 7918bb1f1c78100fdbc44f0965952890c3060b7842b07e1de56d516a4754a393

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