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.dev7.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.2.dev7.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev7.tar.gz
Algorithm Hash digest
SHA256 8153e39f4d93f43009b1102fbf392f19640bae253d2e923524af4353372b12d2
MD5 44624cd7808342351fd8f20ea7a9af54
BLAKE2b-256 e4a894b9b0a05c6e3ba3b211f7f0cfc37ea8375893890aae85b93efb1a0f026f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.9.2.dev7-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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.dev7-py3-none-any.whl
Algorithm Hash digest
SHA256 ae44e54eb181e79299746fdd9da9efae6efd0e6f9d87dd3bd2caec1fa2acc6d2
MD5 2925a8b350d7a85c09c42adfdbb7898a
BLAKE2b-256 4a22a86210c628352d848890ec27704c1550d7e2748ddb8fb8adb63e444a00e0

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