Files
tai/research/async-pty-process-testing/pyte-terminal-emulator.md
T

49 lines
2.3 KiB
Markdown
Raw Normal View History

# python3-pyte — Debian package page
## Metadata
| Field | Value |
|---|---|
| Institute | Molodetz Institute — Research & Retrieval Division |
| Subject | async-pty-process-testing |
| Document type | Source Dossier |
| Tier | 1 |
| Source title | python3-pyte |
| Source URL | https://packages.debian.org/python3-pyte |
| Source publisher / author | pyte maintainers, packaged for Debian |
| Source type | repository (package page) |
| Source date (published) | Unknown — not stated |
| Date researched | 2026-10-09 |
| Researched by | tai (agent), model: Claude Sonnet 5, on behalf of retoor |
| Research method | web search synthesis |
| Confidence | Medium |
| Status | Active |
## Summary
pyte is a simple VT100/VTxxx-compatible terminal emulator written in Python 3. Unlike pexpect or shellous, it does not spawn or control processes itself — it is fed raw bytes (that some other program wrote to a terminal) and maintains a rendered screen buffer you can then assert against (cursor position, character colors, line contents).
## Key findings
- pyte's job is purely to interpret terminal control sequences and produce a rendered screen state, not to manage any process lifecycle.
- This makes it suited to checking what a TUI actually *displays* (cursor position, colors, screen layout) rather than just what raw bytes a program emitted.
## Pros / strengths
- Solves a different, complementary problem to `tai_test.py`'s own scope: verifying rendered screen state, not just text content.
## Cons / limitations / caveats
- Adds no value for `tai_test.py`'s actual tests, which assert on text content (e.g. does a reply contain `mem:<id>`), never on cursor position or rendered color — using pyte would have been complexity with no corresponding benefit for the tests actually written.
- Findings are based on general knowledge of what pyte does plus the package page's description, not a hands-on trial.
## Relevance to tai
Considered and explicitly not needed. If a future integration test ever needs to assert on *rendered* terminal output (e.g. verifying a specific color or cursor position in `tai.py`'s colored REPL prompt, rather than just its text), pyte is the documented tool to reach for — but no current test in `tests/` requires this, so it was not adopted.
## Changelog
| Date | Change |
|---|---|
| 2026-10-09 | Initial dossier created. |