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.2.dev6.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.2.dev6.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.2.dev6.tar.gz
Algorithm Hash digest
SHA256 6e784ef47b77e127b482d5f299c2457c3dd9f745f0b8c39f271b7080b581045e
MD5 ea9ec316b626c2237947224e6e02161a
BLAKE2b-256 722e2e6eeec180f38e142efce85dbb90c02910f26ce8cb0b506f8e94e127c9c7

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecutecell-0.9.2.dev6-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.2.dev6-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.2.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 d9beca0d5ec91351382320f9893eb5f838e0c85832529a6c2894d039d1dd480b
MD5 3d894cedffcd0c43171b51f86a742a62
BLAKE2b-256 78a38735ee081bc3d6dbef04abf811ee338432fdd15c12f51c7e20cfe83b5808

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