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

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.10.0.dev1.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.dev1.tar.gz
Algorithm Hash digest
SHA256 5cc11a3d33ea9e4f2e587d8a69ca03ea78ef54db2b617c668d466c9db1cb5276
MD5 96ede8d2b84cbaafa38a6cc83ee9cda9
BLAKE2b-256 36d71f9ec6587db302fef6bf53c7f39f640ad98b556ad3762f172dc72401e915

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_jupyterexecutecell-0.10.0.dev1-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.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 137f14e055e5aa048497d48aca127c3904d4659ccbc50d897c44ebd639e3eeaa
MD5 4ec4bfa197465d064e719dc6373a759b
BLAKE2b-256 5ffeb6ef455fabe6cb071321aeecf0907773d9d14d092639cae6316dbe0abb2a

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