Skip to main content

Swarmauri papermill tool for executing parameterized Jupyter notebooks and writing executed notebook outputs.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexecutenotebookwithparameters Discord

Swarmauri Jupyter Execute Notebook With Parameters Tool

swarmauri_tool_jupyterexecutenotebookwithparameters executes parameterized Jupyter notebooks through papermill, injects runtime parameters, and writes the executed notebook to a target output path.

Why

  • Turn notebooks into repeatable jobs with runtime inputs.
  • Generate environment-specific notebook runs without hand-editing source notebooks.
  • Use papermill-backed parameter injection inside Swarmauri workflows.

Features

  • Executes .ipynb notebooks with papermill.execute_notebook.
  • Injects a dictionary of runtime parameters.
  • Writes results to a caller-provided output notebook path.
  • Validates that both input and output paths are notebook files.
  • Returns either {"executed_notebook": ...} or {"error": ...}.

FAQ

When should I use this package instead of swarmauri_tool_jupyterexecutenotebook?

Use this package when the notebook needs injected parameters and a persisted executed output file. Use swarmauri_tool_jupyterexecutenotebook for direct in-memory execution and a returned NotebookNode.

Does this tool require .ipynb paths?

Yes. Both notebook_path and output_notebook_path must end with .ipynb, or the tool returns an error.

What does the parameter payload look like?

It is a plain Python dictionary that papermill passes into the notebook parameter cell.

Installation

uv add swarmauri_tool_jupyterexecutenotebookwithparameters
pip install swarmauri_tool_jupyterexecutenotebookwithparameters

Usage

from swarmauri_tool_jupyterexecutenotebookwithparameters import (
    JupyterExecuteNotebookWithParametersTool,
)

tool = JupyterExecuteNotebookWithParametersTool()
result = tool(
    notebook_path="templates/report.ipynb",
    output_notebook_path="artifacts/report-executed.ipynb",
    params={"region": "us", "day": "2026-05-24"},
)

print(result)

Examples

Execute a report notebook for a specific tenant

tool = JupyterExecuteNotebookWithParametersTool()

response = tool(
    notebook_path="reports/monthly.ipynb",
    output_notebook_path="artifacts/monthly-acme.ipynb",
    params={"tenant_id": "acme", "month": "2026-05"},
)

print(response["executed_notebook"])

Handle invalid notebook extensions

response = JupyterExecuteNotebookWithParametersTool()(
    notebook_path="reports/monthly.txt",
    output_notebook_path="artifacts/monthly.ipynb",
)

if "error" in response:
    print(response["error"])

Related Packages

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 8.8 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

Hashes for swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 b976ba5381abd319e6fb899a6bfeb0ffaa6238fb6f6e54c4e4d26c315efc4522
MD5 5d29cda0b091b6d091a72fc9db70b3df
BLAKE2b-256 338c4869a4b18fd54d4c0a18a1db2dc50768e3e2e26e2e617b7d42e37f5de4c1

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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

Hashes for swarmauri_tool_jupyterexecutenotebookwithparameters-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b98f604c4fe082d259a064fc74214c89b095d2226666e9ee64bbbe404ae488d4
MD5 1478c810fd559524092fbc55d5ed3c13
BLAKE2b-256 a617b251990d892324a40ef293a011bd7ccc8186970327e3a70d2e6166275e87

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