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

Overview

Downloads PyPI version codecov Rich blog Twitter Follow

Logo

中文 readmeLengua española readmeDeutsche readmeLäs på svenska日本語 readme

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.

Features

For a video introduction to Rich see calmcode.io by @fishnets88.

See what people are saying about Rich.

Compatibility

Rich works with Linux, OSX, and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.6.1 or later.

Rich works with Jupyter notebooks with no additional configuration required.

Installing

Install with pip or your favorite PyPi package manager.

pip install rich

Run the following to test Rich output on your terminal:

python -m rich

Rich Print

To effortlessly add rich output to your application, you can import the rich print method, which has the same signature as the builtin Python function. Try this:

from rich import print

print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())

Hello World

Rich REPL

Rich can be installed in the Python REPL, so that any data structures will be pretty printed and highlighted.

>>> from rich import pretty
>>> pretty.install()

REPL

Using the Console

For more control over rich terminal content, import and construct a Console object.

from rich.console import Console

console = Console()

The Console object has a print method which has an intentionally similar interface to the builtin print function. Here's an example of use:

console.print("Hello", "World!")

As you might expect, this will print "Hello World!" to the terminal. Note that unlike the builtin print function, Rich will word-wrap your text to fit within the terminal width.

There are a few ways of adding color and style to your output. You can set a style for the entire output by adding a style keyword argument. Here's an example:

console.print("Hello", "World!", style="bold red")

The output will be something like the following:

Hello World

That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to bbcode. Here's an example:

console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].")

Console Markup

You can use a Console object to generate sophisticated output with minimal effort. See the Console API docs for details.

Rich Inspect

Rich has an inspect function which can produce a report on any Python object, such as class, instance, or builtin.

>>> my_list = ["foo", "bar"]
>>> from rich import inspect
>>> inspect(my_list, methods=True)

Log

See the inspect docs for details.

Rich Library

Rich contains a number of builtin renderables you can use to create elegant output in your CLI and help you debug your code.

Click the following headings for details:

Log

The Console object has a log() method which has a similar interface to print(), but also renders a column for the current time and the file and line which made the call. By default Rich will do syntax highlighting for Python structures and for repr strings. If you log a collection (i.e. a dict or a list) Rich will pretty print it so that it fits in the available space. Here's an example of some of these features.

from rich.console import Console
console = Console()

