swarmauri_tool_jupyterexportpython 0.10.1.dev2__tar.gz → 0.11.0__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_jupyterexportpython-0.11.0/NOTICE +7 -0
- swarmauri_tool_jupyterexportpython-0.11.0/PKG-INFO +406 -0
- swarmauri_tool_jupyterexportpython-0.11.0/README.md +370 -0
- swarmauri_tool_jupyterexportpython-0.11.0/pyproject.toml +144 -0
- {swarmauri_tool_jupyterexportpython-0.10.1.dev2 → swarmauri_tool_jupyterexportpython-0.11.0}/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py +34 -14
- swarmauri_tool_jupyterexportpython-0.10.1.dev2/PKG-INFO +0 -98
- swarmauri_tool_jupyterexportpython-0.10.1.dev2/README.md +0 -68
- swarmauri_tool_jupyterexportpython-0.10.1.dev2/pyproject.toml +0 -91
- {swarmauri_tool_jupyterexportpython-0.10.1.dev2 → swarmauri_tool_jupyterexportpython-0.11.0}/LICENSE +0 -0
- {swarmauri_tool_jupyterexportpython-0.10.1.dev2 → swarmauri_tool_jupyterexportpython-0.11.0}/swarmauri_tool_jupyterexportpython/__init__.py +0 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_tool_jupyterexportpython
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: jupyter,python export,notebook conversion,nbconvert,code extraction,ipynb to py,notebook migration,python exporter
|
|
9
|
+
Author: Jacob Stewart
|
|
10
|
+
Author-email: jacob@swarmauri.com
|
|
11
|
+
Requires-Python: >=3.10,<3.15
|
|
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 :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
22
|
+
Classifier: Programming Language :: Python
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
30
|
+
Requires-Dist: nbconvert (>=7.16.6)
|
|
31
|
+
Requires-Dist: swarmauri_base
|
|
32
|
+
Requires-Dist: swarmauri_core
|
|
33
|
+
Requires-Dist: swarmauri_standard
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# swarmauri_tool_jupyterexportpython
|
|
37
|
+
|
|
38
|
+
<!-- readme-standards:begin branding -->
|
|
39
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
40
|
+
<p align="center"><strong>swarmauri_tool_jupyterexportpython</strong></p>
|
|
41
|
+
<p align="center">Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert.</p>
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/"><img alt="pypi: swarmauri_tool_jupyterexportpython" src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexportpython?labelColor=1E293B&color=1D4ED8"></a>
|
|
44
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.11.0&labelColor=1E293B&color=4338CA"></a>
|
|
45
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
46
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Layer: community" src="https://img.shields.io/static/v1?label=Layer&message=community&labelColor=1E293B&color=6D28D9"></a>
|
|
47
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
48
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
49
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
50
|
+
</p>
|
|
51
|
+
<p align="center">
|
|
52
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/"><img alt="Monthly PyPI downloads: swarmauri_tool_jupyterexportpython" src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterexportpython?labelColor=1E293B&color=0E7490"></a>
|
|
53
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md"><img alt="README hits: swarmauri_tool_jupyterexportpython" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
54
|
+
</p>
|
|
55
|
+
<p align="center">
|
|
56
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
57
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
58
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
59
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
60
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
61
|
+
</p>
|
|
62
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
63
|
+
<!-- readme-standards:end branding -->
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Overview
|
|
68
|
+
|
|
69
|
+
### Summary
|
|
70
|
+
|
|
71
|
+
`swarmauri_tool_jupyterexportpython` converts notebook objects into Python scripts through `nbconvert.PythonExporter`, making it useful for code extraction, audit, and migration workflows.
|
|
72
|
+
|
|
73
|
+
### Why This Package
|
|
74
|
+
|
|
75
|
+
`swarmauri_tool_jupyterexportpython` isolates this responsibility: Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) exposes `JupyterExportPythonTool`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
76
|
+
|
|
77
|
+
### When to Use
|
|
78
|
+
|
|
79
|
+
Choose `swarmauri_tool_jupyterexportpython` when your integration needs swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
83
|
+
- Accepts notebook objects compatible with `nbconvert`.
|
|
84
|
+
- Exports Python source through `nbconvert.PythonExporter`.
|
|
85
|
+
- Supports optional custom templates.
|
|
86
|
+
- Returns the generated script as a string.
|
|
87
|
+
- Returns a structured error payload on export failure.
|
|
88
|
+
|
|
89
|
+
### Non-Goals
|
|
90
|
+
|
|
91
|
+
`swarmauri_tool_jupyterexportpython` owns swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Getting Started
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
|
|
99
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) declares runtime dependencies including `nbconvert`, `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`. Read the example’s inputs and service requirements before execution.
|
|
100
|
+
|
|
101
|
+
### Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
uv add swarmauri_tool_jupyterexportpython
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install swarmauri_tool_jupyterexportpython
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### uv
|
|
112
|
+
|
|
113
|
+
<!-- readme-standards:begin installation.uv -->
|
|
114
|
+
```bash
|
|
115
|
+
uv add swarmauri_tool_jupyterexportpython
|
|
116
|
+
```
|
|
117
|
+
<!-- readme-standards:end installation.uv -->
|
|
118
|
+
|
|
119
|
+
#### pip
|
|
120
|
+
|
|
121
|
+
<!-- readme-standards:begin installation.pip -->
|
|
122
|
+
```bash
|
|
123
|
+
python -m pip install swarmauri_tool_jupyterexportpython
|
|
124
|
+
```
|
|
125
|
+
<!-- readme-standards:end installation.pip -->
|
|
126
|
+
|
|
127
|
+
#### Poetry
|
|
128
|
+
|
|
129
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
130
|
+
```bash
|
|
131
|
+
poetry add swarmauri_tool_jupyterexportpython
|
|
132
|
+
```
|
|
133
|
+
<!-- readme-standards:end installation.poetry -->
|
|
134
|
+
|
|
135
|
+
### Quick Start
|
|
136
|
+
|
|
137
|
+
#### Example
|
|
138
|
+
|
|
139
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
140
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/docs/readme/quick_start.py).
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
144
|
+
|
|
145
|
+
notebook = {
|
|
146
|
+
"cells": [
|
|
147
|
+
{
|
|
148
|
+
"cell_type": "code",
|
|
149
|
+
"metadata": {},
|
|
150
|
+
"source": "print('hello')",
|
|
151
|
+
"outputs": [],
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"metadata": {},
|
|
155
|
+
"nbformat": 4,
|
|
156
|
+
"nbformat_minor": 5,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
160
|
+
print(result["exported_script"])
|
|
161
|
+
```
|
|
162
|
+
<!-- readme-standards:end example.quick-start -->
|
|
163
|
+
|
|
164
|
+
#### Expected Result
|
|
165
|
+
|
|
166
|
+
The example demonstrates the documented `swarmauri_tool_jupyterexportpython` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Usage
|
|
171
|
+
|
|
172
|
+
### Common Workflows
|
|
173
|
+
|
|
174
|
+
<!-- readme-standards:begin example.usage -->
|
|
175
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/docs/readme/usage.py).
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
179
|
+
|
|
180
|
+
notebook = {
|
|
181
|
+
"cells": [
|
|
182
|
+
{
|
|
183
|
+
"cell_type": "code",
|
|
184
|
+
"metadata": {},
|
|
185
|
+
"source": "print('hello')",
|
|
186
|
+
"outputs": [],
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"metadata": {},
|
|
190
|
+
"nbformat": 4,
|
|
191
|
+
"nbformat_minor": 5,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
195
|
+
print(result["exported_script"])
|
|
196
|
+
```
|
|
197
|
+
<!-- readme-standards:end example.usage -->
|
|
198
|
+
|
|
199
|
+
**Export a notebook to Python**
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
203
|
+
script = result["exported_script"]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Export with a custom template**
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
result = JupyterExportPythonTool()(
|
|
210
|
+
notebook=notebook,
|
|
211
|
+
template_file="templates/python-export.tpl",
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Configuration
|
|
216
|
+
|
|
217
|
+
Configure `swarmauri_tool_jupyterexportpython` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
218
|
+
|
|
219
|
+
### Error Handling
|
|
220
|
+
|
|
221
|
+
The inspected `swarmauri_tool_jupyterexportpython` source does not establish a package-wide exception hierarchy. Preserve errors from its declared dependencies and validate inputs using the specific public contract in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py).
|
|
222
|
+
|
|
223
|
+
### Best Practices
|
|
224
|
+
|
|
225
|
+
Use the explicit `swarmauri_tool_jupyterexportpython` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `JupyterExportPythonTool`; an import or successful installation alone does not establish its runtime guarantees.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Package Boundary
|
|
230
|
+
|
|
231
|
+
### What It Owns
|
|
232
|
+
|
|
233
|
+
`swarmauri_tool_jupyterexportpython` is located in `community` and owns swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Source-declared APIs include `JupyterExportPythonTool`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) records its direct dependency boundary.
|
|
234
|
+
|
|
235
|
+
### Public API and Import Surfaces
|
|
236
|
+
|
|
237
|
+
Import namespace: `swarmauri_tool_jupyterexportpython`.
|
|
238
|
+
|
|
239
|
+
Source-declared exports or types: `JupyterExportPythonTool`.
|
|
240
|
+
|
|
241
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
242
|
+
|
|
243
|
+
### Entry Points
|
|
244
|
+
|
|
245
|
+
<!-- readme-standards:begin entry-points -->
|
|
246
|
+
- `swarmauri.tools` → `JupyterExportPythonTool` → `swarmauri_tool_jupyterexportpython:JupyterExportPythonTool`
|
|
247
|
+
<!-- readme-standards:end entry-points -->
|
|
248
|
+
|
|
249
|
+
### Injected Dependencies
|
|
250
|
+
|
|
251
|
+
The direct installation dependencies of `swarmauri_tool_jupyterexportpython` are `nbconvert`, `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py).
|
|
252
|
+
|
|
253
|
+
### Protocol Consumers
|
|
254
|
+
|
|
255
|
+
Direct consumers in this checkout’s package manifests include `swarmauri_toolkit_jupytertoolkit`. These edges describe declared dependencies, not protocol-conformance evidence.
|
|
256
|
+
|
|
257
|
+
### Extensions
|
|
258
|
+
|
|
259
|
+
For `swarmauri_tool_jupyterexportpython`, use the source-declared public interfaces (`JupyterExportPythonTool`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Operations and Readiness
|
|
264
|
+
|
|
265
|
+
### Operational Requirements
|
|
266
|
+
|
|
267
|
+
Operate `swarmauri_tool_jupyterexportpython` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
268
|
+
|
|
269
|
+
### Health and Observability
|
|
270
|
+
|
|
271
|
+
This README does not establish a standalone health endpoint for `swarmauri_tool_jupyterexportpython`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
272
|
+
|
|
273
|
+
### Security and Resource Limits
|
|
274
|
+
|
|
275
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py). The `swarmauri_tool_jupyterexportpython` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
276
|
+
|
|
277
|
+
### Compatibility
|
|
278
|
+
|
|
279
|
+
This source version of `swarmauri_tool_jupyterexportpython` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Verification
|
|
284
|
+
|
|
285
|
+
### Tests
|
|
286
|
+
|
|
287
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_tool_jupyterexportpython` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
288
|
+
|
|
289
|
+
- [tests/unit/test_JupyterExportPythonTool.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_JupyterExportPythonTool.py)
|
|
290
|
+
- [tests/unit/test_JupyterExportPythonTool__init__.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_JupyterExportPythonTool__init__.py)
|
|
291
|
+
|
|
292
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
293
|
+
|
|
294
|
+
### Certification Status
|
|
295
|
+
|
|
296
|
+
No external certification is asserted for `swarmauri_tool_jupyterexportpython` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
297
|
+
|
|
298
|
+
### Evidence
|
|
299
|
+
|
|
300
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## FAQ
|
|
305
|
+
|
|
306
|
+
### Why
|
|
307
|
+
|
|
308
|
+
- Extract runnable Python from notebooks for review or reuse.
|
|
309
|
+
- Bridge notebook prototypes into script-based workflows.
|
|
310
|
+
- Keep notebook-to-script export inside a Swarmauri tool interface.
|
|
311
|
+
|
|
312
|
+
**Does this package write a .py file?**
|
|
313
|
+
|
|
314
|
+
No. It returns the exported script text in `exported_script`.
|
|
315
|
+
|
|
316
|
+
**What kind of input does it expect?**
|
|
317
|
+
|
|
318
|
+
It expects a notebook object, not a file path and not a JSON string.
|
|
319
|
+
|
|
320
|
+
### How
|
|
321
|
+
|
|
322
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_tool_jupyterexportpython`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) for the exact types and signatures involved.
|
|
323
|
+
|
|
324
|
+
### When
|
|
325
|
+
|
|
326
|
+
**When should I use a custom template?**
|
|
327
|
+
|
|
328
|
+
Use a custom template when you need a specific script layout, preamble, or code-cell transformation strategy.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Documentation and Related Packages
|
|
333
|
+
|
|
334
|
+
### More Documentation
|
|
335
|
+
|
|
336
|
+
- [Swarmauri SDK repository](https://github.com/swarmauri/swarmauri-sdk)
|
|
337
|
+
- [nbconvert Python exporter docs](https://nbconvert.readthedocs.io/)
|
|
338
|
+
- [Jupyter documentation](https://jupyter.org/documentation)
|
|
339
|
+
|
|
340
|
+
### Related Packages
|
|
341
|
+
|
|
342
|
+
- [`swarmauri_tool_jupyterexporthtml`](https://pypi.org/project/swarmauri_tool_jupyterexporthtml/)
|
|
343
|
+
- [`swarmauri_tool_jupyterexportmarkdown`](https://pypi.org/project/swarmauri_tool_jupyterexportmarkdown/)
|
|
344
|
+
- [`swarmauri_tool_jupyterexportlatex`](https://pypi.org/project/swarmauri_tool_jupyterexportlatex/)
|
|
345
|
+
- [`swarmauri_tool_jupyterreadnotebook`](https://pypi.org/project/swarmauri_tool_jupyterreadnotebook/)
|
|
346
|
+
- [`swarmauri_tool_jupyterwritenotebook`](https://pypi.org/project/swarmauri_tool_jupyterwritenotebook/)
|
|
347
|
+
|
|
348
|
+
### Project Links
|
|
349
|
+
|
|
350
|
+
<!-- readme-standards:begin project-links -->
|
|
351
|
+
- [pypi: swarmauri_tool_jupyterexportpython](https://pypi.org/project/swarmauri_tool_jupyterexportpython/)
|
|
352
|
+
<!-- readme-standards:end project-links -->
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Contributing
|
|
357
|
+
|
|
358
|
+
### How to Contribute
|
|
359
|
+
|
|
360
|
+
Follow the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) and include a focused example or regression for changes to `swarmauri_tool_jupyterexportpython`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
361
|
+
|
|
362
|
+
### Development Setup
|
|
363
|
+
|
|
364
|
+
Work from the `pkgs/50-community/swarmauri_tool_jupyterexportpython` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
365
|
+
|
|
366
|
+
### Notes for Maintainers
|
|
367
|
+
|
|
368
|
+
**Foundational Swarmauri Packages**
|
|
369
|
+
|
|
370
|
+
- [`swarmauri`](https://pypi.org/project/swarmauri/)
|
|
371
|
+
- [`swarmauri_core`](https://pypi.org/project/swarmauri_core/)
|
|
372
|
+
- [`swarmauri_base`](https://pypi.org/project/swarmauri_base/)
|
|
373
|
+
- [`swarmauri_standard`](https://pypi.org/project/swarmauri_standard/)
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## Governance
|
|
378
|
+
|
|
379
|
+
### Ownership and Decision Making
|
|
380
|
+
|
|
381
|
+
Changes to `swarmauri_tool_jupyterexportpython` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
382
|
+
|
|
383
|
+
### Standards and Policies
|
|
384
|
+
|
|
385
|
+
`swarmauri_tool_jupyterexportpython` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
386
|
+
|
|
387
|
+
### Lifecycle and Migration
|
|
388
|
+
|
|
389
|
+
The `swarmauri_tool_jupyterexportpython` source version is `0.11.0`.
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## License and Attribution
|
|
394
|
+
|
|
395
|
+
### License
|
|
396
|
+
|
|
397
|
+
<!-- readme-standards:begin license -->
|
|
398
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/LICENSE).
|
|
399
|
+
<!-- readme-standards:end license -->
|
|
400
|
+
|
|
401
|
+
### Notices
|
|
402
|
+
|
|
403
|
+
<!-- readme-standards:begin notices -->
|
|
404
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/NOTICE) for attribution.
|
|
405
|
+
<!-- readme-standards:end notices -->
|
|
406
|
+
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# swarmauri_tool_jupyterexportpython
|
|
2
|
+
|
|
3
|
+
<!-- readme-standards:begin branding -->
|
|
4
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
5
|
+
<p align="center"><strong>swarmauri_tool_jupyterexportpython</strong></p>
|
|
6
|
+
<p align="center">Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert.</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/"><img alt="pypi: swarmauri_tool_jupyterexportpython" src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexportpython?labelColor=1E293B&color=1D4ED8"></a>
|
|
9
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.11.0&labelColor=1E293B&color=4338CA"></a>
|
|
10
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
11
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml"><img alt="Layer: community" src="https://img.shields.io/static/v1?label=Layer&message=community&labelColor=1E293B&color=6D28D9"></a>
|
|
12
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
13
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
14
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
15
|
+
</p>
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/"><img alt="Monthly PyPI downloads: swarmauri_tool_jupyterexportpython" src="https://img.shields.io/pypi/dm/swarmauri_tool_jupyterexportpython?labelColor=1E293B&color=0E7490"></a>
|
|
18
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md"><img alt="README hits: swarmauri_tool_jupyterexportpython" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
19
|
+
</p>
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
22
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
23
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
24
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
25
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
26
|
+
</p>
|
|
27
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
28
|
+
<!-- readme-standards:end branding -->
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
### Summary
|
|
35
|
+
|
|
36
|
+
`swarmauri_tool_jupyterexportpython` converts notebook objects into Python scripts through `nbconvert.PythonExporter`, making it useful for code extraction, audit, and migration workflows.
|
|
37
|
+
|
|
38
|
+
### Why This Package
|
|
39
|
+
|
|
40
|
+
`swarmauri_tool_jupyterexportpython` isolates this responsibility: Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) exposes `JupyterExportPythonTool`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
41
|
+
|
|
42
|
+
### When to Use
|
|
43
|
+
|
|
44
|
+
Choose `swarmauri_tool_jupyterexportpython` when your integration needs swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- Accepts notebook objects compatible with `nbconvert`.
|
|
49
|
+
- Exports Python source through `nbconvert.PythonExporter`.
|
|
50
|
+
- Supports optional custom templates.
|
|
51
|
+
- Returns the generated script as a string.
|
|
52
|
+
- Returns a structured error payload on export failure.
|
|
53
|
+
|
|
54
|
+
### Non-Goals
|
|
55
|
+
|
|
56
|
+
`swarmauri_tool_jupyterexportpython` owns swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Getting Started
|
|
61
|
+
|
|
62
|
+
### Prerequisites
|
|
63
|
+
|
|
64
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) declares runtime dependencies including `nbconvert`, `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`. Read the example’s inputs and service requirements before execution.
|
|
65
|
+
|
|
66
|
+
### Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
uv add swarmauri_tool_jupyterexportpython
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install swarmauri_tool_jupyterexportpython
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### uv
|
|
77
|
+
|
|
78
|
+
<!-- readme-standards:begin installation.uv -->
|
|
79
|
+
```bash
|
|
80
|
+
uv add swarmauri_tool_jupyterexportpython
|
|
81
|
+
```
|
|
82
|
+
<!-- readme-standards:end installation.uv -->
|
|
83
|
+
|
|
84
|
+
#### pip
|
|
85
|
+
|
|
86
|
+
<!-- readme-standards:begin installation.pip -->
|
|
87
|
+
```bash
|
|
88
|
+
python -m pip install swarmauri_tool_jupyterexportpython
|
|
89
|
+
```
|
|
90
|
+
<!-- readme-standards:end installation.pip -->
|
|
91
|
+
|
|
92
|
+
#### Poetry
|
|
93
|
+
|
|
94
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
95
|
+
```bash
|
|
96
|
+
poetry add swarmauri_tool_jupyterexportpython
|
|
97
|
+
```
|
|
98
|
+
<!-- readme-standards:end installation.poetry -->
|
|
99
|
+
|
|
100
|
+
### Quick Start
|
|
101
|
+
|
|
102
|
+
#### Example
|
|
103
|
+
|
|
104
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
105
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/docs/readme/quick_start.py).
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
109
|
+
|
|
110
|
+
notebook = {
|
|
111
|
+
"cells": [
|
|
112
|
+
{
|
|
113
|
+
"cell_type": "code",
|
|
114
|
+
"metadata": {},
|
|
115
|
+
"source": "print('hello')",
|
|
116
|
+
"outputs": [],
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"metadata": {},
|
|
120
|
+
"nbformat": 4,
|
|
121
|
+
"nbformat_minor": 5,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
125
|
+
print(result["exported_script"])
|
|
126
|
+
```
|
|
127
|
+
<!-- readme-standards:end example.quick-start -->
|
|
128
|
+
|
|
129
|
+
#### Expected Result
|
|
130
|
+
|
|
131
|
+
The example demonstrates the documented `swarmauri_tool_jupyterexportpython` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Usage
|
|
136
|
+
|
|
137
|
+
### Common Workflows
|
|
138
|
+
|
|
139
|
+
<!-- readme-standards:begin example.usage -->
|
|
140
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/docs/readme/usage.py).
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
144
|
+
|
|
145
|
+
notebook = {
|
|
146
|
+
"cells": [
|
|
147
|
+
{
|
|
148
|
+
"cell_type": "code",
|
|
149
|
+
"metadata": {},
|
|
150
|
+
"source": "print('hello')",
|
|
151
|
+
"outputs": [],
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"metadata": {},
|
|
155
|
+
"nbformat": 4,
|
|
156
|
+
"nbformat_minor": 5,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
160
|
+
print(result["exported_script"])
|
|
161
|
+
```
|
|
162
|
+
<!-- readme-standards:end example.usage -->
|
|
163
|
+
|
|
164
|
+
**Export a notebook to Python**
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
result = JupyterExportPythonTool()(notebook=notebook)
|
|
168
|
+
script = result["exported_script"]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Export with a custom template**
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
result = JupyterExportPythonTool()(
|
|
175
|
+
notebook=notebook,
|
|
176
|
+
template_file="templates/python-export.tpl",
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Configuration
|
|
181
|
+
|
|
182
|
+
Configure `swarmauri_tool_jupyterexportpython` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
183
|
+
|
|
184
|
+
### Error Handling
|
|
185
|
+
|
|
186
|
+
The inspected `swarmauri_tool_jupyterexportpython` source does not establish a package-wide exception hierarchy. Preserve errors from its declared dependencies and validate inputs using the specific public contract in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py).
|
|
187
|
+
|
|
188
|
+
### Best Practices
|
|
189
|
+
|
|
190
|
+
Use the explicit `swarmauri_tool_jupyterexportpython` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `JupyterExportPythonTool`; an import or successful installation alone does not establish its runtime guarantees.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Package Boundary
|
|
195
|
+
|
|
196
|
+
### What It Owns
|
|
197
|
+
|
|
198
|
+
`swarmauri_tool_jupyterexportpython` is located in `community` and owns swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert. Source-declared APIs include `JupyterExportPythonTool`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) records its direct dependency boundary.
|
|
199
|
+
|
|
200
|
+
### Public API and Import Surfaces
|
|
201
|
+
|
|
202
|
+
Import namespace: `swarmauri_tool_jupyterexportpython`.
|
|
203
|
+
|
|
204
|
+
Source-declared exports or types: `JupyterExportPythonTool`.
|
|
205
|
+
|
|
206
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
207
|
+
|
|
208
|
+
### Entry Points
|
|
209
|
+
|
|
210
|
+
<!-- readme-standards:begin entry-points -->
|
|
211
|
+
- `swarmauri.tools` → `JupyterExportPythonTool` → `swarmauri_tool_jupyterexportpython:JupyterExportPythonTool`
|
|
212
|
+
<!-- readme-standards:end entry-points -->
|
|
213
|
+
|
|
214
|
+
### Injected Dependencies
|
|
215
|
+
|
|
216
|
+
The direct installation dependencies of `swarmauri_tool_jupyterexportpython` are `nbconvert`, `swarmauri-core`, `swarmauri-base`, `swarmauri-standard`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py).
|
|
217
|
+
|
|
218
|
+
### Protocol Consumers
|
|
219
|
+
|
|
220
|
+
Direct consumers in this checkout’s package manifests include `swarmauri_toolkit_jupytertoolkit`. These edges describe declared dependencies, not protocol-conformance evidence.
|
|
221
|
+
|
|
222
|
+
### Extensions
|
|
223
|
+
|
|
224
|
+
For `swarmauri_tool_jupyterexportpython`, use the source-declared public interfaces (`JupyterExportPythonTool`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Operations and Readiness
|
|
229
|
+
|
|
230
|
+
### Operational Requirements
|
|
231
|
+
|
|
232
|
+
Operate `swarmauri_tool_jupyterexportpython` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
233
|
+
|
|
234
|
+
### Health and Observability
|
|
235
|
+
|
|
236
|
+
This README does not establish a standalone health endpoint for `swarmauri_tool_jupyterexportpython`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
237
|
+
|
|
238
|
+
### Security and Resource Limits
|
|
239
|
+
|
|
240
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py). The `swarmauri_tool_jupyterexportpython` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
241
|
+
|
|
242
|
+
### Compatibility
|
|
243
|
+
|
|
244
|
+
This source version of `swarmauri_tool_jupyterexportpython` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Verification
|
|
249
|
+
|
|
250
|
+
### Tests
|
|
251
|
+
|
|
252
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_tool_jupyterexportpython` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
253
|
+
|
|
254
|
+
- [tests/unit/test_JupyterExportPythonTool.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_JupyterExportPythonTool.py)
|
|
255
|
+
- [tests/unit/test_JupyterExportPythonTool__init__.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_JupyterExportPythonTool__init__.py)
|
|
256
|
+
|
|
257
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
258
|
+
|
|
259
|
+
### Certification Status
|
|
260
|
+
|
|
261
|
+
No external certification is asserted for `swarmauri_tool_jupyterexportpython` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
262
|
+
|
|
263
|
+
### Evidence
|
|
264
|
+
|
|
265
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## FAQ
|
|
270
|
+
|
|
271
|
+
### Why
|
|
272
|
+
|
|
273
|
+
- Extract runnable Python from notebooks for review or reuse.
|
|
274
|
+
- Bridge notebook prototypes into script-based workflows.
|
|
275
|
+
- Keep notebook-to-script export inside a Swarmauri tool interface.
|
|
276
|
+
|
|
277
|
+
**Does this package write a .py file?**
|
|
278
|
+
|
|
279
|
+
No. It returns the exported script text in `exported_script`.
|
|
280
|
+
|
|
281
|
+
**What kind of input does it expect?**
|
|
282
|
+
|
|
283
|
+
It expects a notebook object, not a file path and not a JSON string.
|
|
284
|
+
|
|
285
|
+
### How
|
|
286
|
+
|
|
287
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_tool_jupyterexportpython`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/swarmauri_tool_jupyterexportpython/JupyterExportPythonTool.py) for the exact types and signatures involved.
|
|
288
|
+
|
|
289
|
+
### When
|
|
290
|
+
|
|
291
|
+
**When should I use a custom template?**
|
|
292
|
+
|
|
293
|
+
Use a custom template when you need a specific script layout, preamble, or code-cell transformation strategy.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Documentation and Related Packages
|
|
298
|
+
|
|
299
|
+
### More Documentation
|
|
300
|
+
|
|
301
|
+
- [Swarmauri SDK repository](https://github.com/swarmauri/swarmauri-sdk)
|
|
302
|
+
- [nbconvert Python exporter docs](https://nbconvert.readthedocs.io/)
|
|
303
|
+
- [Jupyter documentation](https://jupyter.org/documentation)
|
|
304
|
+
|
|
305
|
+
### Related Packages
|
|
306
|
+
|
|
307
|
+
- [`swarmauri_tool_jupyterexporthtml`](https://pypi.org/project/swarmauri_tool_jupyterexporthtml/)
|
|
308
|
+
- [`swarmauri_tool_jupyterexportmarkdown`](https://pypi.org/project/swarmauri_tool_jupyterexportmarkdown/)
|
|
309
|
+
- [`swarmauri_tool_jupyterexportlatex`](https://pypi.org/project/swarmauri_tool_jupyterexportlatex/)
|
|
310
|
+
- [`swarmauri_tool_jupyterreadnotebook`](https://pypi.org/project/swarmauri_tool_jupyterreadnotebook/)
|
|
311
|
+
- [`swarmauri_tool_jupyterwritenotebook`](https://pypi.org/project/swarmauri_tool_jupyterwritenotebook/)
|
|
312
|
+
|
|
313
|
+
### Project Links
|
|
314
|
+
|
|
315
|
+
<!-- readme-standards:begin project-links -->
|
|
316
|
+
- [pypi: swarmauri_tool_jupyterexportpython](https://pypi.org/project/swarmauri_tool_jupyterexportpython/)
|
|
317
|
+
<!-- readme-standards:end project-links -->
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Contributing
|
|
322
|
+
|
|
323
|
+
### How to Contribute
|
|
324
|
+
|
|
325
|
+
Follow the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) and include a focused example or regression for changes to `swarmauri_tool_jupyterexportpython`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
326
|
+
|
|
327
|
+
### Development Setup
|
|
328
|
+
|
|
329
|
+
Work from the `pkgs/50-community/swarmauri_tool_jupyterexportpython` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
330
|
+
|
|
331
|
+
### Notes for Maintainers
|
|
332
|
+
|
|
333
|
+
**Foundational Swarmauri Packages**
|
|
334
|
+
|
|
335
|
+
- [`swarmauri`](https://pypi.org/project/swarmauri/)
|
|
336
|
+
- [`swarmauri_core`](https://pypi.org/project/swarmauri_core/)
|
|
337
|
+
- [`swarmauri_base`](https://pypi.org/project/swarmauri_base/)
|
|
338
|
+
- [`swarmauri_standard`](https://pypi.org/project/swarmauri_standard/)
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Governance
|
|
343
|
+
|
|
344
|
+
### Ownership and Decision Making
|
|
345
|
+
|
|
346
|
+
Changes to `swarmauri_tool_jupyterexportpython` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
347
|
+
|
|
348
|
+
### Standards and Policies
|
|
349
|
+
|
|
350
|
+
`swarmauri_tool_jupyterexportpython` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
351
|
+
|
|
352
|
+
### Lifecycle and Migration
|
|
353
|
+
|
|
354
|
+
The `swarmauri_tool_jupyterexportpython` source version is `0.11.0`.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## License and Attribution
|
|
359
|
+
|
|
360
|
+
### License
|
|
361
|
+
|
|
362
|
+
<!-- readme-standards:begin license -->
|
|
363
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/LICENSE).
|
|
364
|
+
<!-- readme-standards:end license -->
|
|
365
|
+
|
|
366
|
+
### Notices
|
|
367
|
+
|
|
368
|
+
<!-- readme-standards:begin notices -->
|
|
369
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/NOTICE) for attribution.
|
|
370
|
+
<!-- readme-standards:end notices -->
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "swarmauri_tool_jupyterexportpython"
|
|
3
|
+
version = "0.11.0"
|
|
4
|
+
description = "Swarmauri code-extraction tool for converting Jupyter notebooks into Python scripts with nbconvert."
|
|
5
|
+
license = "Apache-2.0"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
repository = "https://github.com/swarmauri/swarmauri-sdk"
|
|
8
|
+
requires-python = ">=3.10,<3.15"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Natural Language :: English",
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Framework :: Jupyter",
|
|
16
|
+
"Topic :: Scientific/Engineering",
|
|
17
|
+
"Topic :: Software Development :: Code Generators",
|
|
18
|
+
"Topic :: Software Development :: Libraries",
|
|
19
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
]
|
|
29
|
+
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"nbconvert>=7.16.6",
|
|
32
|
+
"swarmauri_core",
|
|
33
|
+
"swarmauri_base",
|
|
34
|
+
"swarmauri_standard",
|
|
35
|
+
]
|
|
36
|
+
keywords = [
|
|
37
|
+
"jupyter",
|
|
38
|
+
"python export",
|
|
39
|
+
"notebook conversion",
|
|
40
|
+
"nbconvert",
|
|
41
|
+
"code extraction",
|
|
42
|
+
"ipynb to py",
|
|
43
|
+
"notebook migration",
|
|
44
|
+
"python exporter",
|
|
45
|
+
]
|
|
46
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
47
|
+
|
|
48
|
+
[tool.uv.sources]
|
|
49
|
+
swarmauri_core = { workspace = true }
|
|
50
|
+
swarmauri_base = { workspace = true }
|
|
51
|
+
swarmauri_standard = { workspace = true }
|
|
52
|
+
swarmauri_tests_pylicense = { workspace = true }
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
norecursedirs = ["combined", "scripts"]
|
|
56
|
+
markers = [
|
|
57
|
+
"test: standard test",
|
|
58
|
+
"unit: Unit tests",
|
|
59
|
+
"i9n: Integration tests",
|
|
60
|
+
"r8n: Regression tests",
|
|
61
|
+
"timeout: mark test to timeout after X seconds",
|
|
62
|
+
"xpass: Expected passes",
|
|
63
|
+
"xfail: Expected failures",
|
|
64
|
+
"acceptance: Acceptance tests",
|
|
65
|
+
"perf: Performance tests that measure execution time and resource usage",
|
|
66
|
+
]
|
|
67
|
+
timeout = 300
|
|
68
|
+
log_cli = true
|
|
69
|
+
log_cli_level = "INFO"
|
|
70
|
+
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
71
|
+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
72
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
73
|
+
addopts = "--pylicense-accept-deps=defusedxml,jupyterlab-pygments,jsonschema,jsonschema-specifications,referencing,rpds-py"
|
|
74
|
+
|
|
75
|
+
[tool.readme_standards]
|
|
76
|
+
policy = "package-guide-v1"
|
|
77
|
+
readme = "README.md"
|
|
78
|
+
brand = "swarmauri"
|
|
79
|
+
brand_catalog = "../../../tools/readme/brands.toml"
|
|
80
|
+
repository = "https://github.com/swarmauri/swarmauri-sdk"
|
|
81
|
+
ref = "master"
|
|
82
|
+
package_path = "pkgs/50-community/swarmauri_tool_jupyterexportpython"
|
|
83
|
+
layer = "community"
|
|
84
|
+
lifecycle = "active"
|
|
85
|
+
license_file = "LICENSE"
|
|
86
|
+
notice_file = "NOTICE"
|
|
87
|
+
|
|
88
|
+
[tool.readme_standards.distributions.pypi]
|
|
89
|
+
name = "swarmauri_tool_jupyterexportpython"
|
|
90
|
+
published = true
|
|
91
|
+
|
|
92
|
+
[tool.readme_standards.examples.quick_start]
|
|
93
|
+
source = "docs/readme/quick_start.py"
|
|
94
|
+
test = "tests/unit/test_readme_sources.py"
|
|
95
|
+
language = "python"
|
|
96
|
+
expected_exit_code = 0
|
|
97
|
+
|
|
98
|
+
[tool.readme_standards.examples.usage]
|
|
99
|
+
source = "docs/readme/usage.py"
|
|
100
|
+
test = "tests/unit/test_readme_sources.py"
|
|
101
|
+
language = "python"
|
|
102
|
+
expected_exit_code = 0
|
|
103
|
+
|
|
104
|
+
[tool.readme_standards.statuses.readme]
|
|
105
|
+
label = "CI gate"
|
|
106
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
107
|
+
|
|
108
|
+
[tool.readme_standards.statuses.tests]
|
|
109
|
+
label = "example source"
|
|
110
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/tests/unit/test_readme_sources.py"
|
|
111
|
+
|
|
112
|
+
[tool.readme_standards.statuses.certification]
|
|
113
|
+
label = "not certified"
|
|
114
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_tool_jupyterexportpython/README.md#certification-status"
|
|
115
|
+
|
|
116
|
+
[tool.readme_standards.statuses.governance]
|
|
117
|
+
label = "repository policy"
|
|
118
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
|
|
119
|
+
|
|
120
|
+
[tool.readme_standards.statuses.evidence]
|
|
121
|
+
label = "source and CI"
|
|
122
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
123
|
+
[project.entry-points.'swarmauri.tools']
|
|
124
|
+
JupyterExportPythonTool = "swarmauri_tool_jupyterexportpython:JupyterExportPythonTool"
|
|
125
|
+
|
|
126
|
+
[build-system]
|
|
127
|
+
requires = ["poetry-core>=1.0.0"]
|
|
128
|
+
build-backend = "poetry.core.masonry.api"
|
|
129
|
+
|
|
130
|
+
[dependency-groups]
|
|
131
|
+
dev = [
|
|
132
|
+
"pytest>=8.0",
|
|
133
|
+
"pytest-asyncio>=0.24.0",
|
|
134
|
+
"pytest-xdist>=3.6.1",
|
|
135
|
+
"pytest-json-report>=1.5.0",
|
|
136
|
+
"python-dotenv",
|
|
137
|
+
"httpx>=0.27",
|
|
138
|
+
"flake8>=7.0",
|
|
139
|
+
"pytest-timeout>=2.3.1",
|
|
140
|
+
"ruff>=0.9.9",
|
|
141
|
+
"pytest-benchmark>=4.0.0",
|
|
142
|
+
"swarmauri_tests_pylicense",
|
|
143
|
+
"readme-standards==0.1.3; python_version >= \"3.11\"",
|
|
144
|
+
]
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
2
|
JupyterExportPythonTool.py
|
|
3
3
|
|
|
4
|
-
This module defines the JupyterExportPythonTool, a component that exports a
|
|
5
|
-
|
|
6
|
-
to
|
|
4
|
+
This module defines the JupyterExportPythonTool, a component that exports a
|
|
5
|
+
Jupyter Notebook
|
|
6
|
+
(NotebookNode) to a Python script. It leverages the swarmauri tool architecture
|
|
7
|
+
and nbconvert
|
|
8
|
+
to perform the notebook-to-script conversion, supports optional custom
|
|
9
|
+
templates, and logs
|
|
7
10
|
errors as needed.
|
|
8
11
|
"""
|
|
9
12
|
|
|
@@ -24,16 +27,20 @@ logger = logging.getLogger(__name__)
|
|
|
24
27
|
@ComponentBase.register_type(ToolBase, "JupyterExportPythonTool")
|
|
25
28
|
class JupyterExportPythonTool(ToolBase):
|
|
26
29
|
"""
|
|
27
|
-
JupyterExportPythonTool is a tool that converts a Jupyter Notebook
|
|
28
|
-
|
|
30
|
+
JupyterExportPythonTool is a tool that converts a Jupyter Notebook
|
|
31
|
+
(NotebookNode) into
|
|
32
|
+
a Python script. It supports custom templates for export, logs operations
|
|
33
|
+
and errors,
|
|
29
34
|
and returns the exported Python script as a string.
|
|
30
35
|
|
|
31
36
|
Attributes:
|
|
32
37
|
version (str): The version of the JupyterExportPythonTool.
|
|
33
|
-
parameters (List[Parameter]): A list of parameters required to perform
|
|
38
|
+
parameters (List[Parameter]): A list of parameters required to perform
|
|
39
|
+
the export.
|
|
34
40
|
name (str): The name of the tool.
|
|
35
41
|
description (str): A brief description of the tool's functionality.
|
|
36
|
-
type (Literal["JupyterExportPythonTool"]): The type identifier for the
|
|
42
|
+
type (Literal["JupyterExportPythonTool"]): The type identifier for the
|
|
43
|
+
tool.
|
|
37
44
|
"""
|
|
38
45
|
|
|
39
46
|
version: str = "1.0.0"
|
|
@@ -42,13 +49,21 @@ class JupyterExportPythonTool(ToolBase):
|
|
|
42
49
|
Parameter(
|
|
43
50
|
name="notebook",
|
|
44
51
|
input_type="object",
|
|
45
|
-
description=
|
|
52
|
+
description=(
|
|
53
|
+
"The NotebookNode object representing the Jupyter Notebook " # noqa: E501
|
|
54
|
+
"to "
|
|
55
|
+
"export."
|
|
56
|
+
),
|
|
46
57
|
required=True,
|
|
47
58
|
),
|
|
48
59
|
Parameter(
|
|
49
60
|
name="template_file",
|
|
50
61
|
input_type="string",
|
|
51
|
-
description=
|
|
62
|
+
description=(
|
|
63
|
+
"Optional custom template path for exporting the notebook "
|
|
64
|
+
"to "
|
|
65
|
+
"a Python script."
|
|
66
|
+
),
|
|
52
67
|
required=False,
|
|
53
68
|
),
|
|
54
69
|
]
|
|
@@ -61,17 +76,22 @@ class JupyterExportPythonTool(ToolBase):
|
|
|
61
76
|
self, notebook: NotebookNode, template_file: Optional[str] = None
|
|
62
77
|
) -> Dict[str, Any]:
|
|
63
78
|
"""
|
|
64
|
-
Converts the provided Jupyter Notebook (NotebookNode) to a Python
|
|
65
|
-
|
|
79
|
+
Converts the provided Jupyter Notebook (NotebookNode) to a Python
|
|
80
|
+
script using
|
|
81
|
+
nbconvert. Optionally applies a custom template if template_file is
|
|
82
|
+
provided.
|
|
66
83
|
|
|
67
84
|
Args:
|
|
68
85
|
notebook (NotebookNode): The notebook object to be exported.
|
|
69
|
-
template_file (str, optional): Path to a custom template file to
|
|
86
|
+
template_file (str, optional): Path to a custom template file to
|
|
87
|
+
structure
|
|
70
88
|
the exported Python script.
|
|
71
89
|
|
|
72
90
|
Returns:
|
|
73
|
-
Dict[str, Any]: A dictionary containing either "exported_script"
|
|
74
|
-
|
|
91
|
+
Dict[str, Any]: A dictionary containing either "exported_script"
|
|
92
|
+
with the
|
|
93
|
+
Python code as a string, or an "error" message if
|
|
94
|
+
an exception
|
|
75
95
|
occurred during export.
|
|
76
96
|
|
|
77
97
|
Example:
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: swarmauri_tool_jupyterexportpython
|
|
3
|
-
Version: 0.10.1.dev2
|
|
4
|
-
Summary: A tool that exports a Jupyter Notebook to a Python script using nbconvert’s PythonExporter, facilitating code extraction.
|
|
5
|
-
License-Expression: Apache-2.0
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: swarmauri,tool,jupyterexportpython,exports,jupyter,notebook,script,nbconvert,pythonexporter,facilitating,code,extraction,python
|
|
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
|
-

|
|
31
|
-
|
|
32
|
-
<p align="center">
|
|
33
|
-
<a href="https://pepy.tech/project/swarmauri_tool_jupyterexportpython/">
|
|
34
|
-
<img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexportpython/month" alt="PyPI - Downloads"/></a>
|
|
35
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexportpython/">
|
|
36
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexportpython.svg"/></a>
|
|
37
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/">
|
|
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_jupyterexportpython/">
|
|
40
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexportpython" alt="PyPI - License"/></a>
|
|
41
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/">
|
|
42
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexportpython?label=swarmauri_tool_jupyterexportpython&color=green" alt="PyPI - swarmauri_tool_jupyterexportpython"/></a>
|
|
43
|
-
</p>
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
# Swarmauri Tool Jupyter Export Python
|
|
47
|
-
|
|
48
|
-
Exports a Jupyter `NotebookNode` to a Python script using nbconvert’s `PythonExporter` with optional custom templates.
|
|
49
|
-
|
|
50
|
-
## Features
|
|
51
|
-
|
|
52
|
-
- Accepts a notebook object (`nbformat.NotebookNode`) and returns the rendered `.py` source.
|
|
53
|
-
- Supports passing an nbconvert template for custom formatting.
|
|
54
|
-
- Returns `{"exported_script": ...}` on success or `{"error": ...}` on failure.
|
|
55
|
-
|
|
56
|
-
## Prerequisites
|
|
57
|
-
|
|
58
|
-
- Python 3.10 or newer.
|
|
59
|
-
- nbconvert/nbformat installed (pulled automatically).
|
|
60
|
-
|
|
61
|
-
## Installation
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
# pip
|
|
65
|
-
pip install swarmauri_tool_jupyterexportpython
|
|
66
|
-
|
|
67
|
-
# poetry
|
|
68
|
-
poetry add swarmauri_tool_jupyterexportpython
|
|
69
|
-
|
|
70
|
-
# uv (pyproject-based projects)
|
|
71
|
-
uv add swarmauri_tool_jupyterexportpython
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Quickstart
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
import nbformat
|
|
78
|
-
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
79
|
-
|
|
80
|
-
notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
|
|
81
|
-
exporter = JupyterExportPythonTool()
|
|
82
|
-
result = exporter(notebook, template_file=None)
|
|
83
|
-
|
|
84
|
-
if "exported_script" in result:
|
|
85
|
-
Path("notebooks/example.py").write_text(result["exported_script"], encoding="utf-8")
|
|
86
|
-
else:
|
|
87
|
-
print("Error:", result["error"])
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Tips
|
|
91
|
-
|
|
92
|
-
- Use custom templates to control cell separators or code comments—pass a `.tpl` file via `template_file`.
|
|
93
|
-
- Pair with notebook execution tools (execute → export to .py) to operationalize notebooks as Python scripts.
|
|
94
|
-
|
|
95
|
-
## Want to help?
|
|
96
|
-
|
|
97
|
-
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.
|
|
98
|
-
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://pepy.tech/project/swarmauri_tool_jupyterexportpython/">
|
|
5
|
-
<img src="https://static.pepy.tech/badge/swarmauri_tool_jupyterexportpython/month" alt="PyPI - Downloads"/></a>
|
|
6
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexportpython/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_jupyterexportpython.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/">
|
|
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_jupyterexportpython/">
|
|
11
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_tool_jupyterexportpython" alt="PyPI - License"/></a>
|
|
12
|
-
<a href="https://pypi.org/project/swarmauri_tool_jupyterexportpython/">
|
|
13
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_tool_jupyterexportpython?label=swarmauri_tool_jupyterexportpython&color=green" alt="PyPI - swarmauri_tool_jupyterexportpython"/></a>
|
|
14
|
-
</p>
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Swarmauri Tool Jupyter Export Python
|
|
18
|
-
|
|
19
|
-
Exports a Jupyter `NotebookNode` to a Python script using nbconvert’s `PythonExporter` with optional custom templates.
|
|
20
|
-
|
|
21
|
-
## Features
|
|
22
|
-
|
|
23
|
-
- Accepts a notebook object (`nbformat.NotebookNode`) and returns the rendered `.py` source.
|
|
24
|
-
- Supports passing an nbconvert template for custom formatting.
|
|
25
|
-
- Returns `{"exported_script": ...}` on success or `{"error": ...}` on failure.
|
|
26
|
-
|
|
27
|
-
## Prerequisites
|
|
28
|
-
|
|
29
|
-
- Python 3.10 or newer.
|
|
30
|
-
- nbconvert/nbformat installed (pulled automatically).
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
# pip
|
|
36
|
-
pip install swarmauri_tool_jupyterexportpython
|
|
37
|
-
|
|
38
|
-
# poetry
|
|
39
|
-
poetry add swarmauri_tool_jupyterexportpython
|
|
40
|
-
|
|
41
|
-
# uv (pyproject-based projects)
|
|
42
|
-
uv add swarmauri_tool_jupyterexportpython
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Quickstart
|
|
46
|
-
|
|
47
|
-
```python
|
|
48
|
-
import nbformat
|
|
49
|
-
from swarmauri_tool_jupyterexportpython import JupyterExportPythonTool
|
|
50
|
-
|
|
51
|
-
notebook = nbformat.read("notebooks/example.ipynb", as_version=4)
|
|
52
|
-
exporter = JupyterExportPythonTool()
|
|
53
|
-
result = exporter(notebook, template_file=None)
|
|
54
|
-
|
|
55
|
-
if "exported_script" in result:
|
|
56
|
-
Path("notebooks/example.py").write_text(result["exported_script"], encoding="utf-8")
|
|
57
|
-
else:
|
|
58
|
-
print("Error:", result["error"])
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Tips
|
|
62
|
-
|
|
63
|
-
- Use custom templates to control cell separators or code comments—pass a `.tpl` file via `template_file`.
|
|
64
|
-
- Pair with notebook execution tools (execute → export to .py) to operationalize notebooks as Python scripts.
|
|
65
|
-
|
|
66
|
-
## Want to help?
|
|
67
|
-
|
|
68
|
-
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,91 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "swarmauri_tool_jupyterexportpython"
|
|
3
|
-
version = "0.10.1.dev2"
|
|
4
|
-
description = "A tool that exports a Jupyter Notebook to a Python script using nbconvert’s PythonExporter, facilitating code extraction."
|
|
5
|
-
license = "Apache-2.0"
|
|
6
|
-
readme = "README.md"
|
|
7
|
-
repository = "http://github.com/swarmauri/swarmauri-sdk/pkgs/community/swarmauri_tool_jupyterexportpython/"
|
|
8
|
-
requires-python = ">=3.10,<3.15"
|
|
9
|
-
classifiers = [
|
|
10
|
-
"License :: OSI Approved :: Apache Software License",
|
|
11
|
-
"Natural Language :: English",
|
|
12
|
-
"Development Status :: 3 - Alpha",
|
|
13
|
-
"Intended Audience :: Developers",
|
|
14
|
-
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
15
|
-
"Programming Language :: Python",
|
|
16
|
-
"Programming Language :: Python :: 3",
|
|
17
|
-
"Programming Language :: Python :: 3 :: Only",
|
|
18
|
-
"Programming Language :: Python :: 3.10",
|
|
19
|
-
"Programming Language :: Python :: 3.11",
|
|
20
|
-
"Programming Language :: Python :: 3.12",
|
|
21
|
-
"Programming Language :: Python :: 3.13",
|
|
22
|
-
"Programming Language :: Python :: 3.14",
|
|
23
|
-
]
|
|
24
|
-
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
25
|
-
dependencies = [
|
|
26
|
-
"nbconvert>=7.16.6",
|
|
27
|
-
"swarmauri_core",
|
|
28
|
-
"swarmauri_base",
|
|
29
|
-
"swarmauri_standard",
|
|
30
|
-
]
|
|
31
|
-
keywords = [
|
|
32
|
-
"swarmauri",
|
|
33
|
-
"tool",
|
|
34
|
-
"jupyterexportpython",
|
|
35
|
-
"exports",
|
|
36
|
-
"jupyter",
|
|
37
|
-
"notebook",
|
|
38
|
-
"script",
|
|
39
|
-
"nbconvert",
|
|
40
|
-
"pythonexporter",
|
|
41
|
-
"facilitating",
|
|
42
|
-
"code",
|
|
43
|
-
"extraction",
|
|
44
|
-
"python",
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
[tool.uv.sources]
|
|
48
|
-
swarmauri_core = { workspace = true }
|
|
49
|
-
swarmauri_base = { workspace = true }
|
|
50
|
-
swarmauri_standard = { workspace = true }
|
|
51
|
-
|
|
52
|
-
[tool.pytest.ini_options]
|
|
53
|
-
norecursedirs = ["combined", "scripts"]
|
|
54
|
-
markers = [
|
|
55
|
-
"test: standard test",
|
|
56
|
-
"unit: Unit tests",
|
|
57
|
-
"i9n: Integration tests",
|
|
58
|
-
"r8n: Regression tests",
|
|
59
|
-
"timeout: mark test to timeout after X seconds",
|
|
60
|
-
"xpass: Expected passes",
|
|
61
|
-
"xfail: Expected failures",
|
|
62
|
-
"acceptance: Acceptance tests",
|
|
63
|
-
"perf: Performance tests that measure execution time and resource usage",
|
|
64
|
-
]
|
|
65
|
-
timeout = 300
|
|
66
|
-
log_cli = true
|
|
67
|
-
log_cli_level = "INFO"
|
|
68
|
-
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
69
|
-
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
70
|
-
asyncio_default_fixture_loop_scope = "function"
|
|
71
|
-
|
|
72
|
-
[project.entry-points.'swarmauri.tools']
|
|
73
|
-
JupyterExportPythonTool = "swarmauri_tool_jupyterexportpython:JupyterExportPythonTool"
|
|
74
|
-
|
|
75
|
-
[build-system]
|
|
76
|
-
requires = ["poetry-core>=1.0.0"]
|
|
77
|
-
build-backend = "poetry.core.masonry.api"
|
|
78
|
-
|
|
79
|
-
[dependency-groups]
|
|
80
|
-
dev = [
|
|
81
|
-
"pytest>=8.0",
|
|
82
|
-
"pytest-asyncio>=0.24.0",
|
|
83
|
-
"pytest-xdist>=3.6.1",
|
|
84
|
-
"pytest-json-report>=1.5.0",
|
|
85
|
-
"python-dotenv",
|
|
86
|
-
"requests>=2.32.3",
|
|
87
|
-
"flake8>=7.0",
|
|
88
|
-
"pytest-timeout>=2.3.1",
|
|
89
|
-
"ruff>=0.9.9",
|
|
90
|
-
"pytest-benchmark>=4.0.0",
|
|
91
|
-
]
|
{swarmauri_tool_jupyterexportpython-0.10.1.dev2 → swarmauri_tool_jupyterexportpython-0.11.0}/LICENSE
RENAMED
|
File without changes
|