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.10.0.dev4.tar.gz.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.10.0.dev4.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.10.0.dev4.tar.gz
Algorithm Hash digest
SHA256 308f04774d501c8ec0a73cc4226f448937140d0d0f3907b3ad77922344b2c6c9
MD5 2e1658df62b6d955a9bcd601ec67f7ac
BLAKE2b-256 9536db5412b9856628c187fae54ec54ae90a6d5116df23edfe2db7e2d1a2fb6e

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupyterexecutecell-0.10.0.dev4-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.10.0.dev4-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.10.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 fced0f4ac207aae51a65f610a2e13700642bfd6b17ca3f4a193ce33041a366ae
MD5 3c9cd201353a7eb01631de59daf160ec
BLAKE2b-256 d32b9cc2072bc9992ab6d070aaf76936fbc05b425a7c2dd6812d7df927937eca

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