Skip to main content

A tool designed to retrieve shell messages from a running Jupyter kernel using jupyter_client, useful for debugging execution responses.

Project description

Swamauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_jupytergetshellmessage


Swarmauri Tool Jupyter Get Shell Message

A dedicated Python package providing a tool to retrieve shell messages from a running Jupyter kernel using jupyter_client. Built on the swarmauri framework, JupyterGetShellMessageTool is suitable for debugging, logging, and diagnostic purposes.


Installation

To install this package from PyPI, use the following command:

pip install swarmauri_tool_jupytergetshellmessage

If you are using Poetry for dependency management, add it to your project by specifying the package name in your pyproject.toml under [tool.poetry.dependencies]:

[tool.poetry.dependencies]
swarmauri_tool_jupytergetshellmessage = "^0.1.0.dev1"

Once installed, the package automatically brings in its required dependencies: • swarmauri_core
• swarmauri_base
• jupyter_client

No specialized steps beyond a standard Python environment with pip or Poetry are necessary.


Usage

Below is a simple example illustrating how to retrieve shell messages from a currently running Jupyter kernel. Make sure you have an active Jupyter kernel in the environment you are running this code from (for instance, a notebook server launched via "jupyter notebook" or "jupyter lab").

  1. Import JupyterGetShellMessageTool:

    from swarmauri_tool_jupytergetshellmessage import JupyterGetShellMessageTool

  2. Instantiate the tool and call it:

    tool = JupyterGetShellMessageTool() result = tool(timeout=10.0) # Wait up to 10 seconds for shell messages

  3. Inspect the result:

    if "messages" in result: for msg in result["messages"]: print("Shell Message:", msg) else: print("No messages or error:", result.get("error", "No details"))

The tool attempts to connect to the active Jupyter kernel, retrieve available shell messages, and return them in a structured dictionary. If no messages are found within the specified timeout, it returns an error message indicating the timeout event.


Dependencies

• swarmauri_core and swarmauri_base provide the core classes (ComponentBase, ToolBase) for building and integrating tools across the swarmauri ecosystem.
• jupyter_client is leveraged to interface with the running Jupyter kernel, enabling retrieval of shell-based IPC messages.

These dependencies are automatically installed when installing this package via pip or Poetry.


Contributing

Issues and feature requests for swarmauri_tool_jupytergetshellmessage are always welcome. Although direct repository interaction details are not included here, feel free to suggest improvements or report problems using the relevant issue tracker.


© 2023 Swarmauri. Licensed under the Apache License, Version 2.0.
See the LICENSE file for details.

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_jupytergetshellmessage-0.7.4.dev20.tar.gz.

File metadata

File hashes

Hashes for swarmauri_tool_jupytergetshellmessage-0.7.4.dev20.tar.gz
Algorithm Hash digest
SHA256 a906ca6d3c961ab4c79e30462d8218365b498977535f9ad3d3067da4396f98ad
MD5 a7ef9a86b0b84b3c13f91a5069a826f9
BLAKE2b-256 7d973685c4744d8be434d29a2a8f172517a59008515a9dc6418ed8f7f87ec184

See more details on using hashes here.

File details

Details for the file swarmauri_tool_jupytergetshellmessage-0.7.4.dev20-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_tool_jupytergetshellmessage-0.7.4.dev20-py3-none-any.whl
Algorithm Hash digest
SHA256 ae9efb30d32c0a4a4482711955bae0fe513c7f1e7cda74ca32cba3ab4ba55399
MD5 498e7505bb14978b1eb1ffe6a3b21231
BLAKE2b-256 0332fa4b099bd51e86ad07d2a8ac80c9f3cff635a234f304a6e14aab0bcf62f6

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