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.8.0.dev21.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterreadnotebook-0.8.0.dev21.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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.8.0.dev21.tar.gz
Algorithm Hash digest
SHA256 95422a24237737ed810d5ef9ff599636b502bfb32fcc6babc351ee779ad25141
MD5 6476f6922d8ff4063a245db41b120cc7
BLAKE2b-256 f481b755f2e78389f31ecb3e3b18865635f7cc38093168e19a30b63fa10bb3a0

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterreadnotebook-0.8.0.dev21-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterreadnotebook-0.8.0.dev21-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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.8.0.dev21-py3-none-any.whl
Algorithm Hash digest
SHA256 9989051f1c1dbc3ef8a6cace8621f2594304f26dc5f7fa30a0ab02acbd2075a2
MD5 1d7bed827e8306a56a44daf33cb14518
BLAKE2b-256 907b8ff2143e9e73b74169bd4c9b70ab4e1212ace85337f24c6c5aa532607bef

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