test_data = [
    {"jsonrpc": "2.0", "method": "sum", "params": [None, 1, 2, 4, False, True], "id": "1",},
    {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
    {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"},
]

def test_log():
    enabled = False
    context = {
        "foo": "bar",
    }
    movies = ["Deadpool", "Rise of the Skywalker"]
    console.log("Hello from", console, "!")
    console.log(test_data, log_locals=True)


test_log()

The above produces the following output:

Log

Note the log_locals argument, which outputs a table containing the local variables where the log method was called.

The log method could be used for logging to the terminal for long running applications such as servers, but is also a very nice debugging aid.

Logging Handler

You can also use the builtin Handler class to format and colorize output from Python's logging module. Here's an example of the output:

Logging

Emoji

To insert an emoji in to console output place the name between two colons. Here's an example:

>>> console.print(":smiley: :vampire: :pile_of_poo: :thumbs_up: :raccoon:")
😃 🧛 💩 👍 🦝

Please use this feature wisely.

Tables

Rich can render flexible tables with unicode box characters. There is a large variety of formatting options for borders, styles, cell alignment etc.

table movie

The animation above was generated with table_movie.py in the examples directory.

Here's a simpler table example:

from rich.console import Console
from rich.table import Table

console = Console()

table = Table(show_header=True, header_style="bold magenta")
table.add_column("Date", style="dim", width=12)
table.add_column("Title")
table.add_column("Production Budget", justify="right")
table.add_column("Box Office", justify="right")
table.add_row(
    "Dev 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118"
)
table.add_row(
    "May 25, 2018",
    "[red]Solo[/red]: A Star Wars Story",
    "$275,000,000",
    "$393,151,347",
)
table.add_row(
    "Dec 15, 2017",
    "Star Wars Ep. VIII: The Last Jedi",
    "$262,000,000",
    "[bold]$1,332,539,889[/bold]",
)

console.print(table)

This produces the following output:

table

Note that console markup is rendered in the same way as print() and log(). In fact, anything that is renderable by Rich may be included in the headers / rows (even other tables).

The Table class is smart enough to resize columns to fit the available width of the terminal, wrapping text as required. Here's the same example, with the terminal made smaller than the table above:

table2

Progress Bars

Rich can render multiple flicker-free progress bars to track long-running tasks.

For basic usage, wrap any sequence in the track function and iterate over the result. Here's an example:

from rich.progress import track

for step in track(range(100)):
    do_step(step)

It's not much harder to add multiple progress bars. Here's an example taken from the docs:

progress

The columns may be configured to show any details you want. Built-in columns include percentage complete, file size, file speed, and time remaining. Here's another example showing a download in progress:

progress

To try this out yourself, see examples/downloader.py which can download multiple URLs simultaneously while displaying progress.

Status

For situations where it is hard to calculate progress, you can use the status method which will display a 'spinner' animation and message. The animation won't prevent you from using the console as normal. Here's an example:

from time import sleep
from rich.console import Console

console = Console()
tasks = [f"task {n}" for n in range(1, 11)]

with console.status("[bold green]Working on tasks...") as status:
    while tasks:
        task = tasks.pop(0)
        sleep(1)
        console.log(f"{task} complete")

This generates the following output in the terminal.

status

The spinner animations were borrowed from cli-spinners. You can select a spinner by specifying the spinner parameter. Run the following command to see the available values:

python -m rich.spinner

The above command generate the following output in the terminal:

spinners

Tree

Rich can render a tree with guide lines. A tree is ideal for displaying a file structure, or any other hierarchical data.

The labels of the tree can be simple text or anything else Rich can render. Run the following for a demonstration:

python -m rich.tree

This generates the following output:

markdown

See the tree.py example for a script that displays a tree view of any directory, similar to the linux tree command.

Columns

Rich can render content in neat columns with equal or optimal width. Here's a very basic clone of the (MacOS / Linux) ls command which displays a directory listing in columns:

import os
import sys

from rich import print
from rich.columns import Columns

directory = os.listdir(sys.argv[1])
print(Columns(directory))

The following screenshot is the output from the columns example which displays data pulled from an API in columns:

columns

Markdown

Rich can render markdown and does a reasonable job of translating the formatting to the terminal.

To render markdown import the Markdown class and construct it with a string containing markdown code. Then print it to the console. Here's an example:

from rich.console import Console
from rich.markdown import Markdown

console = Console()
with open("README.md") as readme:
    markdown = Markdown(readme.read())
console.print(markdown)

This will produce output something like the following:

markdown

Syntax Highlighting

Rich uses the pygments library to implement syntax highlighting. Usage is similar to rendering markdown; construct a Syntax object and print it to the console. Here's an example:

from rich.console import Console
from rich.syntax import Syntax

my_code = '''
def iter_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
    """Iterate and generate a tuple with a flag for first and last value."""
    iter_values = iter(values)
    try:
        previous_value = next(iter_values)
    except StopIteration:
        return
    first = True
    for value in iter_values:
        yield first, False, previous_value
        first = False
        previous_value = value
    yield first, True, previous_value
'''
syntax = Syntax(my_code, "python", theme="monokai", line_numbers=True)
console = Console()
console.print(syntax)

This will produce the following output:

syntax

Tracebacks

Rich can render beautiful tracebacks which are easier to read and show more code than standard Python tracebacks. You can set Rich as the default traceback handler so all uncaught exceptions will be rendered by Rich.

Here's what it looks like on OSX (similar on Linux):

traceback

All Rich renderables make use of the Console Protocol, which you can also use to implement your own Rich content.

Rich for enterprise

Available as part of the Tidelift Subscription.

The maintainers of Rich and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. Learn more.

Project using Rich

Here are a few projects using Rich:

Issues
  • Texts isn't rendering correctly on Windows

    Texts isn't rendering correctly on Windows

    We are using rich to shows rich and colored text on console but it isn't working properly on Windows. I have turned on unicode support on my windows. Though on windows it looks like following:

    ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │                                                                CVE BINARY TOOL                                                                 │
    └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
    
     • cve-bin-tool Report Generated: 2020-07-03  17:58:41
    ┌───────────────┐
    │ NewFound CVEs │
    └───────────────┘
    
    

    but on linux or modern Windows terminal it renders correctly:

    ╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
    ║                                                                     CVE BINARY TOOL                                                                      ║
    ╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
    
     • cve-bin-tool Report Generated: 2020-07-03  17:39:48
    ╭───────────────╮
    │ NewFound CVEs │
    ╰───────────────╯
    

    On Windows github actions it is even unable to render in ASCII (Here is how columns of panel displays on Windows github actions):

    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
    \u2502CVE-2018-5729\u2502 \u2502CVE-2018-5730\u2502
    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
    

    On linux everything renders perfectly even in github actions.

    opened by Niraj-Kamdar 23
  • [BUG] Misaligned box boundaries in SVG generated from a rich-click help dialogue

    [BUG] Misaligned box boundaries in SVG generated from a rich-click help dialogue

    I'm using the new save_svg method to write a SVG of a help dialogue generated with @ewels' rich-click. However, the characters of the right side of the box are misaligned.

    HELP

    Apparently these additional whitespaces are being caused my markup. For example, the DESTINATION in the dialogue is [u]DESTINATION[/u]. But this seems to be another issue, since it doesn't happen when I keep the default Fira Code font.

    Python 3.8.12
    rich 12.4.1
    macOS 12.3.1
    
    Needs triage 
    opened by apcamargo 22
  • [BUG] Can't print in Jupyter console or qtconsole (but can in jupyter lab)

    [BUG] Can't print in Jupyter console or qtconsole (but can in jupyter lab)

    image This is what I get when I try to do rich.print in jupyter console or qtconsole. But in jupyterlab it is able to print.

    I have installed rich using pip install rich[jupyter] Python version: 3.9 Jupyter (qt)console version: Latest

    Needs triage 
    opened by quantum-booty 20
  • Progress bar functionality

    Progress bar functionality

    Any plans/thoughts on including progress bar functionality?

    I know they're another big pill to swallow, but they certainly could fit the premise of rich. Integrating outside progress bar libraries isn't great as it is right now.

    enhancement 
    opened by thebigmunch 20
  • Add live updating for any render

    Add live updating for any render

    Type of changes

    • [ ] Bug fix
    • [x] New feature
    • [x] Documentation / docstrings
    • [x] Tests
    • [ ] Other

    Checklist

    • [x] I've run the latest black with default args on new code.
    • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
    • [x] I've added tests for new code.
    • [x] I accept that @willmcgugan may be pedantic in the code review.

    Description

    I've been looking at ways to have live updating data table from rich. Whenever I used LiveRender it always faced any issues if something else was being logged.

    So with that in mind I took what was there already from the Progress component and made a generalized Live Updating view. It allows for the component to be updated by the user with an update() function. It currently isn't threaded like Progress is, but could be expanded maybe with a LiveThreaded?

    Limitations

    If the render component is too large, then it will start too not fully clear any of the Renderable above the console view. I have messed around with creating a safe flag that will have it print "the terminal is too small" instead when this is true. I didn't want to add it here yet before getting feedback.

    Showcase

    rich_live_example

    Some gist examples

    opened by nathanrpage97 19
  • [REQUEST] Forcing ANSI

    [REQUEST] Forcing ANSI

    Have you checked the issues for a similar suggestions? YES

    I need an Environment variable which forces ANSI output whatever the system may be. This is particularly useful in GitHub Actions, where it doesn't show any colored output, currently, but setting that a environment variable should print colors. Is it currently possible to do now?

    Needs triage 
    opened by naveen521kk 17
  • [BUG] Coloring does not work in PyCharm

    [BUG] Coloring does not work in PyCharm

    Just checked - it seems to be a PyCharm problem, I will report it there, so this report is just FYI for rich users who use PyCharm. It works in the PyCharm terminal (command line), but not inside the stdout pane of PyCharm.

    Reproduction Replace print() statement with console.print(string, style='bold red'). The string is printed, but no coloring.

    from rich.console import Console
    console = Console()
    console.print('==> Mismatches were found in one or more platforms <==', style='bold red')
    

    Windows 10, PyCharm Community (lastest), Python 3.8, Rich 5.0.0

    upstream 
    opened by akrk1986 17
  • Add API to support tracking progress while reading from a file

    Add API to support tracking progress while reading from a file

    Type of changes

    • [ ] Bug fix
    • [x] New feature
    • [ ] Documentation / docstrings
    • [ ] Tests
    • [ ] Other

    Checklist

    • [x] I've run the latest black with default args on new code.
    • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
    • [x] I've added tests for new code.
    • [x] I accept that @willmcgugan may be pedantic in the code review.

    Description

    Hi Will! I've started using rich more and more, so far it's a great experience :wink:

    One of my common use case for the rich.progress module is tracking the progress made while reading from a file. In bioinformatics it's not rare to process gigabytes of files so I like to have an idea how long of a break I can take while processing my input data!

    image

    Manually updating the progress bar works for certain things, but for instance, when I want to pass a file-like handle to an API that consumes it (e.g json.load), there's no way to update the progress bar between each chunk. To do so, the only way I've found was to wrap the file-like object itself so that it updates the progress bar whenever the file is read from. This is something you could partially do with tqdm.tqdm.wrapattr.

    Since the rich.progress API has no straightforward support for this (like it does with track for an iterator), I made my own snippet for this, which ends up working well. I've been copying around in every project that uses rich, so I think it would make a good addition to the library!

    Changes

    This PR adds the rich.progress._Reader class, which wraps a file-like object, and updates a Progress instance while being read from. The class itself is private; to get a reader, you have to use the new Progress.read method, which takes either a path or a file-like object, and returns a file reader with progress support.

    This lets you do something like this (e.g. loading JSON-serialized data from a file, using os.stat to get the total number of bytes to be read):

    import json
    from rich.progress import *
    
    with Progress(columns=[BarColumn(), DownloadColumn()]) as progress:
        with progress.read("data.json") as f:
            data = json.load(f)
    

    You can also directly pass a file-like object to progress.read, in which case you must specify the total:

    import json
    from rich.progress import *
    
    with Progress(columns=[BarColumn(), DownloadColumn()]) as progress:
        with open("data.json", "rb") as f:
            data = json.load(progress.read(f, total=2048))
    

    In addition, I added a wrapper function rich.progress.read like rich.progress.track which handles setting up a progress, so that you can get a progress reader in just two lines:

    with rich.progress.read("data.json") as f:
        data = json.load(f)
    

    Notes

    • In rich.progress.read and Progress.read, I made total an int instead of a float, because it should be a number of bytes so a float would not make sense here.
    • If you seek the _Reader, it will also reset the position of the progress bar to the new position.
    opened by althonos 16
  • Feature Request: Add a pager to long text output

    Feature Request: Add a pager to long text output

    I like this library since it automatically prints pretty tables with automatic word wrap. I would like if there's way to add a way to a pager to the output for large tables with many rows.

    enhancement hacktoberfest 
    opened by isaulv 15
  • Pycln QA tool as a pre-commit hook

    Pycln QA tool as a pre-commit hook

    Type of changes

    • [ ] Bug fix
    • [ ] New feature
    • [ ] Documentation / docstrings
    • [ ] Tests
    • [x] Other

    Checklist

    • [x] I've run the latest black with default args on new code.
    • [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate. (not needed for this PR)
    • [ ] I've added tests for new code. (not needed for this PR)
    • [x] I accept that @willmcgugan may be pedantic in the code review.

    Description

    I saw pycln (which is a formatter for finding and removing unused import statements) a good addition to the current pre-commit hooks which I believe would ensure a high code quality standard besides black and isort.

    BTW, I'm the author of pycln 😄.

    Anyway, please feel free to ask any questions and/or reject/close this PR.

    + I would like to thank you for inventing this incredible library!

    opened by hadialqattan 14
  • [Suggestion] Use binary prefixes instead of decimal ones

    [Suggestion] Use binary prefixes instead of decimal ones

    I was tinkering with progress bars and noticed the file size unit is expressed with decimal prefixes (i.e. KB, MB, GB, etc.) while the actual number is expressed as binary. I suggest you to consider switching to binary prefixes (i.e. KiB, MiB, GiB, etc.) in order to have consistency with the number and its unit of measure and to remove the ambiguity regarding in which base the prefix is expressed: KiB, MiB, etc. are used exclusively with powers of 2, while I've seen KB, MB, etc. used with powers of 10 (as they should be) and powers of 2 (as in this case, but generally in casual conversations). For instance, I tried with a file with a size of 6'988'379 bytes. Expressed in MiB it's 6,7 and this is the number printed by the progress bar, while in MB it's 6,9. As you can notice, while dealing with MiB vs MB the difference is ~5%, but when the size is bigger it can be ~7% (GiB vs GB), ~10% (TiB vs TB) and so on, so please consider using only one format.

    Edit: grammar

    bug good first issue hacktoberfest 
    opened by Rubo3 14
  • Fix `pretty` cyclic reference handling

    Fix `pretty` cyclic reference handling

    Type of changes

    • [x] Bug fix
    • [ ] New feature
    • [ ] Documentation / docstrings
    • [ ] Tests
    • [ ] Other

    Checklist

    • [x] I've run the latest black with default args on new code.
    • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
    • [x] I've added tests for new code.
    • [x] I accept that @willmcgugan may be pedantic in the code review.

    Description

    Previously cyclic references were only handled for container and dataclass types, but not namedtuple, attrs, or custom types. This fixes that, and expands the tests to cover these cases.

    opened by jcrist 0
  • [BUG] Level Name Repeat

    [BUG] Level Name Repeat

    For some reason using logging with a Rich handler causes the level name to be repeated, see:

    image

    Relevant code:

    def init_logger(log_level: str, console: Console):
        logging.basicConfig(
            level=log_level,
            format="%(levelname)s %(message)s",
            datefmt="[%X]",
            handlers=[RichHandler(
                rich_tracebacks=True,
                console=console
            )]
        )
    
    if __name__ == "__main__":
        try:
            args = init_args()
            console = Console()
            init_logger(args.log_level, console)
    
            with console.status("[bold green]In progress..."):
                main(args, console)
    
        except KeyboardInterrupt:
            pass
    
    def main(args: ArgumentParser, console: Console):
        logger = logging.getLogger('rich')
    
        logger.debug(args)
    
        logger.info("Test")
    
        --- SNIP ---
    

    Does anyone know how can I fix that?

    EDIT: Additionally, style markups are not recognise and result in something like:

    image

    Needs triage 
    opened by aress31 0
  • [REQUEST] Print JSON with Logging

    [REQUEST] Print JSON with Logging

    Is there a way to use a logging (with a Rich handler) to print JSON content?

    For example:

        logging.basicConfig(
            level=log_level,
            format="%(levelname)s %(message)s",
            datefmt="[%X]",
            handlers=[RichHandler(
                rich_tracebacks=True,
                console=console
            )]
        )
    
    logging.debug(json)
    
    Needs triage 
    opened by aress31 0
  • Added console named argument to rich.reconfigure.

    Added console named argument to rich.reconfigure.

    Type of changes

    • [x] Bug fix
    • [ ] New feature
    • [x] Documentation / docstrings
    • [x] Tests
    • [ ] Other

    Checklist

    • [x] I've run the latest black with default args on new code.
    • [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
    • [x] I've added tests for new code.
    • [x] I accept that @willmcgugan may be pedantic in the code review.

    Description

    The documentation for rich.reconfigure says there is an option for a console argument. That however was never implemented and I cannot find any changes around that piece of the code so assume it was forgotten and not removed? 🤔 Instead of making an issue about it, I thought the fastest thing was to add it. I'm open to any changes that you would propose.

    I am interested in passing my own console so I can pass a custom subclass. The reason I would want this, is so I can change the LogRender being used by the Console which would require a custom subclass afaik. https://github.com/Textualize/rich/discussions/344 is relevant, though it only does it for the logging handler, this would allow a custom LogRender for other messages as well.

    I was thinking of making it a Type[Console], though that would require the documentation to change as well. Personally I am not very fussed on how this is implemented so let me know what you think/prefer. :)

    opened by AndreasBackx 0
  • [BUG] Height parameter in Layout is not used

    [BUG] Height parameter in Layout is not used

    Describe the bug

    The Layout class takes an argument of "height", but it if I'm reading the code right it never seem to get used. The value is saved in the constructor, but later, when rendering, the height is set as follows:

    https://github.com/Textualize/rich/blob/a6f2d84511cda7f367dca527177d7b586264755b/rich/layout.py#L380

    Also, while "height" is listed in the docs for Layout(), it has a blank description. Perhaps this was removed before but a few remnants of it remained?

    Platform

    This should apply to all platforms -- I found this by code inspection. I'm running rich 12.5.1 on Python 3.10.6 on macOS Monterey (12.5).

    The workaround seems to be to create a "console" object with the desired height, and then call print() of the Layout on that console rather than using rich.print().

    To avoid confusion, I'm thinking maybe this parameter should just be removed. Alternately, I could see it making sense to provide a max_height which could shrink the height to less than the console (or whatever container it is contained in), but I'm not sure it ever makes sense to grow it to larger than console.height or options.height. I could see also offering a max_width that worked along the same lines, where render_width could be set to the smaller of that and options.max_width.

    Needs triage 
    opened by ronf 0
Releases(v12.5.1)
  • v12.5.1(Jul 11, 2022)

  • v12.5.0(Jul 11, 2022)

    [12.5.0] - 2022-07-11

    Added

    • Environment variables JUPYTER_COLUMNS and JUPYTER_LINES to control width and height of console in Jupyter
    • Markdown friendly Box style, MARKDOWN, for rendering tables ready to copy into markdown files
    • inspect will prefix coroutine functions with async def

    Changed

    • Default width of Jupyter console size is increased to 115
    • Optimized Segment.divide
    • Style.__add__ will no longer return NotImplemented
    • Remove rich._lru_cache

    Fixed

    • Fix Rich clobbering cursor style on Windows https://github.com/Textualize/rich/pull/2339
    • Fix text wrapping edge case https://github.com/Textualize/rich/pull/2296
    • Allow exceptions that are raised while a Live is rendered to be displayed and/or processed https://github.com/Textualize/rich/pull/2305
    • Fix crashes that can happen with inspect when docstrings contain some special control codes https://github.com/Textualize/rich/pull/2294
    • Fix edges used in first row of tables when show_header=False https://github.com/Textualize/rich/pull/2330
    • Fix interaction between Capture contexts and Console(record=True) https://github.com/Textualize/rich/pull/2343
    • Fixed hash issue in Styles class https://github.com/Textualize/rich/pull/2346
    • Fixed bug in Segment.split_and_crop_lines
    Source code(tar.gz)
    Source code(zip)
  • v12.4.4(May 24, 2022)

  • v12.4.3(May 23, 2022)

    [12.4.3] - 2022-05-23

    Changed

    • Further tweaks to SVG character matrix
    • Added clip rect to SVG to prevent box characters overlapping bottom of terminal
    Source code(tar.gz)
    Source code(zip)
  • v12.4.2(May 23, 2022)

    [12.4.2] - 2022-05-23

    Fixed

    • Fix for SVG on Firefox

    Changed

    • Removed excess margin from SVG, tweaked cell sizes to better render block characters
    Source code(tar.gz)
    Source code(zip)
  • v12.4.1(May 8, 2022)

    A fix and further enhancements to the SVG export.

    Default color scheme is now dimmed Monokai, and there is a keyline around the terminal so it looks distinct against a dark background.

    Rich SVG example

    [12.4.1] - 2022-05-08

    Fixed

    • Fix for default background color in SVG export https://github.com/Textualize/rich/issues/2260

    Changed

    • Added a keyline around SVG terminals which is visible on dark backgrounds
    Source code(tar.gz)
    Source code(zip)
  • v12.4.0(May 7, 2022)

    This release has a major change to the SVG export. It is now a simpler design, and will render outside of a browser.

    deniro

    Screenshot 2022-05-07 at 15 57 54

    [12.4.0] - 2022-05-07

    Changed

    • Rebuilt SVG export to create a simpler SVG that is more portable
    • Fix render_lines crash when render height was negative https://github.com/Textualize/rich/pull/2246

    Added

    • Add padding to Syntax constructor https://github.com/Textualize/rich/pull/2247
    Source code(tar.gz)
    Source code(zip)
  • v12.3.0(Apr 26, 2022)

    [12.3.0] - 2022-04-26

    Added

    • Ability to change terminal window title https://github.com/Textualize/rich/pull/2200
    • Added show_speed parameter to progress.track which will show the speed when the total is not known
    • Python blocks can now opt out from being rendered in tracebacks's frames, by setting a _rich_traceback_omit = True in their local scope https://github.com/Textualize/rich/issues/2207

    Fixed

    • Fall back to sys.__stderr__ on POSIX systems when trying to get the terminal size (fix issues when Rich is piped to another process)
    • Fixed markup escaping issue https://github.com/Textualize/rich/issues/2187
    • Safari - Box appearing around SVG export https://github.com/Textualize/rich/pull/2201
    • Fixed recursion error in Jupyter progress bars https://github.com/Textualize/rich/issues/2047
    • Complex numbers are now identified by the highlighter https://github.com/Textualize/rich/issues/2214
    • Fix crash on IDLE and forced is_terminal detection to False because IDLE can't do escape codes https://github.com/Textualize/rich/issues/2222
    • Fixed missing blank line in traceback rendering https://github.com/Textualize/rich/issues/2206
    • Fixed running Rich with the current working dir was deleted https://github.com/Textualize/rich/issues/2197

    Changed

    • Setting total=None on progress is now possible, and will display pulsing animation
    • Micro-optimization for Segment.divide
    Source code(tar.gz)
    Source code(zip)
  • v12.2.0(Apr 5, 2022)

  • v12.1.0(Apr 3, 2022)

    Snap export svg Snap

    [12.1.0] - 2022-04-03

    Added

    • Progress.open and Progress.wrap_file method to track the progress while reading from a file or file-like object https://github.com/willmcgugan/rich/pull/1759
    • SVG export functionality https://github.com/Textualize/rich/pull/2101

    Fixed

    • Add missing end keyword argument to Text.from_markup https://github.com/Textualize/rich/pull/2095
    • Fallback to text lexer when no lexer guessed https://github.com/Textualize/rich/pull/2133
    • Fixed issue with decoding ANSI reset https://github.com/Textualize/rich/issues/2112
    Source code(tar.gz)
    Source code(zip)
  • v12.0.1(Mar 22, 2022)

    [12.0.1] - 2022-03-22

    Changed

    • Improve performance of cell_length https://github.com/Textualize/rich/pull/2061
    • Improve performance of chop_cells https://github.com/Textualize/rich/pull/2077

    Fixed

    • Fix capturing stdout on legacy Windows https://github.com/Textualize/rich/pull/2066
    Source code(tar.gz)
    Source code(zip)
  • v12.0.0(Mar 10, 2022)

    This release drops Colorama as a dependancy in favour of an internal Win32 render.

    There are some new features for progress bars, added support for pretty printing named tuples, and a bunch of fixes.

    As a major version there are a few breaking changes, see below.

    [12.0.0] - 2022-03-10

    Added

    • Added options to TimeRemainingColumn to render a compact time format and render elapsed time when a task is finished. https://github.com/Textualize/rich/pull/1992
    • Added ProgressColumn MofNCompleteColumn to display raw completed/total column (similar to DownloadColumn, but displays values as ints, does not convert to floats or add bit/bytes units). https://github.com/Textualize/rich/pull/1941
    • Replace Colorama with win32 renderer https://github.com/Textualize/rich/pull/1993
    • Add support for namedtuples to Pretty https://github.com/Textualize/rich/pull/2031

    Fixed

    • In Jupyter mode make the link target be set to "_blank"
    • Fix some issues with markup handling around "[" characters https://github.com/Textualize/rich/pull/1950
    • Fix syntax lexer guessing.
    • Fixed Pretty measure not respecting expand_all https://github.com/Textualize/rich/issues/1998
    • Collapsed definitions for single-character spinners, to save memory and reduce import time.
    • Fix print_json indent type in __init__.py
    • Fix error when inspecting object defined in REPL https://github.com/Textualize/rich/pull/2037
    • Fix incorrect highlighting of non-indented JSON https://github.com/Textualize/rich/pull/2038
    • Fixed height reset in complex renderables https://github.com/Textualize/rich/issues/2042

    Changed

    • Improved support for enum.Flag in ReprHighlighter https://github.com/Textualize/rich/pull/1920
    • Tree now respects justify=None, i.e. won't pad to right https://github.com/Textualize/rich/issues/1690
    • Removed rich.tabulate which was marked for deprecation
    • Deprecated rich.align.AlignValues in favor of AlignMethod
    Source code(tar.gz)
    Source code(zip)
  • v11.2.0(Feb 8, 2022)

    [11.2.0] - 2022-02-08

    Added

    • Add support for US spelling of "gray" in ANSI color names https://github.com/Textualize/rich/issues/1890
    • Added rich.diagnose.report to expose environment debugging logic as function https://github.com/Textualize/rich/pull/1917
    • Added classmethod Progress.get_default_columns() to get the default list of progress bar columns https://github.com/Textualize/rich/pull/1894

    Fixed

    • Fixed performance issue in measuring text
    Source code(tar.gz)
    Source code(zip)
  • v11.1.0(Jan 28, 2022)

    [11.1.0] - 2022-01-28

    Added

    • Add Syntax.guess_lexer, add support for more lexers (e.g. Django templates etc.) https://github.com/Textualize/rich/pull/1869
    • Add lexer parameter to Syntax.from_path to allow for overrides https://github.com/Textualize/rich/pull/1873

    Fixed

    • Workaround for edge case of object from Faiss with no __class__ https://github.com/Textualize/rich/issues/1838
    • Ensure Syntax always justifies left https://github.com/Textualize/rich/pull/1872
    • Handle classes in inspect when methods=True https://github.com/Textualize/rich/pull/1874
    Source code(tar.gz)
    Source code(zip)
  • v11.0.0(Jan 9, 2022)

    The headline feature of this reach is vertical alignment in tables.

    Screen Shot 2022-01-07 at 20 28 22

    Note: as a major version bump, this version has some breaking changes. These changes won't affect many people, but we like to be strict about semver. See the release notes below.

    [11.0.0] - 2022-01-09

    Added

    • Added max_depth arg to pretty printing https://github.com/Textualize/rich/issues/1585
    • Added vertical_align to Table.add_row https://github.com/Textualize/rich/issues/1590

    Fixed

    • Fixed issue with pretty repr in jupyter notebook https://github.com/Textualize/rich/issues/1717
    • Fix Traceback theme defaults override user supplied styles https://github.com/Textualize/rich/issues/1786

    Changed

    • breaking Deprecated rich.console.RenderGroup, now named rich.console.Group
    • breaking Syntax.__init__ parameter lexer_name renamed to lexer
    • Syntax constructor accepts both str and now a pygments lexer https://github.com/Textualize/rich/pull/1748
    Source code(tar.gz)
    Source code(zip)
  • v10.16.2(Jan 2, 2022)

  • v10.16.1(Dec 15, 2021)

  • v10.16.0(Dec 12, 2021)

    A bugfix for progress bars in Jupyter in this release. And a new property on Text class which exports the equivalent console markup.

    [10.16.0] - 2021-12-12

    Fixed

    • Double print of progress bar in Jupyter https://github.com/willmcgugan/rich/issues/1737

    Added

    • Added Text.markup property https://github.com/willmcgugan/rich/issues/1751
    Source code(tar.gz)
    Source code(zip)
  • v10.15.2(Dec 2, 2021)

    AFAIK this issue only occurred in test suites, but it is a recommended that if you have 10.15.X installed you should upgrade.

    [10.15.2] - 2021-12-02

    Fixed

    • Deadlock issue https://github.com/willmcgugan/rich/issues/1734
    Source code(tar.gz)
    Source code(zip)
  • v10.15.1(Nov 29, 2021)

    Reverted a fix for https://github.com/willmcgugan/rich/issues/1530

    On reflection, I think the fix might introduce the possibility for a deadlock -- although none was reported.

    [10.15.1] - 2021-11-29

    Changed

    • Reverted thread-safety fix for Live that introduced deadlock potential
    Source code(tar.gz)
    Source code(zip)
  • v10.15.0(Nov 28, 2021)

    [10.15.0] - 2021-11-28

    Added

    • Added dynamic_progress.py to examples
    • Added ConsoleOptions.update_height
    • Fixed Padding not respecting height
    • Added Text.from_ansi method

    Changed

    • Some optimizations for simple strings (with only single cell widths)

    Fixed

    • Fixed issue with progress bar not rendering markup https://github.com/willmcgugan/rich/issues/1721
    • Fixed race condition when exiting Live https://github.com/willmcgugan/rich/issues/1530
    Source code(tar.gz)
    Source code(zip)
  • v10.14.0(Nov 16, 2021)

    Mostly fixes for edge cases. Added a rich_cast function to rich.protocol, which is unlikely to be used outside of Rich itself.

    [10.14.0] - 2021-11-16

    Fixed

    • Fixed progress speed not updating when total doesn't change
    • Fixed superfluous new line in Status https://github.com/willmcgugan/rich/issues/1662
    • Fixed Windows legacy width again
    • Fixed infinite loop in set_cell_size https://github.com/willmcgugan/rich/issues/1682

    Added

    • Added file protocol to URL highlighter https://github.com/willmcgugan/rich/issues/1681
    • Added rich.protocol.rich_cast

    Changed

    • Allowed __rich__ to work recursively
    • Allowed Text classes to work with sep in print https://github.com/willmcgugan/rich/issues/1689
    Source code(tar.gz)
    Source code(zip)
  • v10.13.0(Nov 7, 2021)

    This release is mostly bugfixes (details below). The minor version bump is because print_json grew a number of parameters to match json.dumps

    [10.13.0] - 2021-11-07

    Added

    • Added json.dumps parameters to print_json https://github.com/willmcgugan/rich/issues/1638

    Fixed

    • Fixed an edge case bug when console module try to detect if they are in a tty at the end of a pytest run
    • Fixed a bug where logging handler raises an exception when running with pythonw (related to https://bugs.python.org/issue13807)
    • Fixed issue with TERM env vars that have more than one hyphen https://github.com/willmcgugan/rich/issues/1640
    • Fixed missing new line after progress bar when terminal is not interactive https://github.com/willmcgugan/rich/issues/1606
    • Fixed exception in IPython when disabling pprint with %pprint https://github.com/willmcgugan/rich/issues/1646
    • Fixed issue where values longer than the console width produced invalid JSON https://github.com/willmcgugan/rich/issues/1653
    • Fixes trailing comma when pretty printing dataclass with last field repr=False https://github.com/willmcgugan/rich/issues/1599

    Changed

    • Markdown codeblocks now word-wrap https://github.com/willmcgugan/rich/issues/1515
    Source code(tar.gz)
    Source code(zip)
  • v10.12.0(Oct 6, 2021)

  • v10.11.0(Sep 24, 2021)

    Added two new options to Tracebacks, to hide framework code, and guard against very long tracebacks.

    Screen Shot 2021-09-24 at 09 42 Screen Shot 2021-09-23 at 21 29

    [10.11.0] - 2021-09-24

    Added

    • Added suppress parameter to tracebacks
    • Added max_frames parameter to tracebacks
    Source code(tar.gz)
    Source code(zip)
  • v10.10.0(Sep 18, 2021)

    [10.10.0] - 2021-09-18

    Added

    • Added stdin support to rich.json

    Fixed

    • Fixed pretty printing of objects with fo magic with getattr https://github.com/willmcgugan/rich/issues/1492
    Source code(tar.gz)
    Source code(zip)
  • v10.9.0(Aug 29, 2021)

    This release highlights JSON keys with a different color

    Screen Shot 2021-08-29 at 14 38

    [10.9.0] - 2020-08-29

    Added

    • Added data parameter to print_json method / function
    • Added an --indent parameter to python -m rich.json

    Changed

    • Changed default indent of JSON to 2 (down from 4)
    • Changed highlighting of JSON keys to new style (bold blue)
    Source code(tar.gz)
    Source code(zip)
  • v10.8.0(Aug 28, 2021)

    This release adds pretty printing of JSON

    Screen Shot 2021-08-28 at 14 21

    [10.8.0] - 2020-08-28

    Added

    • Added Panel.subtitle
    • Added Panel.subtitle_align
    • Added rich.json.JSON
    • Added rich.print_json and Console.print_json

    Fixed

    • Fixed a bug where calling rich.reconfigure within a pytest_configure hook would lead to a crash
    • Fixed highlight not being passed through options https://github.com/willmcgugan/rich/issues/1404
    Source code(tar.gz)
    Source code(zip)
  • v10.7.0(Aug 5, 2021)

    [10.7.0] - 2021-08-05

    Added

    • Added Text.apply_meta
    • Added meta argument to Text.assemble
    • Added Style.from_meta
    • Added Style.on
    • Added Text.on

    Changed

    • Changed RenderGroup to Group and render_group to group (old names remain for compatibility but will be deprecated in the future)
    • Changed rich.repr.RichReprResult to rich.repr.Result (old names remain for compatibility but will be deprecated in the future)
    • Changed meta serialization to use pickle rather than marshal to permit callables
    Source code(tar.gz)
    Source code(zip)
  • v10.6.0(Jul 12, 2021)

    [10.6.0] - 2021-07-12

    Deprecated

    • Added deprecation warning for tabulate_mapping which will be removed in v11.0.0

    Added

    • Added precision argument to filesize.decimal
    • Added separator argument to filesize.decimal
    • Added _rich_traceback_guard to Traceback
    • Added emoji_variant to Console
    • Added -emoji and -text variant selectors to emoji code

    Fixed

    • Fixed issue with adjoining color tags https://github.com/willmcgugan/rich/issues/1334

    Changed

    • Changed Console.size to use unproxied stdin and stdout
    Source code(tar.gz)
    Source code(zip)
Owner
Will McGugan
I'm a full-stack software developer, and Python expert. Creator of Rich and @PyFilesystem.
Will McGugan
A tool to automatically convert old string literal formatting to f-strings

flynt - string formatting converter flynt is a command line tool to automatically convert a project's Python code from old "%-formatted" and .format(.

Elijah K 513 Sep 2, 2022
Gamestonk Terminal is an awesome stock and crypto market terminal

Gamestonk Terminal is an awesome stock and crypto market terminal. A FOSS alternative to Bloomberg Terminal.

Gamestonk Terminal 16.5k Sep 11, 2022
Simple Python Library to display text with color in Python Terminal

pyTextColor v1.0 Introduction pyTextColor is a simple Python Library to display colorful outputs in Terminal, etc. Note: Your Terminal or any software

Siddhesh Chavan 1 Jan 23, 2022
A CLI application that downloads your AC submissions from OJ's like Atcoder,Codeforces,CodeChef and distil it into beautiful Submission HeatMap.

Yoda A CLI that takes away the hassle of managing your submission files on different online-judges by automating the entire process of collecting and organizing your code submissions in one single Directory on your Machine also it distils User Submissions into beautiful Submission HeatMap.

Nikhar Manchanda 1 Jul 28, 2022
The easiest way to create beautiful CLI for your programs.

The Yandere is a program written in Python3, allowing you to create your own beautiful CLI tool.

Billy 33 Jun 9, 2022
Terminal Colored Text for Python

Terminal Colored Text for Python

R3CKhi-**75 3 Sep 10, 2022
CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that data.

CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that

Peter Baumgartner 29 Aug 9, 2022
Tablicate - Python library for easy table creation and output to terminal

Tablicate Tablicate - Python library for easy table creation and output to terminal Features Column-wise justification alignment (left, right, center)

null 2 Mar 12, 2022
Python3 library for multimedia functions at the command terminal

TERMINEDIA This is a Python library allowing using a text-terminal as a low-resolution graphics output, along with keyboard realtime reading, and a co

Joao S. O. Bueno 82 Aug 9, 2022
frogtrade9000 - a command-line Rich client for the freqtrade REST API

frogtrade9000 - a command-line Rich client for the freqtrade REST API I found FreqUI too cumbersome and slow on my Raspberry Pi 400 when running multi

Robert Davey 70 Sep 10, 2022
Format click help output nicely with rich.

rich-click Format click help output nicely with Rich. Click is a "Python package for creating beautiful command line interfaces". Rich is a "Python li

Phil Ewels 290 Sep 14, 2022
Module for converting 2D Python lists to fancy ASCII tables. Table2Ascii lets you display pretty tables in the terminal and on Discord.

table2ascii Module for converting 2D Python lists to a fancy ASCII/Unicode tables table2ascii ?? Installation ??‍?? Usage Convert lists to ASCII table

Jonah Lawrence 26 Jul 9, 2022
A useful and easy to use Terminal Timer made with Python.

Terminal SpeedCubeTimer Installation ¡No requirements! Just Download and play Usage Starts timer.py and you will see this. python timer.py Scramble

Achalogy 4 Jun 23, 2022
🌈 Lightweight Python package that makes it easy and fast to print terminal messages in colors. 🌈

?? Colorist for Python ?? Lightweight Python package that makes it easy and fast to print terminal messages in colors. Prerequisites Python 3.9 or hig

Jakob Bagterp 1 Feb 5, 2022
Python commandline tool for remembering linux/terminal commands

ehh Remember linux commands Commandline tool for remembering linux/terminal commands. It stores your favorite commands in ~/ehh.json in your homedir a

null 48 Sep 11, 2022
Objexplore is an interactive Python object explorer for the terminal.

Objexplore is an interactive Python object explorer for the terminal. Use it while debugging, or exploring a new library, or whatever! 9D1FAC73-B2A5-4

kylepollina 241 Aug 20, 2022
Display Images in your terminal with python

A python library to display images in the terminal

Pranav Baburaj 57 Aug 28, 2022
Features terminal for python

Features Terminal V1.0 (23/10/2021) Um programa para linux com diferentes ferramentas! Recursos: Criador de QR code Gerador de senhas Teste de velocid

null 1 Oct 26, 2021
A simple terminal-based localhost chat application written in python

Chat House A simple terminal-based localhost chat application written in python How to Use? Clone the repo git clone https://github.com/heksadecimal/c

Heks 10 Nov 9, 2021