Skip to main content

A tool designed to clear all outputs from a Jupyter Notebook using nbconvert’s ClearOutputPreprocessor, preparing the notebook for sharing or version control.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterclearoutput


Swarmauri Tool Jupyter Clear Output

Removes outputs and execution counts from Jupyter notebooks using a Swarmauri tool wrapper. Ideal for cleaning notebooks before publishing or committing to version control.

Features

  • Clears output arrays from all code cells and resets execution_count to None.
  • Leaves markdown and raw cells untouched.
  • Works with notebooks already loaded into memory (dict/JSON structure).

Prerequisites

  • Python 3.10 or newer.
  • Dependencies: nbconvert, swarmauri_base, swarmauri_standard (installed automatically).

Installation

# pip
pip install swarmauri_tool_jupyterclearoutput

# poetry
poetry add swarmauri_tool_jupyterclearoutput

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterclearoutput

Quickstart

import json
from swarmauri_tool_jupyterclearoutput import JupyterClearOutputTool

notebook_data = json.loads(Path("notebooks/example.ipynb").read_text())

cleaner = JupyterClearOutputTool()
clean_notebook = cleaner(notebook_data)

Path("notebooks/example-clean.ipynb").write_text(json.dumps(clean_notebook, indent=2))

Tips

  • Run this tool before committing notebooks to keep diffs small and avoid leaking secrets in output cells.
  • Combine with Swarmauri pipelines that regenerate notebooks (e.g., parameterized runs) to ensure clean artifacts.
  • For large notebooks, consider streaming to disk rather than loading entirely into memory before clearing.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_tool_jupyterclearoutput-0.9.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_jupyterclearoutput-0.9.2.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterclearoutput-0.9.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterclearoutput-0.9.2.tar.gz
Algorithm Hash digest
SHA256 920aac451a657a707504c9beab7c18420b4b5a7e110769f94155bc2c2a4911a8
MD5 abc6d6f0678354db590b74b6a9d19491
BLAKE2b-256 4ca1b0c703246405828f5bed0fe8065bb590121347136d49b9c3d7e96f1b1800

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterclearoutput-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterclearoutput-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_jupyterclearoutput-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4cc32ef5d215ed49b28da32a9751f2f5206360abca36da534242cb9a45ce98d
MD5 8886bb8973f5bab670f023d2e1c6a471
BLAKE2b-256 71a90914740f1f1992cd30b71bf55caeb3b5f5c0fedd01d8a49d0056bf333bf1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page