Skip to main content

A tool that reads a Jupyter Notebook file using nbformat, converting the JSON file into a NotebookNode object.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterreadnotebook


Swarmauri Tool Jupyter Read Notebook

Reads a .ipynb file from disk into a validated nbformat NotebookNode for downstream processing.

Features

  • Wraps nbformat’s read + validation workflow in a Swarmauri tool.
  • Returns { "notebook_node": NotebookNode } on success or { "error": ... } on failure.
  • Optional as_version argument controls notebook parsing version (default 4).

Prerequisites

  • Python 3.10 or newer.
  • nbformat installed (pulled automatically).

Installation

# pip
pip install swarmauri_tool_jupyterreadnotebook

# poetry
poetry add swarmauri_tool_jupyterreadnotebook

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterreadnotebook

Quickstart

from swarmauri_tool_jupyterreadnotebook import JupyterReadNotebookTool

reader = JupyterReadNotebookTool()
response = reader(
    notebook_file_path="notebooks/example.ipynb",
    as_version=4,
)

if "notebook_node" in response:
    nb = response["notebook_node"]
    print("Cells:", len(nb.cells))
else:
    print("Error:", response["error"])

Tips

  • Use with execution/export tools to build pipelines (read → execute → convert).
  • Handle error key gracefully when files are missing or malformed.

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

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_jupyterreadnotebook-0.9.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterreadnotebook-0.9.0.dev1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_jupyterreadnotebook-0.9.0.dev1.tar.gz
Algorithm Hash digest
SHA256 6416e8dd538e93b403637fc9af6b07d32699bb6fd0436acb9dd8a36f11619a50
MD5 d4628995ea2d61148246908c75435018
BLAKE2b-256 893ac06b291a4e4a665de146619e8868acfd0e8cbe9c16ef5672ea22076ecbf9

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterreadnotebook-0.9.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterreadnotebook-0.9.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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_jupyterreadnotebook-0.9.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b92537a1a99a1ee7d4bfb7dca0dcf380a3c5e52f04496ff2ca023fde3ee32d0
MD5 be83f2a46955016b2622ab53912adcbe
BLAKE2b-256 3fbc895246d76a7de5836d503bfcbc983aeda7eb9d55207db2c66fec3ac06aa0

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