Skip to main content

A tool designed to execute a single code cell in a running Jupyter kernel using jupyter_client, capturing its output and errors.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupyterexecutecell


Swarmauri Tool Jupyter Execute Cell

Executes Python code in the active Jupyter kernel and captures stdout/stderr/errors for downstream tooling.

Features

  • Accepts raw code strings and optionally a timeout.
  • Returns a dict with stdout, stderr, and error keys.
  • Built on jupyter_client to talk to the running kernel.

Prerequisites

  • Python 3.10 or newer.
  • Jupyter kernel running in the environment (IPython/Jupyter installed).

Installation

# pip
pip install swarmauri_tool_jupyterexecutecell

# poetry
poetry add swarmauri_tool_jupyterexecutecell

# uv (pyproject-based projects)
uv add swarmauri_tool_jupyterexecutecell

Quickstart

from swarmauri_tool_jupyterexecutecell import JupyterExecuteCellTool

code = "print('Hello from Swarmauri!')"
result = JupyterExecuteCellTool()(code, timeout=60)

print("stdout:", result["stdout"])
print("stderr:", result["stderr"])
print("error:", result["error"])

Tips

  • Increase timeout for cells that perform long-running tasks.
  • The tool executes in the current kernel—make sure dependencies are already imported/installed in that environment.
  • Handle errors gracefully by checking the error field before using results.

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

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

File details

Details for the file swarmauri_tool_jupyterexecutecell-0.9.3.dev9.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.3.dev9.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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_jupyterexecutecell-0.9.3.dev9.tar.gz
Algorithm Hash digest
SHA256 d565975e31289718fadedc65952b64b91bc35ffa6a88c83cfbec195269d67575
MD5 c6a4cc18c2bcf96071480a6891024b27
BLAKE2b-256 18728ac9490f4a97d4d495d4962a85e59d2227071b1a55c1a2600d49889bc95e

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecutecell-0.9.3.dev9-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.3.dev9-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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_jupyterexecutecell-0.9.3.dev9-py3-none-any.whl
Algorithm Hash digest
SHA256 9e5b94e7c9f07b11f29178c7f059290eb82224f1f7fab521835d98bf8b459fb3
MD5 34e4c76d65c9cd046d2bcdccb0655db7
BLAKE2b-256 2cb113d1848017bc0e95ca803d05958517804c7736d12c1eb6fd1026a3f6ad19

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