Python SDK
🚧 Under active development · Status: Planned
The API described here is still being designed and is not yet implemented. Interested in contributing or have a requirement? Drop a note in GitHub Issues.
Goal
The Python SDK will provide a chained API aligned with the Node.js TokUIBuilder for generating TokUI DSL strings on a Python backend, paired with SSE streaming to the frontend.
Proposed usage
Draft design only — the final API may change.
python
from tokui import TokUIBuilder
b = TokUIBuilder()
b.card(tt="Card").h2("Content").p("Desc").end()
print(b.to_string())
# [card tt:Card][h2 Content][p Desc][/card]Chunked output for SSE streaming:
python
chunks = b.reset().card(tt="Card").p("Content").end().to_chunks()
for chunk in chunks:
yield chunkScope (aligned with the Node.js version)
- Chained calls: self-closing / containers (
open/end) to_string()one-shot output,to_chunks()chunked list- Auto-closing unclosed containers
- Naming workaround:
row_layout()/col_layout()
Progress
- [ ] Core chained API
- [ ] Auto-close / chunked output
- [ ] Output-parity tests vs Node.js
- [ ] PyPI release
See the Node.js Builder docs for the full feature set.