turbodesk

Write terminal applications as functions of their state.

An open source Python library

Turbo Python, an IDE built on turbodesk: a menu bar, two overlapping editor windows on a contacts module and its test, and a status line

Terminal interfaces are hard to test.

Most Python terminal libraries keep a tree of widget objects alive between frames. The state of the screen is spread across them. To check one screen, a test builds the tree, drives it, and queries it back.

Your application is a function.

It runs again when something changes, and returns a picture of the screen.

The widget gallery: tabs, a check box, radio buttons, a progress bar, lists, a table and a tree on one screen

A test calls the function.

Drawing has no side effect, so a test renders at any size and reads the text.

TurboVI, a vi clone built on turbodesk, with the screen split between a module and the test that checks it

Two programs run on it.

Turbo Python and TurboVI are on PyPI. Both shaped the library.

Turbo Python with its Debug menu open over the editor: breakpoints, call stack, watches and evaluation

You can read all of it in an afternoon.

Open source

Apache 2.0. Install it from PyPI as turbodesk.

One dependency

Rich measures glyph widths. Pygments is optional, for syntax colouring.

Python 3.12 and later

It runs in Linux, macOS and FreeBSD terminals.

A stable core

Views, hooks and widget signatures freeze at 1.0.

Documentation and a guide: turbodesk.lab.abilian.com