Swarmauri notebook-governance tool for validating Jupyter notebook objects against nbformat schema rules.
Project description
Swarmauri Jupyter Validate Notebook Tool
swarmauri_tool_jupytervalidatenotebook validates a notebook object against Jupyter notebook schema rules with nbformat and returns a structured validity report for Swarmauri notebook workflows.
Why
- Catch notebook structure problems before execution or export.
- Add a simple schema-validation gate to notebook automation pipelines.
- Standardize notebook health checks behind a Swarmauri tool contract.
Features
- Accepts notebook objects compatible with
nbformat. - Enforces
nbformat == 4before schema validation. - Validates notebook structure with
nbformat.validate. - Returns
validandreportfields for downstream flow control. - Handles validation and unexpected runtime failures explicitly.
FAQ
What does this tool return?
It returns a dictionary with valid set to "True" or "False" and a human-readable report describing the outcome.
Does this tool accept notebook file paths?
No. It expects a notebook object, not a path and not a JSON string.
Why does it reject notebooks with the wrong nbformat?
The implementation explicitly requires Jupyter notebook format version 4 before calling schema validation.
Installation
uv add swarmauri_tool_jupytervalidatenotebook
pip install swarmauri_tool_jupytervalidatenotebook
Usage
from swarmauri_tool_jupytervalidatenotebook import JupyterValidateNotebookTool
notebook = {
"nbformat": 4,
"nbformat_minor": 5,
"cells": [],
"metadata": {},
}
result = JupyterValidateNotebookTool()(notebook=notebook)
print(result)
Examples
Validate a notebook before execution
validator = JupyterValidateNotebookTool()
result = validator(
notebook={
"nbformat": 4,
"nbformat_minor": 5,
"cells": [],
"metadata": {},
}
)
if result["valid"] == "True":
print("Notebook passed validation")
Detect invalid notebook version
result = JupyterValidateNotebookTool()(
notebook={
"nbformat": 3,
"nbformat_minor": 0,
"cells": [],
"metadata": {},
}
)
print(result["report"])
Related Packages
swarmauri_tool_jupyterfromdictswarmauri_tool_jupyterreadnotebookswarmauri_tool_jupyterwritenotebookswarmauri_tool_jupyterexecutenotebookswarmauri_tool_jupyterclearoutput
Foundational Swarmauri Packages
More Documentation
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_jupytervalidatenotebook-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_tool_jupytervalidatenotebook-0.11.0.dev1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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 |
ab447e8f7cef1adc1bad2df7cf0e8cd08f031e888b766f3225291fd7deef9986
|
|
| MD5 |
270f54a32cf57484cfea0a09da729308
|
|
| BLAKE2b-256 |
4c3079a80167a2cab9924736bc51a51e8a73980c658c64f73286fea737919b45
|
File details
Details for the file swarmauri_tool_jupytervalidatenotebook-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_jupytervalidatenotebook-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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 |
7a7f696597c8b9ec9f595815326d7085731dea7f5b881f01f2946d7716b8fd26
|
|
| MD5 |
072ecab66a75f084925367bed73b3db6
|
|
| BLAKE2b-256 |
6581f2c125745a3bb846e507b8e45cf9e45490658d1dd2102884f41e1709a18d
|