Swarmauri Tool Jupyter Export Python
Exports a Jupyter NotebookNode to a Python script using nbconvert’s PythonExporter with optional custom templates.
Features
- Accepts a notebook object (
nbformat.NotebookNode) and returns the rendered.pysource. - Supports passing an nbconvert template for custom formatting.
- Returns
{"exported_script": ...}on success or{"error": ...}on failure.
Prerequisites
- Python 3.10 or newer.
- nbconvert/nbformat installed (pulled automatically).
Installation
# pip
pip install swarmauri_tool_jupyterexportpython
# poetry
poetry add swarmauri_tool_jupyterexportpython
# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexportpython
Quickstart
import nbformat
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
exporter = JupyterExportPythonTool()
result = exporter(notebook, template_file=None)
if "exported_script" in result:
Path("notebooks/example.py").write_text(result["exported_script"], encoding="utf-8")
else:
print("Error:", result["error"])
Tips
- Use custom templates to control cell separators or code comments—pass a
.tplfile viatemplate_file. - Pair with notebook execution tools (execute → export to .py) to operationalize notebooks as Python scripts.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_tool_jupyterexportpython 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tool_jupyterexportpython-0.10.0.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tool_jupyterexportpython-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.9 kB
Release files / swarmauri_tool_jupyterexportpython-0.10.0.tar.gz
| Download URL | swarmauri_tool_jupyterexportpython-0.10.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8184f173b0a0d79e241fe7dbe2eff84290bd758e4c5ae509fc4a60b643f2a40e
|
|
BLAKE2b-256 checksum How to use checksums |
99830b3c9dd67dee171320e0b92b512fcb4bc2c90f257b561732bb78dfa0b69c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_tool_jupyterexportpython-0.10.0-py3-none-any.whl
| Download URL | swarmauri_tool_jupyterexportpython-0.10.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e86bab44e781a7149f4748b69d326880f2f3afafdf1671b52417b525a412775
|
|
BLAKE2b-256 checksum How to use checksums |
0a8fc6cac44d1cee6c9cef386b4177cd5188b4433bb7e05c7fb9db4517454efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|