Coding

Rich – Python library for rich text and beautiful formatting

Rich is a Python library for rich text and beautiful formatting in the terminal.

The Rich API makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box.

This is free and open source software.

Key Features

  • Text class you can use to mark up strings with color and style attributes. You can use a Text instance anywhere a string is accepted, which gives you a lot of control over presentation.
  • Automatically highlight patterns in text, such as numbers, strings, collections, booleans, None, and a few more exotic patterns such as file paths, URLs and UUIDs.
  • Format (i.e. pretty print) containers such as lists, dicts, and sets.
  • Supplies a logging handler which will format and colorize text written by Python’s logging module.
  • Render Python tracebacks with syntax highlighting and formatting. Rich tracebacks are easier to read and show more code than standard Python tracebacks.
  • Number of Prompt classes which ask a user for input and loop until a valid response is received (they all use the Console API internally).
  • Render text or other Rich renderables in neat columns with the Columns class
  • Group class allows you to group several renderables together so they may be rendered in a context where only a single renderable may be supplied. For instance, you might want to display several renderables within a Panel.
  • Render Markdown to the console. To render markdown, construct a Markdown object then print it to the console.
  • Add whitespace around text or other renderable.
  • Display continuously updated information regarding the progress of long running tasks / file copies etc. The information displayed is configurable, the default will display a description of the ‘task’, a progress bar, percentage complete, and estimated time remaining.
  • Syntax highlight various programming languages with line numbers.
  • Variety of ways to render tabular data to the terminal.
  • Generate a tree view in the terminal. A tree view is a great way of presenting the contents of a filesystem or any other hierarchical data.

Website: github.com/Textualize/rich
Support:
Developer: Will McGugan
License: MIT License

Rich in action
Click image for full size

Rich is written in Python. Learn Python with our recommended free books and free tutorials.


Related Software

Command-Line Python Application Development Tools
Python FireLibrary for automatically generating command line interfaces
argparseParser for command-line options, arguments and sub-commands
ClickCreate beautiful command line interfaces in a composable way
TyperLibrary for building CLI applications
RichPython library for rich text and beautiful formatting
GooeyConvert console programs into end-user-friendly GUI software
alive-progressProgress bar, with real-time throughput
Python Prompt ToolkitBuild powerful interactive command line and terminal applications
tqdmFast, extensible progress bar for Python and CLI
AsciimaticsCreate full-screen text UIs from interactive forms to ASCII animations
CementCLI application framework for Python
docoptCommand-line interface description language
cliffFramework for building command line programs

Read our verdict in the software roundup.

Terminal String Styling Tools
RichPython library for rich text and beautiful formatting
ChalkBills itself as “Terminal string styling done right”
picocolorsTiny and fast library for terminal output formatting
yoctocolorsSmall and fast command-line coloring package
yachalkClone of Chalk written in Python
kleurNode.js library for formatting terminal text with ANSI colors
coloretteSet your terminal text color and styles
styString styling for your terminal
termcolorANSI color formatting for output in the terminal
coloredSimple Python library for color and formatting in terminal
ansicolorsANSI colors for Python
ansi-colorsAdd ANSI colors to terminal text

Read our verdict in the software roundup.


Best Free and Open Source Software Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.

This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more.

Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments