swarmauri_tool_jupyterexporthtml 0.9.1.dev2__tar.gz → 0.11.0.dev1__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.
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_tool_jupyterexporthtml
3
+ Version: 0.11.0.dev1
4
+ Summary: Swarmauri HTML publishing tool for rendering Jupyter notebooks with nbconvert and optional inline presentation assets.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: jupyter,html export,nbconvert,notebook rendering,notebook publishing,inline css,inline javascript,web notebook,html exporter
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.15
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Framework :: Jupyter
18
+ Classifier: Topic :: Internet :: WWW/HTTP
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
+ Classifier: Topic :: Text Processing :: Markup :: HTML
23
+ Classifier: Programming Language :: Python
24
+ Classifier: Programming Language :: Python :: 3
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Programming Language :: Python :: 3.10
27
+ Classifier: Programming Language :: Python :: 3.11
28
+ Classifier: Programming Language :: Python :: 3.12
29
+ Classifier: Programming Language :: Python :: 3.13
30
+ Classifier: Programming Language :: Python :: 3.14
31
+ Requires-Dist: nbconvert (>=7.16.6)
32
+ Requires-Dist: swarmauri_base
33
+ Requires-Dist: swarmauri_core
34
+ Requires-Dist: swarmauri_standard
35
+ Description-Content-Type: text/markdown
36
+
37
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
38
+
39
+ <p align="center">
40
+ <a href="https://pepy.tech/project/swarmauri_tool_jupyterexporthtml/">
41
+ <img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexporthtml/month" alt="PyPI - Downloads"/></a>
42
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml/">
43
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml.svg"/></a>
44
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
45
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
46
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
47
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexporthtml" alt="PyPI - License"/></a>
48
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
49
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexporthtml?label=swarmauri_tool_jupyterexporthtml&color=green" alt="PyPI - swarmauri_tool_jupyterexporthtml"/></a>
50
+ <a href="https://discord.gg/N4UpBuQv8T">
51
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
52
+
53
+ # Swarmauri Jupyter Export HTML Tool
54
+
55
+ `swarmauri_tool_jupyterexporthtml` converts Jupyter notebook JSON into HTML using `nbconvert.HTMLExporter`, with optional template selection and inline CSS or JavaScript injection.
56
+
57
+ ## Why
58
+
59
+ - Publish notebooks as web-ready HTML artifacts.
60
+ - Apply presentation-specific HTML templates without rewriting notebook content.
61
+ - Add inline CSS or JavaScript for branded notebook presentation workflows.
62
+
63
+ ## Features
64
+
65
+ - Parses notebook JSON into a `NotebookNode`.
66
+ - Exports notebook content through `nbconvert.HTMLExporter`.
67
+ - Supports optional `template_file` overrides.
68
+ - Can inject inline CSS into the document head.
69
+ - Can inject inline JavaScript before the closing body tag.
70
+
71
+ ## FAQ
72
+
73
+ ### What input does this tool accept?
74
+
75
+ It expects a JSON string representing the notebook, not a file path and not a Python dictionary.
76
+
77
+ ### Does it write an HTML file?
78
+
79
+ No. It returns the generated HTML string in `exported_html`.
80
+
81
+ ### When should I use extra CSS or extra JS?
82
+
83
+ Use them when the exported notebook needs lightweight presentation customization without managing a full custom exporter package.
84
+
85
+ ## Installation
86
+
87
+ ```bash
88
+ uv add swarmauri_tool_jupyterexporthtml
89
+ ```
90
+
91
+ ```bash
92
+ pip install swarmauri_tool_jupyterexporthtml
93
+ ```
94
+
95
+ ## Usage
96
+
97
+ ```python
98
+ from swarmauri_tool_jupyterexporthtml import JupyterExportHtmlTool
99
+
100
+ notebook_json = """
101
+ {
102
+ "cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Demo"]}],
103
+ "metadata": {},
104
+ "nbformat": 4,
105
+ "nbformat_minor": 5
106
+ }
107
+ """
108
+
109
+ tool = JupyterExportHtmlTool()
110
+ result = tool(notebook_json=notebook_json)
111
+
112
+ print(result["exported_html"][:200])
113
+ ```
114
+
115
+ ## Examples
116
+
117
+ ### Export HTML with custom CSS
118
+
119
+ ```python
120
+ result = JupyterExportHtmlTool()(
121
+ notebook_json=notebook_json,
122
+ extra_css="body { max-width: 960px; margin: 0 auto; }",
123
+ )
124
+
125
+ html = result["exported_html"]
126
+ ```
127
+
128
+ ### Export HTML with custom JavaScript
129
+
130
+ ```python
131
+ result = JupyterExportHtmlTool()(
132
+ notebook_json=notebook_json,
133
+ extra_js="console.log('Notebook rendered');",
134
+ )
135
+ ```
136
+
137
+ ## Related Packages
138
+
139
+ - [`swarmauri_tool_jupyterexecuteandconvert`](https://pypi.org/project/swarmauri_tool_jupyterexecuteandconvert/)
140
+ - [`swarmauri_tool_jupyterexportmarkdown`](https://pypi.org/project/swarmauri_tool_jupyterexportmarkdown/)
141
+ - [`swarmauri_tool_jupyterexportlatex`](https://pypi.org/project/swarmauri_tool_jupyterexportlatex/)
142
+ - [`swarmauri_tool_jupyterexportpython`](https://pypi.org/project/swarmauri_tool_jupyterexportpython/)
143
+ - [`swarmauri_tool_jupyterexecutenotebook`](https://pypi.org/project/swarmauri_tool_jupyterexecutenotebook/)
144
+
145
+ ## Foundational Swarmauri Packages
146
+
147
+ - [`swarmauri`](https://pypi.org/project/swarmauri/)
148
+ - [`swarmauri_core`](https://pypi.org/project/swarmauri_core/)
149
+ - [`swarmauri_base`](https://pypi.org/project/swarmauri_base/)
150
+ - [`swarmauri_standard`](https://pypi.org/project/swarmauri_standard/)
151
+
152
+ ## More Documentation
153
+
154
+ - [Swarmauri SDK repository](https://github.com/swarmauri/swarmauri-sdk)
155
+ - [nbconvert HTMLExporter docs](https://nbconvert.readthedocs.io/en/latest/usage.html)
156
+ - [Jupyter documentation](https://jupyter.org/documentation)
157
+
@@ -0,0 +1,120 @@
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
+
3
+ <p align="center">
4
+ <a href="https://pepy.tech/project/swarmauri_tool_jupyterexporthtml/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexporthtml/month" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexporthtml" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexporthtml?label=swarmauri_tool_jupyterexporthtml&color=green" alt="PyPI - swarmauri_tool_jupyterexporthtml"/></a>
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
16
+
17
+ # Swarmauri Jupyter Export HTML Tool
18
+
19
+ `swarmauri_tool_jupyterexporthtml` converts Jupyter notebook JSON into HTML using `nbconvert.HTMLExporter`, with optional template selection and inline CSS or JavaScript injection.
20
+
21
+ ## Why
22
+
23
+ - Publish notebooks as web-ready HTML artifacts.
24
+ - Apply presentation-specific HTML templates without rewriting notebook content.
25
+ - Add inline CSS or JavaScript for branded notebook presentation workflows.
26
+
27
+ ## Features
28
+
29
+ - Parses notebook JSON into a `NotebookNode`.
30
+ - Exports notebook content through `nbconvert.HTMLExporter`.
31
+ - Supports optional `template_file` overrides.
32
+ - Can inject inline CSS into the document head.
33
+ - Can inject inline JavaScript before the closing body tag.
34
+
35
+ ## FAQ
36
+
37
+ ### What input does this tool accept?
38
+
39
+ It expects a JSON string representing the notebook, not a file path and not a Python dictionary.
40
+
41
+ ### Does it write an HTML file?
42
+
43
+ No. It returns the generated HTML string in `exported_html`.
44
+
45
+ ### When should I use extra CSS or extra JS?
46
+
47
+ Use them when the exported notebook needs lightweight presentation customization without managing a full custom exporter package.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ uv add swarmauri_tool_jupyterexporthtml
53
+ ```
54
+
55
+ ```bash
56
+ pip install swarmauri_tool_jupyterexporthtml
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ```python
62
+ from swarmauri_tool_jupyterexporthtml import JupyterExportHtmlTool
63
+
64
+ notebook_json = """
65
+ {
66
+ "cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Demo"]}],
67
+ "metadata": {},
68
+ "nbformat": 4,
69
+ "nbformat_minor": 5
70
+ }
71
+ """
72
+
73
+ tool = JupyterExportHtmlTool()
74
+ result = tool(notebook_json=notebook_json)
75
+
76
+ print(result["exported_html"][:200])
77
+ ```
78
+
79
+ ## Examples
80
+
81
+ ### Export HTML with custom CSS
82
+
83
+ ```python
84
+ result = JupyterExportHtmlTool()(
85
+ notebook_json=notebook_json,
86
+ extra_css="body { max-width: 960px; margin: 0 auto; }",
87
+ )
88
+
89
+ html = result["exported_html"]
90
+ ```
91
+
92
+ ### Export HTML with custom JavaScript
93
+
94
+ ```python
95
+ result = JupyterExportHtmlTool()(
96
+ notebook_json=notebook_json,
97
+ extra_js="console.log('Notebook rendered');",
98
+ )
99
+ ```
100
+
101
+ ## Related Packages
102
+
103
+ - [`swarmauri_tool_jupyterexecuteandconvert`](https://pypi.org/project/swarmauri_tool_jupyterexecuteandconvert/)
104
+ - [`swarmauri_tool_jupyterexportmarkdown`](https://pypi.org/project/swarmauri_tool_jupyterexportmarkdown/)
105
+ - [`swarmauri_tool_jupyterexportlatex`](https://pypi.org/project/swarmauri_tool_jupyterexportlatex/)
106
+ - [`swarmauri_tool_jupyterexportpython`](https://pypi.org/project/swarmauri_tool_jupyterexportpython/)
107
+ - [`swarmauri_tool_jupyterexecutenotebook`](https://pypi.org/project/swarmauri_tool_jupyterexecutenotebook/)
108
+
109
+ ## Foundational Swarmauri Packages
110
+
111
+ - [`swarmauri`](https://pypi.org/project/swarmauri/)
112
+ - [`swarmauri_core`](https://pypi.org/project/swarmauri_core/)
113
+ - [`swarmauri_base`](https://pypi.org/project/swarmauri_base/)
114
+ - [`swarmauri_standard`](https://pypi.org/project/swarmauri_standard/)
115
+
116
+ ## More Documentation
117
+
118
+ - [Swarmauri SDK repository](https://github.com/swarmauri/swarmauri-sdk)
119
+ - [nbconvert HTMLExporter docs](https://nbconvert.readthedocs.io/en/latest/usage.html)
120
+ - [Jupyter documentation](https://jupyter.org/documentation)
@@ -1,17 +1,24 @@
1
1
  [project]
2
2
  name = "swarmauri_tool_jupyterexporthtml"
3
- version = "0.9.1.dev2"
4
- description = "A tool that exports a Jupyter Notebook to HTML format using nbconvert’s HTMLExporter, enabling web-based presentation of notebooks."
3
+ version = "0.11.0.dev1"
4
+ description = "Swarmauri HTML publishing tool for rendering Jupyter notebooks with nbconvert and optional inline presentation assets."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
- repository = "http://github.com/swarmauri/swarmauri-sdk/pkgs/community/swarmauri_tool_jupyterexporthtml/"
7
+ repository = "https://github.com/swarmauri/swarmauri-sdk"
8
8
  requires-python = ">=3.10,<3.15"
9
9
  classifiers = [
10
10
  "License :: OSI Approved :: Apache Software License",
11
11
  "Natural Language :: English",
12
12
  "Development Status :: 3 - Alpha",
13
13
  "Intended Audience :: Developers",
14
+ "Intended Audience :: Science/Research",
15
+ "Operating System :: OS Independent",
16
+ "Framework :: Jupyter",
17
+ "Topic :: Internet :: WWW/HTTP",
18
+ "Topic :: Scientific/Engineering",
19
+ "Topic :: Software Development :: Libraries",
14
20
  "Topic :: Software Development :: Libraries :: Application Frameworks",
21
+ "Topic :: Text Processing :: Markup :: HTML",
15
22
  "Programming Language :: Python",
16
23
  "Programming Language :: Python :: 3",
17
24
  "Programming Language :: Python :: 3 :: Only",
@@ -29,27 +36,22 @@ dependencies = [
29
36
  "swarmauri_standard",
30
37
  ]
31
38
  keywords = [
32
- "swarmauri",
33
- "tool",
34
- "jupyterexporthtml",
35
- "exports",
36
39
  "jupyter",
37
- "notebook",
38
- "html",
39
- "format",
40
+ "html export",
40
41
  "nbconvert",
41
- "htmlexporter",
42
- "enabling",
43
- "web",
44
- "based",
45
- "presentation",
46
- "notebooks",
42
+ "notebook rendering",
43
+ "notebook publishing",
44
+ "inline css",
45
+ "inline javascript",
46
+ "web notebook",
47
+ "html exporter",
47
48
  ]
48
49
 
49
50
  [tool.uv.sources]
50
51
  swarmauri_core = { workspace = true }
51
52
  swarmauri_base = { workspace = true }
52
53
  swarmauri_standard = { workspace = true }
54
+ swarmauri_tests_pylicense = { workspace = true }
53
55
 
54
56
  [tool.pytest.ini_options]
55
57
  norecursedirs = ["combined", "scripts"]
@@ -70,6 +72,7 @@ log_cli_level = "INFO"
70
72
  log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
71
73
  log_cli_date_format = "%Y-%m-%d %H:%M:%S"
72
74
  asyncio_default_fixture_loop_scope = "function"
75
+ addopts = "--pylicense-accept-deps=defusedxml,jupyterlab-pygments,jsonschema,jsonschema-specifications,referencing,rpds-py"
73
76
 
74
77
  [project.entry-points.'swarmauri.tools']
75
78
  JupyterExportHtmlTool = "swarmauri_tool_jupyterexporthtml:JupyterExportHtmlTool"
@@ -85,9 +88,10 @@ dev = [
85
88
  "pytest-xdist>=3.6.1",
86
89
  "pytest-json-report>=1.5.0",
87
90
  "python-dotenv",
88
- "requests>=2.32.3",
91
+ "httpx>=0.27",
89
92
  "flake8>=7.0",
90
93
  "pytest-timeout>=2.3.1",
91
94
  "ruff>=0.9.9",
92
95
  "pytest-benchmark>=4.0.0",
96
+ "swarmauri_tests_pylicense",
93
97
  ]
@@ -1,9 +1,12 @@
1
1
  """
2
2
  JupyterExportHtmlTool.py
3
3
 
4
- This module defines the JupyterExportHtmlTool, a component responsible for converting Jupyter
5
- Notebook content into HTML format. The tool leverages nbconvert to generate HTML output and
6
- optionally allows applying a custom HTML template, as well as embedding additional CSS or JS.
4
+ This module defines the JupyterExportHtmlTool, a component responsible for
5
+ converting Jupyter
6
+ Notebook content into HTML format. The tool leverages nbconvert to generate
7
+ HTML output and
8
+ optionally allows applying a custom HTML template, as well as embedding
9
+ additional CSS or JS.
7
10
  Logging is used to record export operations and errors.
8
11
  """
9
12
 
@@ -21,17 +24,21 @@ from swarmauri_base.ComponentBase import ComponentBase
21
24
  @ComponentBase.register_type(ToolBase, "JupyterExportHtmlTool")
22
25
  class JupyterExportHtmlTool(ToolBase):
23
26
  """
24
- JupyterExportHtmlTool is a tool that converts a Jupyter Notebook (provided as a JSON string)
25
- into an HTML document. It supports using a custom template file, as well as optionally
27
+ JupyterExportHtmlTool is a tool that converts a Jupyter Notebook (provided
28
+ as a JSON string)
29
+ into an HTML document. It supports using a custom template file, as well as
30
+ optionally
26
31
  embedding CSS and JS directly into the generated HTML output.
27
32
 
28
33
  Attributes:
29
34
  version (str): The version of the JupyterExportHtmlTool.
30
- parameters (List[Parameter]): A list of parameters that specify the tool's expected inputs
35
+ parameters (List[Parameter]): A list of parameters that specify the
36
+ tool's expected inputs
31
37
  for the conversion process.
32
38
  name (str): The name of the tool.
33
39
  description (str): A brief description of the tool's functionality.
34
- type (Literal["JupyterExportHtmlTool"]): The type identifier for the tool.
40
+ type (Literal["JupyterExportHtmlTool"]): The type identifier for the
41
+ tool.
35
42
  """
36
43
 
37
44
  version: str = "1.0.0"
@@ -40,31 +47,50 @@ class JupyterExportHtmlTool(ToolBase):
40
47
  Parameter(
41
48
  name="notebook_json",
42
49
  input_type="string",
43
- description="A JSON string representation of the Jupyter Notebook to be exported.",
50
+ description=(
51
+ "A JSON string representation of the Jupyter Notebook to "
52
+ "be "
53
+ "exported."
54
+ ),
44
55
  required=True,
45
56
  ),
46
57
  Parameter(
47
58
  name="template_file",
48
59
  input_type="string",
49
- description="Path to an optional nbconvert-compatible template file for custom HTML formatting.",
60
+ description=(
61
+ "Path to an optional nbconvert-compatible template file "
62
+ "for "
63
+ "custom HTML formatting."
64
+ ),
50
65
  required=False,
51
66
  ),
52
67
  Parameter(
53
68
  name="extra_css",
54
69
  input_type="string",
55
- description="Inline CSS to embed into the generated HTML. Inserted within <style> tags in the document head.",
70
+ description=(
71
+ "Inline CSS to embed into the generated HTML. Inserted "
72
+ "within "
73
+ "<style> tags in the document head."
74
+ ),
56
75
  required=False,
57
76
  ),
58
77
  Parameter(
59
78
  name="extra_js",
60
79
  input_type="string",
61
- description="Inline JavaScript to embed into the generated HTML. Inserted within <script> tags in the document head.",
80
+ description=(
81
+ "Inline JavaScript to embed into the generated HTML. "
82
+ "Inserted "
83
+ "within <script> tags in the document head."
84
+ ),
62
85
  required=False,
63
86
  ),
64
87
  ]
65
88
  )
66
89
  name: str = "JupyterExportHtmlTool"
67
- description: str = "Converts Jupyter Notebooks into HTML format with optional custom template, CSS, and JS."
90
+ description: str = (
91
+ "Converts Jupyter Notebooks into HTML format with optional "
92
+ "custom template, CSS, and JS."
93
+ )
68
94
  type: Literal["JupyterExportHtmlTool"] = "JupyterExportHtmlTool"
69
95
 
70
96
  def __call__(
@@ -75,22 +101,32 @@ class JupyterExportHtmlTool(ToolBase):
75
101
  extra_js: Optional[str] = None,
76
102
  ) -> Dict[str, str]:
77
103
  """
78
- Converts a Jupyter Notebook (provided as a JSON string) into HTML format.
104
+ Converts a Jupyter Notebook (provided as a JSON string) into HTML
105
+ format.
79
106
 
80
107
  Args:
81
- notebook_json (str): The JSON string representation of the Jupyter Notebook.
82
- template_file (Optional[str]): An optional nbconvert-compatible template file path.
83
- extra_css (Optional[str]): Inline CSS to be embedded in the generated HTML.
84
- extra_js (Optional[str]): Inline JavaScript to be embedded in the generated HTML.
108
+ notebook_json (str): The JSON string representation of the Jupyter
109
+ Notebook.
110
+ template_file (Optional[str]): An optional nbconvert-compatible
111
+ template file path.
112
+ extra_css (Optional[str]): Inline CSS to be embedded in the
113
+ generated HTML.
114
+ extra_js (Optional[str]): Inline JavaScript to be embedded in the
115
+ generated HTML.
85
116
 
86
117
  Returns:
87
118
  Dict[str, str]: A dictionary containing either:
88
- - "exported_html": The generated HTML as a string, if successful.
89
- - "error": An error message describing any issues encountered during export.
119
+ - "exported_html": The generated HTML as a string, if
120
+ successful.
121
+ - "error": An error message describing any issues encountered
122
+ during export.
90
123
 
91
124
  Example:
92
125
  >>> exporter = JupyterExportHtmlTool()
93
- >>> result = exporter(notebook_json='{"cells":[],"metadata":{}}', template_file=None)
126
+ >>> result = exporter(
127
+ ... notebook_json='{"cells":[],"metadata":{}}',
128
+ ... template_file=None,
129
+ ... )
94
130
  >>> html_output = result.get("exported_html", "")
95
131
  """
96
132
  try:
@@ -1,4 +1,6 @@
1
- from swarmauri_tool_jupyterexporthtml.JupyterExportHtmlTool import JupyterExportHtmlTool
1
+ from swarmauri_tool_jupyterexporthtml.JupyterExportHtmlTool import (
2
+ JupyterExportHtmlTool,
3
+ )
2
4
 
3
5
 
4
6
  __all__ = ["JupyterExportHtmlTool"]
@@ -1,107 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_tool_jupyterexporthtml
3
- Version: 0.9.1.dev2
4
- Summary: A tool that exports a Jupyter Notebook to HTML format using nbconvert’s HTMLExporter, enabling web-based presentation of notebooks.
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,tool,jupyterexporthtml,exports,jupyter,notebook,html,format,nbconvert,htmlexporter,enabling,web,based,presentation,notebooks
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.15
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Natural Language :: English
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
16
- Classifier: Programming Language :: Python
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Programming Language :: Python :: 3.10
20
- Classifier: Programming Language :: Python :: 3.11
21
- Classifier: Programming Language :: Python :: 3.12
22
- Classifier: Programming Language :: Python :: 3.13
23
- Classifier: Programming Language :: Python :: 3.14
24
- Requires-Dist: nbconvert (>=7.16.6)
25
- Requires-Dist: swarmauri_base
26
- Requires-Dist: swarmauri_core
27
- Requires-Dist: swarmauri_standard
28
- Description-Content-Type: text/markdown
29
-
30
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
31
-
32
- <p align="center">
33
- <a href="https://pepy.tech/project/swarmauri_tool_jupyterexporthtml/">
34
- <img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexporthtml/month" alt="PyPI - Downloads"/></a>
35
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml/">
36
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml.svg"/></a>
37
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
38
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
39
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
40
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexporthtml" alt="PyPI - License"/></a>
41
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
42
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexporthtml?label=swarmauri_tool_jupyterexporthtml&color=green" alt="PyPI - swarmauri_tool_jupyterexporthtml"/></a>
43
- </p>
44
- ---
45
-
46
- # Swarmauri Tool Jupyter Export HTML
47
-
48
- Converts a Jupyter notebook (passed in as JSON) to HTML using nbconvert’s `HTMLExporter` with optional custom templates, CSS, and JavaScript.
49
-
50
- ## Features
51
-
52
- - Accepts notebook data as a JSON string (e.g., from `json.dumps(nbformat.read(...))`).
53
- - Supports optional template, inline CSS, and inline JS injection.
54
- - Returns a dict containing `exported_html` or `error` when conversion fails.
55
-
56
- ## Prerequisites
57
-
58
- - Python 3.10 or newer.
59
- - `nbconvert`, `nbformat`, and Swarmauri base/core packages (installed automatically).
60
-
61
- ## Installation
62
-
63
- ```bash
64
- # pip
65
- pip install swarmauri_tool_jupyterexporthtml
66
-
67
- # poetry
68
- poetry add swarmauri_tool_jupyterexporthtml
69
-
70
- # uv (pyproject-based projects)
71
- uv add swarmauri_tool_jupyterexporthtml
72
- ```
73
-
74
- ## Quickstart
75
-
76
- ```python
77
- import json
78
- import nbformat
79
- from swarmauri_tool_jupyterexporthtml import JupyterExportHTMLTool
80
-
81
- notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
82
- notebook_json = json.dumps(notebook)
83
-
84
- exporter = JupyterExportHTMLTool()
85
- response = exporter(
86
- notebook_json=notebook_json,
87
- template_file=None,
88
- extra_css="body { font-family: Arial; }",
89
- extra_js="console.log('Export complete');",
90
- )
91
-
92
- if "exported_html" in response:
93
- Path("notebooks/example.html").write_text(response["exported_html"], encoding="utf-8")
94
- else:
95
- print("Error:", response["error"])
96
- ```
97
-
98
- ## Tips
99
-
100
- - nbconvert templates let you customize the layout; pass a `.tpl` file to `template_file`.
101
- - Keep `extra_css`/`extra_js` lightweight to avoid bloating the HTML output.
102
- - Combine with notebook execution tools (execute → export → publish) for end-to-end pipelines.
103
-
104
- ## Want to help?
105
-
106
- 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.
107
-
@@ -1,77 +0,0 @@
1
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
2
-
3
- <p align="center">
4
- <a href="https://pepy.tech/project/swarmauri_tool_jupyterexporthtml/">
5
- <img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexporthtml/month" alt="PyPI - Downloads"/></a>
6
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml/">
7
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexporthtml.svg"/></a>
8
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
9
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
10
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
11
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexporthtml" alt="PyPI - License"/></a>
12
- <a href="https://pypi.org/project/swarmauri_tool_jupyterexporthtml/">
13
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexporthtml?label=swarmauri_tool_jupyterexporthtml&color=green" alt="PyPI - swarmauri_tool_jupyterexporthtml"/></a>
14
- </p>
15
- ---
16
-
17
- # Swarmauri Tool Jupyter Export HTML
18
-
19
- Converts a Jupyter notebook (passed in as JSON) to HTML using nbconvert’s `HTMLExporter` with optional custom templates, CSS, and JavaScript.
20
-
21
- ## Features
22
-
23
- - Accepts notebook data as a JSON string (e.g., from `json.dumps(nbformat.read(...))`).
24
- - Supports optional template, inline CSS, and inline JS injection.
25
- - Returns a dict containing `exported_html` or `error` when conversion fails.
26
-
27
- ## Prerequisites
28
-
29
- - Python 3.10 or newer.
30
- - `nbconvert`, `nbformat`, and Swarmauri base/core packages (installed automatically).
31
-
32
- ## Installation
33
-
34
- ```bash
35
- # pip
36
- pip install swarmauri_tool_jupyterexporthtml
37
-
38
- # poetry
39
- poetry add swarmauri_tool_jupyterexporthtml
40
-
41
- # uv (pyproject-based projects)
42
- uv add swarmauri_tool_jupyterexporthtml
43
- ```
44
-
45
- ## Quickstart
46
-
47
- ```python
48
- import json
49
- import nbformat
50
- from swarmauri_tool_jupyterexporthtml import JupyterExportHTMLTool
51
-
52
- notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
53
- notebook_json = json.dumps(notebook)
54
-
55
- exporter = JupyterExportHTMLTool()
56
- response = exporter(
57
- notebook_json=notebook_json,
58
- template_file=None,
59
- extra_css="body { font-family: Arial; }",
60
- extra_js="console.log('Export complete');",
61
- )
62
-
63
- if "exported_html" in response:
64
- Path("notebooks/example.html").write_text(response["exported_html"], encoding="utf-8")
65
- else:
66
- print("Error:", response["error"])
67
- ```
68
-
69
- ## Tips
70
-
71
- - nbconvert templates let you customize the layout; pass a `.tpl` file to `template_file`.
72
- - Keep `extra_css`/`extra_js` lightweight to avoid bloating the HTML output.
73
- - Combine with notebook execution tools (execute → export → publish) for end-to-end pipelines.
74
-
75
- ## Want to help?
76
-
77
- 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.