polyglot-stream-heal (Python Native PyO3 Binding — PyPI)
Sub-millisecond incremental $O(n)$ Hierarchical Multi-Grammar Pushdown Transducer (HM-PDT) for streaming polyglot LLM output healing and cardinality-bounded layout partitioning.
- Author: David Charles Michael (
davidchar@gmail.com) - License: MIT
- Native Rust Performance in Python: Compiled via
PyO3+maturin(abi3-py39+), delivering $34.7\times$ lower median chunk latency ($6.4,\mu\text{s}$ vs. $222.2,\mu\text{s}$) and $267.6\times$ lower cumulative stream overhead at $32\text{ KB}$ than pure-Pythonjson-repair, while additionally healing 14 Mermaid diagram dialects, HTML5 sandboxes, and wide Markdown tables.
1. Installation
pip install polyglot-stream-heal
Or install the pre-built wheel directly from dist/pypi/:
pip install dist/pypi/polyglot_stream_heal-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl
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
3. Publishing to PyPI
Pre-Built Artifact Location
dist/pypi/polyglot_stream_heal-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl
Option A: Automated 1-Command Publish via WSL2 Docker
- Create a PyPI API token at
https://pypi.org/manage/account/token/(begins withpypi-...). - Run from the repository root:
PYPI_API_TOKEN=pypi-your_token_here ./publish_packages.sh --pypi
Option B: Direct CLI Publish (twine or maturin)
python3 -m twine upload dist/pypi/polyglot_stream_heal-0.1.0-*.whl -u __token__ -p <YOUR_PYPI_API_TOKEN>
Metadata
Release files for polyglot-stream-heal 0.1.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-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details for polyglot_stream_heal-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl |
Release files / polyglot_stream_heal-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | polyglot_stream_heal-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 380.1 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
817381257eaab9416c4617051c2aeb919b3d0dec543347ada21722e6b97464b4
|
|
BLAKE2b-256 checksum How to use checksums |
be318b029e1ea13c6fb6b9b8251072379d32205cf7fa71cc9ad0f7119464ba19
|
| 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 0.1.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.