Skip to main content

A tool designed to retrieve messages from the IOPub channel of a Jupyter kernel using jupyter_client, capturing cell outputs and logs.

Project description

Swamauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupytergetiopubmessage


Swarmauri Tool Jupyter Get IO PubMessage

A Python tool designed to retrieve messages from the IOPub channel of a Jupyter kernel using jupyter_client, capturing cell outputs, logging information, and errors.

Installation

To install swarmauri_tool_jupytergetiopubmessage, make sure you have Python 3.10 or later. You can install the latest release from PyPI using:

pip install swarmauri_tool_jupytergetiopubmessage

Verify the installation by opening a Python shell and importing the module:

python

import swarmauri_tool_jupytergetiopubmessage print(swarmauri_tool_jupytergetiopubmessage.version) '0.1.0.dev1'

If you see a valid version number, the package is installed and ready to use.

Usage

Below is a brief example of how to use JupyterGetIOPubMessageTool to capture messages from an active Jupyter kernel. The tool expects the WebSocket URL for the kernel's /api/kernels/{id}/channels endpoint.


Example usage:

from swarmauri_tool_jupytergetiopubmessage import JupyterGetIOPubMessageTool

URL to the running kernel's channels endpoint

channels_url = "ws://localhost:8888/api/kernels/12345/channels"

Initialize and use the tool

tool = JupyterGetIOPubMessageTool() result = tool(channels_url, timeout=3.0)

print("Captured stdout:", result["stdout"]) print("Captured stderr:", result["stderr"]) print("Captured logs:", result["logs"]) print("Execution results:", result["execution_results"]) print("Did timeout occur?:", result["timeout_exceeded"])


This usage example demonstrates how to retrieve stdout messages, stderr messages, logs (including certain non-stream messages), and results from executed cells. The timeout parameter controls how long the tool waits for IOPub messages before returning. If the time is exceeded, "timeout_exceeded" will be True.

Dependencies

• Python 3.10 to 3.13 • websocket-client • jupyter_client • swarmauri_core (for component registration) • swarmauri_base (for the base tool functionality)

Additional development dependencies (e.g., flake8, pytest) are specified in the pyproject.toml file but not required for basic usage.

Building & Testing

This package uses Poetry for its build system. You may use any standard Python tooling to install and test in your environment. See above Installation instructions for installing into your project.


© 2023 Swarmauri. All rights reserved. This project is licensed under the Apache-2.0 License. Use of this tool is governed by the license conditions included in the repository.

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_jupytergetiopubmessage-0.8.0.dev2.tar.gz.

File metadata

File hashes

Hashes for swarmauri_tool_jupytergetiopubmessage-0.8.0.dev2.tar.gz
Algorithm Hash digest
SHA256 aaabc5666ccf88a4a2134bb35b3951e3e359145b35dc60fc23eebb7af4404cd8
MD5 67457cd159195d5c1e7c9e76bb8e7b51
BLAKE2b-256 fe2f95d8b8109859e3811dabcba8d699695747373f9c6a37a2c799c9541f55b4

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupytergetiopubmessage-0.8.0.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_tool_jupytergetiopubmessage-0.8.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 7d94f2f15114ee11329c1518729ce6da73a128cc9ec7785b764ef1eac39a1879
MD5 4a83afff712ac2d626ba6556c622d551
BLAKE2b-256 fd06b2aec31b18192a5cb76e6e018ea84e628173a2a45526e7e0dc9c8abb06e9

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