Skip to main content

A tool that converts a plain dictionary into a NotebookNode object using nbformat, facilitating programmatic notebook creation.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterfromdict


Swarmauri Tool Jupyter From Dict

Creates a validated Jupyter NotebookNode from a Python dictionary using nbformat.

Features

  • Validates notebook structure against nbformat schema.
  • Returns {"notebook_node": ...} on success or {"error": ...} when conversion fails.
  • Useful for programmatically building notebooks before executing/exporting them with other Swarmauri tools.

Prerequisites

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

Installation

# pip
pip install swarmauri_tool_jupyterfromdict

# poetry
poetry add swarmauri_tool_jupyterfromdict

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterfromdict

Quickstart

import json
from swarmauri_tool_jupyterfromdict import JupyterFromDictTool

notebook_dict = {
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {},
    "cells": [
        {
            "cell_type": "markdown",
            "metadata": {},
            "source": ["# Hello World\n", "This is a generated notebook."],
        }
    ],
}

result = JupyterFromDictTool()(notebook_dict)
if "notebook_node" in result:
    print("NotebookNode ready", type(result["notebook_node"]))
else:
    print("Error:", result["error"])

Tips

  • Feed the resulting NotebookNode directly into execution/export tools such as JupyterExecuteNotebookTool or nbconvert exporters.
  • Use json.dumps/json.loads if you need to persist or transmit the notebook dictionary before conversion.

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_jupyterfromdict-0.9.0.tar.gz (7.7 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_jupyterfromdict-0.9.0.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterfromdict-0.9.0.tar.gz
  • Upload date:
  • Size: 7.7 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_jupyterfromdict-0.9.0.tar.gz
Algorithm Hash digest
SHA256 1a796e571cb44c8401c48d34346d39da96afbd462d4377a178681372a8cf5410
MD5 aa1bc533c2c3d446aa33bea64f9fe235
BLAKE2b-256 5443199737cb9b035b6e611d6ea9ce12deeef16a322a3f0d92d1676626f6cee9

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterfromdict-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterfromdict-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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_jupyterfromdict-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a23cedf7698c27e492970106ef0a8de8d5c7696eee766c4e5546d8e99324ebf6
MD5 25580984b0e8fadf0a89d2adc8db441a
BLAKE2b-256 3b1dc82242f84bc95b0fbfe3cf2545e5d7b5fe4de1c92e7138911e5ebe4978a1

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