Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

libvt

libvt (pip install libvt, import libvt) is a pure-Python, zero-dependency, typed virtual terminal emulator and streaming VT parser (py3-none-any.whl — no C shared library required).

tests license

Highlights

  • Sans-I/O core: Zero runtime dependencies, zero I/O on import libvt, and no asyncio, pty, or pytest imports until requested.
  • Compact two-tier grid: Lazy 64-bit inline viewport attributes plus run-length-encoded scrollback rows and primary-screen soft-wrap resize reflow.
  • Unicode 17 clustering: Bundled two-stage width and UAX #29 tables handling CJK wide glyphs, ZWJ emoji, Regional Indicator flag pairs, Indic conjuncts, and VS15 / VS16 under DEC ?2027.
  • Modern terminal protocols: Rex OSC 7501 Program Status (with OSC 9;4 fallback), OSC 133 semantic prompt zones, OSC 7 working directory, OSC 8 hyperlinks, OSC 52 clipboard, ?2026 synchronized-output stepping, DECRQM, DECRQSS, XTGETTCAP, and DCS tmux; passthrough events.
  • Mode-aware input & testing: Outbound key/mouse/focus/paste encoding (including Kitty CSI u and fail-closed bracketed paste), libvt.aio stream and controlling-TTY POSIX PTY helpers, vt_* pytest fixtures, and assert_screen / assert_screen_box diffs with FlightRecorder disassembly.

Requirements

  • Python >= 3.12 (CPython and PyPy)
  • Zero runtime dependencies

Installation

Install with uv:

$ uv add libvt

Install with pip:

$ pip install libvt

libvt is pre-1.0; pin a minor range in downstream projects (libvt>=0.1,<0.2).

Quickstart

One-liner helpers render, strip, or disassemble VT byte streams without managing an emulator instance:

>>> import libvt
>>> libvt.render(b"\x1b[1;32mready\x1b[0m\r\nitem 1", rows=4, cols=20)
'ready\nitem 1'
>>> libvt.strip(b"\x1b[31merror:\x1b[0m failed")
'error: failed'

Stateful emulation tracks zero-based (row, col) cells, SGR colon subparameters, query replies, and OSC 7501 program status:

>>> term = libvt.Terminal(rows=4, cols=20)
>>> term.feed(b"\x1b[1;4:3;38:2::40:180:160mstatus\x1b[0m\x1b[6n")
>>> term[0, 0].style.underline
<UnderlineStyle.CURLY: 3>
>>> term.drain_replies()
b'\x1b[1;7R'
>>> term.feed(b"\x1b]7501;state=working:id=build:progress=60\x1b\\")
>>> term.program_status.value, term.program_status.progress
('working', 60)

Boxed visual assertions verify CJK wide-character alignment and cursor coordinates in tests:

>>> from libvt.testing import assert_screen_box
>>> t = libvt.Terminal(rows=2, cols=8)
>>> t.feed("日本ok\r\ndone".encode())
>>> assert_screen_box(
...     t,
...     """
...     ┌────────┐
...     │日本ok  │
...     │done    │
...     └────────┘
...     """,
...     cursor=(1, 4),
... )

License

MIT License. See LICENSE.

Metadata

Release files for libvt 0.0.1a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libvt 0.0.1a0
File Size Uploaded Provenance Actions
libvt-0.0.1a0.tar.gz 198.5 kB With provenance Details for libvt-0.0.1a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libvt 0.0.1a0
File Interpreter ABI Platform Actions
libvt-0.0.1a0-py3-none-any.whl Python 3 none any Details for libvt-0.0.1a0-py3-none-any.whl

Total release size: 330.7 kB

Release files / libvt-0.0.1a0.tar.gz

Download URL libvt-0.0.1a0.tar.gz
Size 198.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2e176930d8cb95bf8160a753f1a73eef26f0829f73b71f2a39e64eac44645b78
BLAKE2b-256 checksum
How to use checksums
0df08b845180278110643759232d222175340fe7ed378fb4c71126cb1d5247cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / libvt-0.0.1a0-py3-none-any.whl

Download URL libvt-0.0.1a0-py3-none-any.whl
Size 132.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
619b635ab87cca9aa3b49877894f041e0f6859468ba7379d33041495f3a45c13
BLAKE2b-256 checksum
How to use checksums
91ce34500dd117bafed573ccab711d616369d2ef301db796bb07c7d652ebd91e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for libvt 0.0.1a0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for libvt-0.0.1a0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page