libvt.aio¶
Transport-only asyncio stream and POSIX PTY adapters over Terminal.
-
class libvt.aio.AsyncTerminalStream¶class libvt.aio.AsyncTerminalStream¶
Bases:
objectDrive a sans-I/O
Terminalfromasynciostreams.Coalesces frame wakeups across DEC mode
?2026synchronized-output batches (bounded by sync_timeout using generation-safe expiry) and automatically flushesdrain_replies()when aStreamWriteris attached.
-
class libvt.aio.PtySession¶class libvt.aio.PtySession¶
Bases:
objectAsync POSIX pseudo-terminal subprocess session backed by
Terminal.
-
class libvt.aio.ReplyWriter¶class libvt.aio.ReplyWriter¶
Bases:
ProtocolStructural writer protocol satisfied by
asyncio.StreamWriter.
-
libvt.aio.open_pty(argv, *, rows=24, cols=80, scrollback=2000, env=None, cwd=None, tty_mode='cooked', python_executable=None, profile=DEFAULT_PROFILE, policy=DEFAULT_POLICY, limits=DEFAULT_LIMITS, sync_timeout=1.0)¶libvt.aio.open_pty(argv, *, rows=24, cols=80, scrollback=2000, env=None, cwd=None, tty_mode='cooked', python_executable=None, profile=DEFAULT_PROFILE, policy=DEFAULT_POLICY, limits=DEFAULT_LIMITS, sync_timeout=1.0)¶
Spawn argv with a controlling POSIX PTY driven by
Terminal.- Parameters:
argv (
collections.abc.Sequence[str]) – Command and arguments executed viaos.execvp.rows (
int) – Initial PTY height in rows.cols (
int) – Initial PTY width in columns.scrollback (
int) – Primary-screen scrollback line capacity.env (
collections.abc.Mapping[str,str] |None) – Environment variables passed to the child process (defaults toos.environwithTERM=xterm-256color).cwd (
str|os.PathLike[str] |None) – Working directory for the child process.tty_mode (
TtyMode) – Initial slave terminal mode ("cooked","cbreak", or"raw").python_executable (
str|os.PathLike[str] |None) – Python interpreter used for theTIOCSCTTYpre-exec trampoline.profile (
Profile) – Terminal compatibility profile.policy (
Policy) – Host security and query policy.limits (
Limits) – Parser and state resource ceilings.sync_timeout (
float) – Watchdog timeout in seconds before expiring stalled?2026frames.
- Yields:
PtySession – Active session connected to the child process and master PTY fd.
- Raises:
NotImplementedError– On platforms lacking POSIXpty.openpty()(Windows).ValueError– If argv is empty or tty_mode is invalid.OSError– If PTY allocation orexecvpfails.
- Return type:
AsyncGenerator[PtySession]