PostHole
Compose Login
You are browsing eu.zone1 in read-only mode. Log in to participate.
rss-bridge 2025-05-20T20:05:00+00:00

SE Radio 669: Will McGugan on Text-Based User Interfaces

Will McGugan, the CEO and founder of Textualize, speaks with host Gregory M. Kapfhammer about how to use packages such as Rich and Textual to build text-based user interfaces (TUIs) and command-line interfaces (CLIs) in Python. Along with discussing the design idioms that enable developers to create TUIs in Python, they consider practical strategies for efficiently rendering the components of a TUI. They also explore the subtle idiosyncrasies of implementing performant TUI frameworks like Textual and Rich and introduce the steps that developers would take to create their own CLI or TUI.

This episode is sponsored by Fly.io.


Will McGugan, the CEO and founder of Textualize, speaks with host Gregory M. Kapfhammer about how to use packages such as Rich and Textual to build text-based user interfaces (TUIs) and command-line interfaces (CLIs) in Python. Along with discussing the design idioms that enable developers to create TUIs in Python, they consider practical strategies for efficiently rendering the components of a TUI. They also explore the subtle idiosyncrasies of implementing performant TUI frameworks like Textual and Rich and introduce the steps that developers would take to create their own CLI or TUI.



Show Notes

Related Episodes

  • SE Radio 622: Wolf Vollprecht on Python Tooling in Rust/
  • SE Radio 589: Zac Hatfield-Dodds on Property-Based Testing in Python
  • SE Radio 516: Brian Okken on Testing in Python with Pytest
  • SE Radio 431: Ken Youens-Clark on Learning Python

Other References

  • Textualize Blog:

Transcript

Transcript brought to you by IEEE Software magazine.

This transcript was automatically generated. To suggest improvements in the text, please contact [email protected] and include the episode number and URL.

Gregory Kapfhammer 00:00:51 Welcome to Software Engineering Radio. I’m your host, Gregory Kapfhammer. Today’s guest is Will McGugan. He’s the creator of Rich and Textual and the CEO and founder of Textualize. Will welcome to Software Engineering Radio.

Will McGugan 00:01:06 Hi Greg. Good to be here.

Gregory Kapfhammer 00:01:08 Hey, I’m glad that you could be on the podcast today. We’re going to be talking about text-based user interfaces and command line user interfaces, sometimes called 2E and CLI. Are you ready to dive into the conversation?

Will McGugan 00:01:21 Very much so, yes.

Gregory Kapfhammer 00:01:22 Alright, so you’re well known for creating Rich and Textual, which are two libraries for building CLI and 2E in the Python programming language. And before we get started and go into those details, perhaps you could start by telling us a little bit more what is a CLI and what is a 2E and how are they similar to and different from each other?

Will McGugan 00:01:43 Sure. So CLI Command Line Interface is essentially what you use when you’re in terminal for the most part. You type a command, might have some options and switches hit return and you get response and that’s basically Command Line Interface. So that command is an interface to program software. 2E stands for text or user interface and it’s basically a user interface. So there’s buttons and text and scroll bars, et cetera. But the interface is composed of text, and it lives inside your terminal. So when you run a command, it pops up. That’s user interface in your terminal. You can interact with it in much the same way as a desktop application or a web application. You can work in there and then when you’re done hit control Q and then you’re back to command line. It’s like a user interface that stays inside the terminal when you need it.

Gregory Kapfhammer 00:02:34 Okay, that’s helpful. Now there’s many ways that as engineers we can build and ship applications and use applications. So we could also have a web-based application or a graphical user interface. From your perspective, what are the benefits of using a 2E or a CLI, especially if you’re a developer?

Will McGugan 00:02:52 They tend to be very responsive and very quick and very snappy and there’s less contact switching. I mean I used to be a web developer, I kind of use the web a lot like most people do, but there’s quite a lot of contexts switching when you go between web application, browser tab, et cetera. But the benefits of 2E running in the terminal is that it stays in your own flow. So it’s like everything’s in one place and it’s snappy and responsive and it comes up when you need it. It’s very quick to interact with and then it goes away as quickly when you don’t need it.

Gregory Kapfhammer 00:03:25 Okay. We’re going to use Rich and Textual as like a vehicle for exploring 2Es and CLI in greater detail. So to get started with this next phase of our conversation, can you tell us a little bit about what Rich is and what Textual is?

Will McGugan 00:03:40 So Rich is a Library wrote a number of years ago now and its purpose is basically to write better formatted content to the terminal. People have been using terminals for multiple decades and we’ve run quite custom to the output. It tends to be monochrome, it tends to be unformatted so you won’t even have text wrapping, it’ll just be kind of split into the next line and the output can often be quite difficult to visually parse. Rich basically writes easier to visually parse information so it can format it, it can add color and style and it can change the layout. So you’re basically seeing the same data but it’s just much easier to read at a glance and it gives developers the tools to basically write CLIs which are much more friendly to most developers.

Gregory Kapfhammer 00:04:32 So you mentioned words like friendly and easy to use and I’ve actually either built or used a number of different apps that are written with rich and textual. Can you give us a couple concrete examples and explain why they’re friendly and easy to use?

Will McGugan 00:04:46 Sure. So Rich has a number of different I call renderable in which respect it’s a poor name but basically, it’s just one method of transforming some raw data into some visual output. So you can write a table for instance. Tables are remarkably tricky to do. If you ever try to write a table before Rich, you find it’s very difficult to format all the content, especially when the cells, the data in the table can change size, you know, if it’s too large you might have to wrap it and then you have to pick the optimum number of rows to fit inside the terminal. But Rich does all that. So if you’ve got tabular data, you can write it with Rich and then you can easily review it in the terminal. And most of the renderable are like that. They just take data that you’ve calculate in your app, and they present it to the user in a much easier to read way.

Gregory Kapfhammer 00:05:38 The example with tables in rich is a good one. Can you give an example when it comes to using textual, what kinds of applications or features would we find in a textual application?

[...]


Original source

Reply