Skip to main content

Squeaky

✨ Make your Jupyter notebooks squeaky clean ✨

Squeaky removes unwanted changes to your notebooks to make your Git diffs cleaner. Tools like nbdime and ReviewNB are awesome, but can be clunky and difficult to learn. Instead, Squeaky makes it easier to manage notebook diffs with standard Git tools.

Usage

First, install:

pip install squeaky

Then use Squeaky to clean a notebook:

squeaky path/to/notebook(s).ipynb

To check notebooks without modifying them, use the --check flag.

squeaky path/to/notebook.ipynb --check

Squeaky only prints the notebooks that need cleaning. To print every notebook it checks, use the --verbose flag.

squeaky path/to/notebooks/ --check --verbose

Jupyter pre-save hook

You can automatically run your notebooks through Squeaky before saving them by editing your Jupyter config file. First, find the location of your config directory by running

jupyter --config-dir

Your config directory may contain either a jupyter_lab_config.py or a jupyter_server_config.py (if neither exists, create an empty file with either of these names).

⚠️ If you're using Jupyter notebook < 7, then the file will be called jupyter_notebook_config.py.

Then, add the following lines to that config file.

from squeaky import squeaky_clean_hook
c.FileContentsManager.pre_save_hook = squeaky_clean_hook

Pre-commit hook

To use with pre-commit, add the following to your .pre-commit-config.yaml.

repos:
  - repo: local
    hooks:
      - name: Clean notebooks
        id: clean-notebooks
        entry: squeaky --check
        language: python
        files: '(.*?).ipynb$'

Features

  • Reset metadata

    If you're running your notebooks in CI, then you probably don't care about the last environment a notebook was edited in. Squeaky resets notebook metadata to a standard metadata.

  • Minify SVGs

    Setting code image outputs to SVGs makes images look great, but comes with horrendous diffs. Squeaky minifies SVG outputs to a single line, which also reduces file size.

  • Reset IDs in SVG outputs

    SVG outputs have another problem: Randomized IDs in the source. Squeaky re-generates these IDs deterministically using on the cell's unique ID. This means re-running the notebook won't change the output unless the image actually changes.

  • Remove trailing whitespace

    Often missed in markdown (but not in version control), Squeaky removes trailing whitespace from ends of lines and empty lines from ends and beginnings of cells.

  • Remove empty cells

    Squeaky removes empty cells, including that annoying empty code cell at the bottom of every other notebook.

  • Add missing cell IDs

    Cells without IDs now raise a warning in nbformat. Squeaky adds these IDs for you so you don't need to think about it.

Contributing

To install requirements and add pre-commit hooks:

pip install -r requirements-dev.txt
pre-commit install

To run unit tests (also run on commit):

tox

Wishlist

  • Turn off features through config file

Metadata

Release files for squeaky 0.8.0

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

Source distribution (sdist)

Source distribution for squeaky 0.8.0
File Size Uploaded Provenance Actions
squeaky-0.8.0.tar.gz 23.7 kB With provenance Details for squeaky-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for squeaky 0.8.0
File Interpreter ABI Platform Actions
squeaky-0.8.0-py3-none-any.whl Python 3 none any Details for squeaky-0.8.0-py3-none-any.whl

Total release size: 36.5 kB

Release files / squeaky-0.8.0.tar.gz

Download URL squeaky-0.8.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
277fe8ed167cad58f9ee82defd98cf06c9711436d88ea94537bcb03696003164
BLAKE2b-256 checksum
How to use checksums
c99f3d56c6c9d51e8a1bc362afe09b1e3cf38af2f7fb209590545c681e264d69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / squeaky-0.8.0-py3-none-any.whl

Download URL squeaky-0.8.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbaf47099eeb6183ba236fcf2f077d7565a4b2b96fc8291c8ccad878abbd8637
BLAKE2b-256 checksum
How to use checksums
454dcb03af1528ec25d44d597b4e807cd6f1f70692daa553c567870e76bedc9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for squeaky 0.8.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for squeaky-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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.

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