Metadata-Version: 2.4
Name: swarmauri_tool_jupyterfromdict
Version: 0.9.2.dev2
Summary: A tool that converts a plain dictionary into a NotebookNode object using nbformat, facilitating programmatic notebook creation.
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: swarmauri,tool,jupyterfromdict,converts,plain,dictionary,notebooknode,object,nbformat,facilitating,programmatic,notebook,creation
Author: Jacob Stewart
Author-email: jacob@swarmauri.com
Requires-Python: >=3.10,<3.13
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Natural Language :: English
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Dist: nbformat (>=5.10.4)
Requires-Dist: swarmauri_base
Requires-Dist: swarmauri_core
Requires-Dist: swarmauri_standard
Description-Content-Type: text/markdown

![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)

<p align="center">
    <a href="https://pypi.org/project/swarmauri_tool_jupyterfromdict/">
        <img src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterfromdict" alt="PyPI - Downloads"/></a>
    <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterfromdict/">
        <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterfromdict.svg"/></a>
    <a href="https://pypi.org/project/swarmauri_tool_jupyterfromdict/">
        <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_jupyterfromdict" alt="PyPI - Python Version"/></a>
    <a href="https://pypi.org/project/swarmauri_tool_jupyterfromdict/">
        <img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterfromdict" alt="PyPI - License"/></a>
    <a href="https://pypi.org/project/swarmauri_tool_jupyterfromdict/">
        <img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterfromdict?label=swarmauri_tool_jupyterfromdict&color=green" alt="PyPI - swarmauri_tool_jupyterfromdict"/></a>
</p>

---

# 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

```bash
# pip
pip install swarmauri_tool_jupyterfromdict

# poetry
poetry add swarmauri_tool_jupyterfromdict

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterfromdict
```

## Quickstart

```python
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](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.

