polyglot-stream-heal (Python Native PyO3 Extension — PyPI)
Ultra-fast $6.3,\mu\text{s}$ incremental $O(n)$ streaming JSON repair, 14-dialect Mermaid diagram healer, and HTML5 sandbox balancer for LLM token streams ($61.3\times$ faster drop-in alternative to json-repair and partial-json).
- Author: David Charles Michael (
davidchar@gmail.com| ORCID:0009-0007-8679-6941) - License: MIT
- Native Rust Performance in Python: Compiled via
PyO3+maturin(abi3-py39+), delivering $61.3\times$ lower median chunk latency ($6.3,\mu\text{s}$ vs. $386.8,\mu\text{s}$) and $264.2\times$ lower cumulative stream overhead at $32\text{ KB}$ than pure-Pythonjson-repair, while additionally healing nested escaped tool-call JSON strings, 14 Mermaid diagram dialects, HTML5 sandboxes, and wide tables.
1. Installation
pip install -U polyglot-stream-heal
2. How to Implement & Verified Output
Runnable Code Snippet (python3 examples/demo_python.py)
import json
import polyglot_stream_heal as psh
print("=== 1. Stateful Streaming Transducer (Python PyO3) ===")
transducer = psh.IncrementalTransducer(max_table_cols=5, max_chart_bars=10)
stream_chunks = [
"### Telemetry Stream\n```json\n",
'{"service": "router", "active": tru, "p99_ms": 12.',
]
for chunk in stream_chunks:
transducer.push_chunk(chunk)
active_seg = json.loads(transducer.snapshot_active_json())
print("Active Segment Modality:", active_seg["modality"])
print("Healed JSON Content :", active_seg["content"])
print("\n=== 2. Context-Free Mermaid Dyck Node Healing ===")
raw_mermaid = "flowchart TD\n subgraph Shard_A (Primary: US-East)\n N1[Compute O(f(g(x)))] -- rpc --> N2[(Ledger (v2))]"
print(psh.heal_mermaid(raw_mermaid))
Exact Verified Output (examples/VERIFIED_OUTPUT.txt)
=== 1. Stateful Streaming Transducer (Python PyO3) ===
Active Segment Modality: json
Healed JSON Content : {"active":true,"p99_ms":12.0,"service":"router"}
=== 2. Context-Free Mermaid Dyck Node Healing ===
flowchart TD
subgraph sg_Shard_A__Primary__US ["Shard_A (Primary: US-East)"]
N1["Compute O(f(g(x)))"] -->|rpc| N2[("Ledger (v2)")]
end
Metadata
Release files for polyglot-stream-heal 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polyglot_stream_heal-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details for polyglot_stream_heal-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl |
Release files / polyglot_stream_heal-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | polyglot_stream_heal-1.0.0-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 380.3 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
898b543f44f8b12ad75ded1a6fe7118a08bc76fe5c3ad6f73bc26a36b96ef223
|
|
BLAKE2b-256 checksum How to use checksums |
eb50cce5165f79f27f94afbaa75913561bbbb571066c88218ddcbcda37fc180c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Security for polyglot-stream-heal 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.