swarmauri_tool_jupyterdisplayhtml 0.9.0.dev3__tar.gz → 0.9.0.dev21__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21/PKG-INFO +93 -0
- swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21/README.md +67 -0
- {swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3 → swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21}/pyproject.toml +20 -1
- swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3/PKG-INFO +0 -104
- swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3/README.md +0 -84
- {swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3 → swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21}/LICENSE +0 -0
- {swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3 → swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21}/swarmauri_tool_jupyterdisplayhtml/JupyterDisplayHtmlTool.py +0 -0
- {swarmauri_tool_jupyterdisplayhtml-0.9.0.dev3 → swarmauri_tool_jupyterdisplayhtml-0.9.0.dev21}/swarmauri_tool_jupyterdisplayhtml/__init__.py +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_tool_jupyterdisplayhtml
|
|
3
|
+
Version: 0.9.0.dev21
|
|
4
|
+
Summary: A tool designed to render HTML content within a Jupyter Notebook using IPython's HTML display method.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,tool,jupyterdisplayhtml,designed,render,html,content,within,jupyter,notebook,ipython,display,method
|
|
8
|
+
Author: Jacob Stewart
|
|
9
|
+
Author-email: jacob@swarmauri.com
|
|
10
|
+
Requires-Python: >=3.10,<3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Development Status :: 3 - Alpha
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
20
|
+
Requires-Dist: IPython (>=8.32.0)
|
|
21
|
+
Requires-Dist: swarmauri_base
|
|
22
|
+
Requires-Dist: swarmauri_core
|
|
23
|
+
Requires-Dist: swarmauri_standard
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
30
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Downloads"/></a>
|
|
31
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml/">
|
|
32
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml.svg"/></a>
|
|
33
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
34
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Python Version"/></a>
|
|
35
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
36
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - License"/></a>
|
|
37
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
38
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterdisplayhtml?label=swarmauri_tool_jupyterdisplayhtml&color=green" alt="PyPI - swarmauri_tool_jupyterdisplayhtml"/></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Swarmauri Tool Jupyter Display HTML
|
|
44
|
+
|
|
45
|
+
Specialized wrapper for displaying HTML snippets in Jupyter notebooks via IPython's `HTML` display helper.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- Accepts raw HTML strings and renders them inline in Jupyter.
|
|
50
|
+
- Returns status information (`success`/`error`) for integration with larger tool flows.
|
|
51
|
+
- Subclass of `ToolBase`, so it plugs into Swarmauri toolchains seamlessly.
|
|
52
|
+
|
|
53
|
+
## Prerequisites
|
|
54
|
+
|
|
55
|
+
- Python 3.10 or newer.
|
|
56
|
+
- Jupyter/IPython environment with display capabilities.
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# pip
|
|
62
|
+
pip install swarmauri_tool_jupyterdisplayhtml
|
|
63
|
+
|
|
64
|
+
# poetry
|
|
65
|
+
poetry add swarmauri_tool_jupyterdisplayhtml
|
|
66
|
+
|
|
67
|
+
# uv (pyproject-based projects)
|
|
68
|
+
uv add swarmauri_tool_jupyterdisplayhtml
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Quickstart
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from swarmauri_tool_jupyterdisplayhtml import JupyterDisplayHTMLTool
|
|
75
|
+
|
|
76
|
+
tool = JupyterDisplayHTMLTool()
|
|
77
|
+
result = tool("""
|
|
78
|
+
<h2>Swarmauri</h2>
|
|
79
|
+
<p>This HTML was rendered by JupyterDisplayHTMLTool.</p>
|
|
80
|
+
""")
|
|
81
|
+
print(result)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Tips
|
|
85
|
+
|
|
86
|
+
- Wrap the call in Swarmauri agents to surface generated HTML reports or tables.
|
|
87
|
+
- Validate user-provided HTML before rendering to avoid XSS issues in shared notebooks.
|
|
88
|
+
- Combine with other tools that produce HTML (e.g., Folium maps) to display results inline.
|
|
89
|
+
|
|
90
|
+
## Want to help?
|
|
91
|
+
|
|
92
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
93
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
5
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
9
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterdisplayhtml?label=swarmauri_tool_jupyterdisplayhtml&color=green" alt="PyPI - swarmauri_tool_jupyterdisplayhtml"/></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Swarmauri Tool Jupyter Display HTML
|
|
19
|
+
|
|
20
|
+
Specialized wrapper for displaying HTML snippets in Jupyter notebooks via IPython's `HTML` display helper.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Accepts raw HTML strings and renders them inline in Jupyter.
|
|
25
|
+
- Returns status information (`success`/`error`) for integration with larger tool flows.
|
|
26
|
+
- Subclass of `ToolBase`, so it plugs into Swarmauri toolchains seamlessly.
|
|
27
|
+
|
|
28
|
+
## Prerequisites
|
|
29
|
+
|
|
30
|
+
- Python 3.10 or newer.
|
|
31
|
+
- Jupyter/IPython environment with display capabilities.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# pip
|
|
37
|
+
pip install swarmauri_tool_jupyterdisplayhtml
|
|
38
|
+
|
|
39
|
+
# poetry
|
|
40
|
+
poetry add swarmauri_tool_jupyterdisplayhtml
|
|
41
|
+
|
|
42
|
+
# uv (pyproject-based projects)
|
|
43
|
+
uv add swarmauri_tool_jupyterdisplayhtml
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from swarmauri_tool_jupyterdisplayhtml import JupyterDisplayHTMLTool
|
|
50
|
+
|
|
51
|
+
tool = JupyterDisplayHTMLTool()
|
|
52
|
+
result = tool("""
|
|
53
|
+
<h2>Swarmauri</h2>
|
|
54
|
+
<p>This HTML was rendered by JupyterDisplayHTMLTool.</p>
|
|
55
|
+
""")
|
|
56
|
+
print(result)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Tips
|
|
60
|
+
|
|
61
|
+
- Wrap the call in Swarmauri agents to surface generated HTML reports or tables.
|
|
62
|
+
- Validate user-provided HTML before rendering to avoid XSS issues in shared notebooks.
|
|
63
|
+
- Combine with other tools that produce HTML (e.g., Folium maps) to display results inline.
|
|
64
|
+
|
|
65
|
+
## Want to help?
|
|
66
|
+
|
|
67
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_tool_jupyterdisplayhtml"
|
|
3
|
-
version = "0.9.0.
|
|
3
|
+
version = "0.9.0.dev21"
|
|
4
4
|
description = "A tool designed to render HTML content within a Jupyter Notebook using IPython's HTML display method."
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
@@ -12,6 +12,10 @@ classifiers = [
|
|
|
12
12
|
"Programming Language :: Python :: 3.11",
|
|
13
13
|
"Programming Language :: Python :: 3.12",
|
|
14
14
|
"Programming Language :: Python :: 3.13",
|
|
15
|
+
"Natural Language :: English",
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
15
19
|
]
|
|
16
20
|
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
17
21
|
dependencies = [
|
|
@@ -20,6 +24,21 @@ dependencies = [
|
|
|
20
24
|
"swarmauri_base",
|
|
21
25
|
"swarmauri_standard",
|
|
22
26
|
]
|
|
27
|
+
keywords = [
|
|
28
|
+
"swarmauri",
|
|
29
|
+
"tool",
|
|
30
|
+
"jupyterdisplayhtml",
|
|
31
|
+
"designed",
|
|
32
|
+
"render",
|
|
33
|
+
"html",
|
|
34
|
+
"content",
|
|
35
|
+
"within",
|
|
36
|
+
"jupyter",
|
|
37
|
+
"notebook",
|
|
38
|
+
"ipython",
|
|
39
|
+
"display",
|
|
40
|
+
"method",
|
|
41
|
+
]
|
|
23
42
|
|
|
24
43
|
[tool.uv.sources]
|
|
25
44
|
swarmauri_core = { workspace = true }
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_tool_jupyterdisplayhtml
|
|
3
|
-
Version: 0.9.0.dev3
|
|
4
|
-
Summary: A tool designed to render HTML content within a Jupyter Notebook using IPython's HTML display method.
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Author: Jacob Stewart
|
|
7
|
-
Author-email: jacob@swarmauri.com
|
|
8
|
-
Requires-Python: >=3.10,<3.13
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Requires-Dist: IPython (>=8.32.0)
|
|
15
|
-
Requires-Dist: swarmauri_base
|
|
16
|
-
Requires-Dist: swarmauri_core
|
|
17
|
-
Requires-Dist: swarmauri_standard
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-

|
|
22
|
-
|
|
23
|
-
<p align="center">
|
|
24
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
25
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Downloads"/></a>
|
|
26
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml/">
|
|
27
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml.svg"/></a>
|
|
28
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
29
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Python Version"/></a>
|
|
30
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
31
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - License"/></a>
|
|
32
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
33
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterdisplayhtml?label=swarmauri_tool_jupyterdisplayhtml&color=green" alt="PyPI - swarmauri_tool_jupyterdisplayhtml"/></a>
|
|
34
|
-
</p>
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
# Swarmauri Tool Jupyter Display Html
|
|
39
|
-
|
|
40
|
-
A tool designed to render HTML content within a Jupyter Notebook using IPython's HTML display method.
|
|
41
|
-
|
|
42
|
-
## Installation
|
|
43
|
-
|
|
44
|
-
1. Ensure you have Python 3.10 or newer installed.
|
|
45
|
-
2. Install from PyPI using your preferred package manager:
|
|
46
|
-
|
|
47
|
-
• pip:
|
|
48
|
-
pip install swarmauri_tool_jupyterdisplayhtml
|
|
49
|
-
|
|
50
|
-
• Poetry:
|
|
51
|
-
poetry add swarmauri_tool_jupyterdisplayhtml
|
|
52
|
-
|
|
53
|
-
This will pull down all required dependencies, including IPython for HTML display capabilities, and the Swarmauri Core/Base libraries for tool interaction.
|
|
54
|
-
|
|
55
|
-
## Usage
|
|
56
|
-
|
|
57
|
-
Once installed, import the JupyterDisplayHTMLTool class and invoke it to render HTML content in a Jupyter cell. Here is a simple example to get you started:
|
|
58
|
-
|
|
59
|
-
-------------------------------------------------------------------------------------------
|
|
60
|
-
Example usage:
|
|
61
|
-
|
|
62
|
-
from swarmauri_tool_jupyterdisplayhtml import JupyterDisplayHTMLTool
|
|
63
|
-
|
|
64
|
-
def main():
|
|
65
|
-
# Instantiate the tool
|
|
66
|
-
display_tool = JupyterDisplayHTMLTool()
|
|
67
|
-
|
|
68
|
-
# Sample HTML content
|
|
69
|
-
html_snippet = """
|
|
70
|
-
<h1>Hello from Swarmauri!</h1>
|
|
71
|
-
<p>This content is displayed using JupyterDisplayHTMLTool.</p>
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
# Call the tool with the HTML content
|
|
75
|
-
result = display_tool(html_snippet)
|
|
76
|
-
|
|
77
|
-
# The tool returns a dictionary with status and message
|
|
78
|
-
print(f"Status: {result['status']}")
|
|
79
|
-
print(f"Message: {result['message']}")
|
|
80
|
-
|
|
81
|
-
if __name__ == "__main__":
|
|
82
|
-
main()
|
|
83
|
-
-------------------------------------------------------------------------------------------
|
|
84
|
-
|
|
85
|
-
Running this script in a Jupyter Notebook cell will display the HTML heading and paragraph above the cell's output. The command line output after invocation will confirm whether the display was successful or if an error occurred.
|
|
86
|
-
|
|
87
|
-
## Extended Options
|
|
88
|
-
|
|
89
|
-
• Dynamic Updates: You can instantiate the tool once and call it multiple times with different HTML fragments to display updated content in different cells.
|
|
90
|
-
• Integration with Other Tools: Because JupyterDisplayHTMLTool inherits from ToolBase, it integrates cleanly with other Swarmauri-based tools and workflows.
|
|
91
|
-
• Error Handling: If an error occurs while rendering HTML, the returned dictionary will have "status" = "error" and a "message" describing the issue.
|
|
92
|
-
|
|
93
|
-
## Dependencies
|
|
94
|
-
|
|
95
|
-
• swarmauri_core (>=0.6.0.dev1): Provides core mechanics and decorators for registering this tool.
|
|
96
|
-
• swarmauri_base (>=0.6.0.dev1): Supplies the base ToolBase class.
|
|
97
|
-
• IPython: Used to display HTML content in a Jupyter environment.
|
|
98
|
-
|
|
99
|
-
For detailed version requirements, see the "pyproject.toml" file in this project. The code is written following PEP 8 guidelines, uses type hints, and includes docstrings to clarify functionality at every class and method level. Additional logs and comments assist in understanding critical points of the implementation.
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
Use this package to effortlessly render HTML content in a Jupyter environment and integrate the display process within your broader Swarmauri-based ecosystem.
|
|
104
|
-
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-

|
|
3
|
-
|
|
4
|
-
<p align="center">
|
|
5
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
6
|
-
<img src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Downloads"/></a>
|
|
7
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml/">
|
|
8
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterdisplayhtml.svg"/></a>
|
|
9
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
10
|
-
<img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - Python Version"/></a>
|
|
11
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
12
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterdisplayhtml" alt="PyPI - License"/></a>
|
|
13
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterdisplayhtml/">
|
|
14
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterdisplayhtml?label=swarmauri_tool_jupyterdisplayhtml&color=green" alt="PyPI - swarmauri_tool_jupyterdisplayhtml"/></a>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
# Swarmauri Tool Jupyter Display Html
|
|
20
|
-
|
|
21
|
-
A tool designed to render HTML content within a Jupyter Notebook using IPython's HTML display method.
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
1. Ensure you have Python 3.10 or newer installed.
|
|
26
|
-
2. Install from PyPI using your preferred package manager:
|
|
27
|
-
|
|
28
|
-
• pip:
|
|
29
|
-
pip install swarmauri_tool_jupyterdisplayhtml
|
|
30
|
-
|
|
31
|
-
• Poetry:
|
|
32
|
-
poetry add swarmauri_tool_jupyterdisplayhtml
|
|
33
|
-
|
|
34
|
-
This will pull down all required dependencies, including IPython for HTML display capabilities, and the Swarmauri Core/Base libraries for tool interaction.
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
Once installed, import the JupyterDisplayHTMLTool class and invoke it to render HTML content in a Jupyter cell. Here is a simple example to get you started:
|
|
39
|
-
|
|
40
|
-
-------------------------------------------------------------------------------------------
|
|
41
|
-
Example usage:
|
|
42
|
-
|
|
43
|
-
from swarmauri_tool_jupyterdisplayhtml import JupyterDisplayHTMLTool
|
|
44
|
-
|
|
45
|
-
def main():
|
|
46
|
-
# Instantiate the tool
|
|
47
|
-
display_tool = JupyterDisplayHTMLTool()
|
|
48
|
-
|
|
49
|
-
# Sample HTML content
|
|
50
|
-
html_snippet = """
|
|
51
|
-
<h1>Hello from Swarmauri!</h1>
|
|
52
|
-
<p>This content is displayed using JupyterDisplayHTMLTool.</p>
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
# Call the tool with the HTML content
|
|
56
|
-
result = display_tool(html_snippet)
|
|
57
|
-
|
|
58
|
-
# The tool returns a dictionary with status and message
|
|
59
|
-
print(f"Status: {result['status']}")
|
|
60
|
-
print(f"Message: {result['message']}")
|
|
61
|
-
|
|
62
|
-
if __name__ == "__main__":
|
|
63
|
-
main()
|
|
64
|
-
-------------------------------------------------------------------------------------------
|
|
65
|
-
|
|
66
|
-
Running this script in a Jupyter Notebook cell will display the HTML heading and paragraph above the cell's output. The command line output after invocation will confirm whether the display was successful or if an error occurred.
|
|
67
|
-
|
|
68
|
-
## Extended Options
|
|
69
|
-
|
|
70
|
-
• Dynamic Updates: You can instantiate the tool once and call it multiple times with different HTML fragments to display updated content in different cells.
|
|
71
|
-
• Integration with Other Tools: Because JupyterDisplayHTMLTool inherits from ToolBase, it integrates cleanly with other Swarmauri-based tools and workflows.
|
|
72
|
-
• Error Handling: If an error occurs while rendering HTML, the returned dictionary will have "status" = "error" and a "message" describing the issue.
|
|
73
|
-
|
|
74
|
-
## Dependencies
|
|
75
|
-
|
|
76
|
-
• swarmauri_core (>=0.6.0.dev1): Provides core mechanics and decorators for registering this tool.
|
|
77
|
-
• swarmauri_base (>=0.6.0.dev1): Supplies the base ToolBase class.
|
|
78
|
-
• IPython: Used to display HTML content in a Jupyter environment.
|
|
79
|
-
|
|
80
|
-
For detailed version requirements, see the "pyproject.toml" file in this project. The code is written following PEP 8 guidelines, uses type hints, and includes docstrings to clarify functionality at every class and method level. Additional logs and comments assist in understanding critical points of the implementation.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
Use this package to effortlessly render HTML content in a Jupyter environment and integrate the display process within your broader Swarmauri-based ecosystem.
|
|
File without changes
|
|
File without changes
|