A tool that converts a plain dictionary into a NotebookNode object using nbformat, facilitating programmatic notebook creation.
Project description
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
NotebookNodedirectly into execution/export tools such asJupyterExecuteNotebookToolor nbconvert exporters. - Use
json.dumps/json.loadsif 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_jupyterfromdict-0.9.0.dev6.tar.gz.
File metadata
- Download URL: swarmauri_tool_jupyterfromdict-0.9.0.dev6.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89b29a7916e418d69764f9e17996e19debd6530c091797716ad7ddee3f5a4b77
|
|
| MD5 |
bc18f8262485245b0713819b5da17003
|
|
| BLAKE2b-256 |
506a3107edebc510d10369c204d867f6eb5fee1d7f961515e3d884f9a11323ae
|
File details
Details for the file swarmauri_tool_jupyterfromdict-0.9.0.dev6-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_jupyterfromdict-0.9.0.dev6-py3-none-any.whl
- Upload date:
- Size: 8.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb7a73b0aa9357e8a96aeee23c4af471bf9c1da16fa0180d0332359bac7f4af
|
|
| MD5 |
ec0cf7aa9f773189a1dfeee293060071
|
|
| BLAKE2b-256 |
e1c71a01a9fddde7b33f1983b175da54af1b48a5524f95ce4f69a7f2ec71e903
|