Member-only story

Designing Beautiful Command-Line Applications With Python

Five libraries that make your console beautiful

Martin Thoma
Better Programming
4 min readFeb 9, 2022
Textual allows you to create such amazing terminal applications with interactive elements that react on the mouse cursor position. Absolutely mindboggling that this is possible. Image from the README of textual.

A lot of people still write their command-line applications with Argparse or even Optparse plus input(). Creating outputs is often done directly with print and formatting strings — which gets really hairy when you want to print tables or have some color/emphasis.

There are four libraries that allow you to do WAY better. I can promise the last two will surprise you — let’s get started!

№1 and 2: Use click or Typer for CLIs

click is a library in the Flask ecosystem for creating non-interactive command-line interfaces. It parses command-line arguments/options but uses decorators in a very clever way to do so. Especially the options for creating subcommands are top-notch

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Martin Thoma
Martin Thoma

Written by Martin Thoma

I’m a Software Engineer with over 10 years of Python experience (Backend/ML/AI). Support me via https://martinthoma.medium.com/membership

Responses (3)

Write a response