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

Overview

Rich

PyPI version codecov Rich blog Twitter Follow

中文 readmelengua española readmeLäs på svenska

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 8 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 function

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

Rich Inspect

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

>>> from rich import inspect
>>> inspect(str, methods=True)

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

Console logging

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

Project using Rich

Here are a few projects using Rich:

Comments
  • 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
  • [BUG] rich.prograss.track() Prograss Bar without color

    [BUG] rich.prograss.track() Prograss Bar without color

    Describe the bug I want use rich colorful terminal progress bar to monitor training processing by PyTorch module. You can see the code here

      for i, (image, mask) in track(enumerate(train_loader), description=f"train_{epoch}", total=len(train_loader)):
          image, mask = image.to(device), mask.to(device)
    
          predict_image = net(image)
          train_loss = loss_function(predict_image, mask)
          loss_list = np.append(loss_list, train_loss.item())
    
          opt.zero_grad()
          train_loss.backward()
          opt.step()
    
          train_preds = torch.cat((train_preds, predict_image.cpu().detach()), 0)
          train_truths = torch.cat((train_truths, mask.cpu().detach()), 0)
    
    
          _image = image[0]
          _mask = mask[0]
          _pred_image = predict_image[0]
    
          _pred_image[_pred_image >= threshold] = 1
          _pred_image[_pred_image < threshold] = 0
    
          vaisual_image = torch.stack([_image, _mask, _pred_image], dim=0)
          torchvision.utils.save_image(vaisual_image, os.path.join(monitor_path, 'train', f'{i}.png'))
    

    But the bar is without color and in a high flicker.

    Platform

    Win and Powershell

    │ │ │ color_system = 'truecolor' │ │ encoding = 'utf-8' │ │ file = <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> │ │ height = 30 │ │ is_alt_screen = False │ │ is_dumb_terminal = False │ │ is_interactive = True │ │ is_jupyter = False │ │ is_terminal = True │ │ legacy_windows = False │ │ no_color = False │ │ options = ConsoleOptions( │ │ size=ConsoleDimensions(width=120, height=30), │ │ legacy_windows=False, │ │ min_width=1, │ │ max_width=120, │ │ is_terminal=True, │ │ encoding='utf-8', │ │ max_height=30, │ │ justify=None, │ │ overflow=None, │ │ no_wrap=False, │ │ highlight=None, │ │ markup=None, │ │ height=None │ │ ) │ │ quiet = False │ │ record = False │ │ safe_box = True │ │ size = ConsoleDimensions(width=120, height=30) │ │ soft_wrap = False │ │ stderr = False │ │ style = None │ │ tab_size = 8 │ │ width = 120

    Can't reproduce 
    opened by PinkR1ver 17
  • [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
  • [BUG] Triple quotations highlighted inconsistently

    [BUG] Triple quotations highlighted inconsistently

    • [x] I've checked docs and closed issues for possible solutions.
    • [x] I can't find my issue in the FAQ.

    Describe the bug

    image

    Triple-quotes (""") get rendered as open-and-closed quotes with one extra quote after if there is no text on the same line.

    To reproduce:

    from rich import print
    
    print('my_function(argument="""\ntest\n""")')
    

    Provide a minimal code example that demonstrates the issue if you can. If the issue is visual in nature, consider posting a screenshot.

    Platform

    Click to expand

    What platform (Win/Linux/Mac) are you running on? What terminal software are you using?

    Win11, happens in both vscode terminal and Windows Terminal

    I may ask you to copy and paste the output of the following commands. It may save some time if you do it now.

    If you're using Rich in a terminal:

    python -m rich.diagnose
    pip freeze | grep rich
    

    ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── <class 'rich.console.Console'> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ A high level console interface. │ │ │ │ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ color_system = 'truecolor' │ │ encoding = 'utf-8' │ │ file = <_io.TextIOWrapper name='' mode='w' encoding='utf-8'> │ │ height = 31 │ │ is_alt_screen = False │ │ is_dumb_terminal = False │ │ is_interactive = True │ │ is_jupyter = False │ │ is_terminal = True │ │ legacy_windows = False │ │ no_color = False │ │ options = ConsoleOptions(size=ConsoleDimensions(width=369, height=31), legacy_windows=False, min_width=1, max_width=369, is_terminal=True, encoding='utf-8', max_height=31, justify=None, overflow=None, no_wrap=False, highlight=None, markup=None, height=None) │ │ quiet = False │ │ record = False │ │ safe_box = True │ │ size = ConsoleDimensions(width=369, height=31) │ │ soft_wrap = False │ │ stderr = False │ │ style = None │ │ tab_size = 8 │ │ width = 369 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭── <class 'rich._windows.WindowsConsoleFeatures'> ───╮ │ Windows features available. │ │ │ │ ╭─────────────────────────────────────────────────╮ │ │ │ WindowsConsoleFeatures(vt=True, truecolor=True) │ │ │ ╰─────────────────────────────────────────────────╯ │ │ │ │ truecolor = True │ │ vt = True │ ╰─────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────── Environment Variables ─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ {'TERM': None, 'COLORTERM': 'truecolor', 'CLICOLOR': None, 'NO_COLOR': None, 'TERM_PROGRAM': 'vscode', 'COLUMNS': None, 'LINES': None, 'JUPYTER_COLUMNS': None, 'JUPYTER_LINES': None, 'JPY_PARENT_PID': None, 'VSCODE_VERBOSE_LOGGING': None} │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ platform="Windows"

    If you're using Rich in a Jupyter Notebook, run the following snippet in a cell and paste the output in your bug report.

    from rich.diagnose import report
    report()
    
    Needs triage 
    opened by torshepherd 2
  • Bump sphinx from 5.1.1 to 6.1.1

    Bump sphinx from 5.1.1 to 6.1.1

    Bumps sphinx from 5.1.1 to 6.1.1.

    Release notes

    Sourced from sphinx's releases.

    v6.1.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.1.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b2

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.3.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.2.3

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.2.2

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.2.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.2.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 6.1.1 (released Jan 05, 2023)

    Bugs fixed

    • #11091: Fix util.nodes.apply_source_workaround for literal_block nodes with no source information in the node or the node's parents.

    Release 6.1.0 (released Jan 05, 2023)

    Dependencies

    Incompatible changes

    • #10979: gettext: Removed support for pluralisation in get_translation. This was unused and complicated other changes to sphinx.locale.

    Deprecated

    • sphinx.util functions:

      • Renamed sphinx.util.typing.stringify() to sphinx.util.typing.stringify_annotation()
      • Moved sphinx.util.xmlname_checker() to sphinx.builders.epub3._XML_NAME_PATTERN

      Moved to sphinx.util.display:

      • sphinx.util.status_iterator
      • sphinx.util.display_chunk
      • sphinx.util.SkipProgressMessage
      • sphinx.util.progress_message

      Moved to sphinx.util.http_date:

      • sphinx.util.epoch_to_rfc1123
      • sphinx.util.rfc1123_to_epoch

      Moved to sphinx.util.exceptions:

      • sphinx.util.save_traceback

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • [BUG]: prompt.Confirm prevent accidental confirm

    [BUG]: prompt.Confirm prevent accidental confirm

    • [x] I've checked docs and closed issues for possible solutions.
    • [x] I can't find my issue in the FAQ.

    Describe the bug

    You may want to patch this outright or add a kwarg. If you type enter accidentally (for example, a user might press enter twice by accident (or they might hold the enter key slightly too long) when starting a program) then when the input is read by prompt.Confirm it will breeze right on through because it accepted that input that was buffered in stdin as the input for the Confirm prompt.

    This might be intended behavior but I would suggest that it is often not. If someone wants to skip confirm prompts then they could use the program yes with its 10Gb/s confirmation power...

    This could be mitigated with a function that looks like this and calling it right before input is read

    def clear_input():
        if platform.system() == "Linux":
            from termios import TCIFLUSH, tcflush
            tcflush(sys.stdin, TCIFLUSH)
        elif platform.system() == "Windows":
            import msvcrt
            # Try to flush the buffer
            while msvcrt.kbhit():
                msvcrt.getch()
    
    Needs triage 
    opened by chapmanjacobd 2
  • [REQUEST] pexpect and rich combination

    [REQUEST] pexpect and rich combination

    Hello! I use the pexpect module for automation and specifically its pexpect.spawn() and pexpect.interact() methods. Tried different things using rich, but I would like to fully process the output from interact. It is possible to fully process through the output_filter in the interact() method. But there are nuances.

    1. There byte string
    2. If logfile is used, completely colors the entire file.

    I did not find similar requests, so it will be interesting to hear a response from the community.

    Needs triage 
    opened by aztec102 1
  • [BUG] Ellipsis isn't printed in PyCharm

    [BUG] Ellipsis isn't printed in PyCharm

    • [x] I've checked docs and closed issues for possible solutions.
    • [x] I can't find my issue in the FAQ.

    Describe the bug I'm using Rich in PyCharm.

    When I try to print a string with an ellipsis in it, it doesn't print. Note that I have to force_terminal to get colours to work, I don't think that's related though.

    import rich
    
    rich.reconfigure(force_terminal=True)
    
    rich.print("[1, 2, ..., 3, 4]")
    

    Results in: image

    This happens in the PyCharm Python Console with or without IPython.

    However, this doesn't happen in the PyCharm Python Debugger (making it a pain to track down the issue!). image

    Platform

    Click to expand

    Windows 11 PyCharm 2022.3.1 The console is running in WSL.

    I ran this report in both the standard PyCharm Python Console (where the issue occurs, that's what's pasted below) and the Debugger, and the settings were the same except for the file.

    rich.diagnose.report()
    ╭─────────────────────── <class 'rich.console.Console'> ───────────────────────╮
    │ A high level console interface.                                              │
    │                                                                              │
    │ ╭──────────────────────────────────────────────────────────────────────────╮ │
    │ │ <console width=80 None>                                                  │ │
    │ ╰──────────────────────────────────────────────────────────────────────────╯ │
    │                                                                              │
    │     color_system = None                                                      │
    │         encoding = 'utf-8'                                                   │
    │             file = <_io.TextIOWrapper name='<stdout>' mode='w'               │
    │                    encoding='utf-8'>                                         │
    │           height = 25                                                        │
    │    is_alt_screen = False                                                     │
    │ is_dumb_terminal = False                                                     │
    │   is_interactive = False                                                     │
    │       is_jupyter = False                                                     │
    │      is_terminal = False                                                     │
    │   legacy_windows = False                                                     │
    │         no_color = False                                                     │
    │          options = ConsoleOptions(                                           │
    │                        size=ConsoleDimensions(width=80, height=25),          │
    │                        legacy_windows=False,                                 │
    │                        min_width=1,                                          │
    │                        max_width=80,                                         │
    │                        is_terminal=False,                                    │
    │                        encoding='utf-8',                                     │
    │                        max_height=25,                                        │
    │                        justify=None,                                         │
    │                        overflow=None,                                        │
    │                        no_wrap=False,                                        │
    │                        highlight=None,                                       │
    │                        markup=None,                                          │
    │                        height=None                                           │
    │                    )                                                         │
    │            quiet = False                                                     │
    │           record = False                                                     │
    │         safe_box = True                                                      │
    │             size = ConsoleDimensions(width=80, height=25)                    │
    │        soft_wrap = False                                                     │
    │           stderr = False                                                     │
    │            style = None                                                      │
    │         tab_size = 8                                                         │
    │            width = 80                                                        │
    ╰──────────────────────────────────────────────────────────────────────────────╯
    ╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
    │ Windows features available.                           │
    │                                                       │
    │ ╭───────────────────────────────────────────────────╮ │
    │ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
    │ ╰───────────────────────────────────────────────────╯ │
    │                                                       │
    │ truecolor = False                                     │
    │        vt = False                                     │
    ╰───────────────────────────────────────────────────────╯
    ╭────── Environment Variables ───────╮
    │ {                                  │
    │     'TERM': 'xterm-256color',      │
    │     'COLORTERM': None,             │
    │     'CLICOLOR': None,              │
    │     'NO_COLOR': None,              │
    │     'TERM_PROGRAM': None,          │
    │     'COLUMNS': None,               │
    │     'LINES': None,                 │
    │     'JUPYTER_COLUMNS': None,       │
    │     'JUPYTER_LINES': None,         │
    │     'JPY_PARENT_PID': None,        │
    │     'VSCODE_VERBOSE_LOGGING': None │
    │ }                                  │
    ╰────────────────────────────────────╯
    platform="Linux"
    
    rich==12.6.0
    
    Needs triage 
    opened by davidgilbertson 1
  • [BUG] Live flickers when printing to console with markup=False

    [BUG] Live flickers when printing to console with markup=False

    • [x] I've checked docs and closed issues for possible solutions.
    • [x] I can't find my issue in the FAQ.

    I couldn't find any relevant issues for me, or at least I did not see the connection.

    Describe the bug

    When in a Live display, and when printing onto a console with Console.print(..., markup=True), the live will sometimes be rendered without markup as well, causing visual flicker.

    Minimum working example:

    import random
    import time
    
    from rich.console import Console
    from rich.live import Live
    
    console = Console()
    
    with Live(console=console, refresh_per_second=4) as live:
        while True:
            time.sleep(0.1)
            rdm = random.random()
            # This text should be printed raw or with markup in bold, depending on rdm.
            live.console.print("[bold]Some text[/bold]", markup=True if rdm >= 0.5 else False)
            # This text should be updated each cycle, but *always* with markup.
            live.update(f"[green]Random:[/green] {rdm}")
    

    I would expect that "markup=True" only affects the text I am using it with, and not the live.

    I thought that maybe one can stop the live, print the text without markup, and start the live again afterwards, but this doesn't work. If there are other means of synchronization, then I am not ware of them...

    I would be very grateful for help or any workaround.

    Platform

    Click to expand

    Platform Info

     chris@i61nb083  ~  lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 18.04.6 LTS
    Release:	18.04
    Codename:	bionic
     chris@i61nb083  ~  uname -a
    Linux i61nb083 5.4.0-126-generic #142~18.04.1-Ubuntu SMP Thu Sep 1 16:25:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
     chris@i61nb083  ~  python --version
    Python 3.6.9
    

    Output of python -m rich.diagnose

     (.venv)  chris@i61nb083  ~/tmp/mwe_rich  python -m rich.diagnose
    ╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
    │ A high level console interface.                                                  │
    │                                                                                  │
    │ ╭──────────────────────────────────────────────────────────────────────────────╮ │
    │ │ <console width=211 ColorSystem.TRUECOLOR>                                    │ │
    │ ╰──────────────────────────────────────────────────────────────────────────────╯ │
    │                                                                                  │
    │     color_system = 'truecolor'                                                   │
    │         encoding = 'utf-8'                                                       │
    │             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'> │
    │           height = 54                                                            │
    │    is_alt_screen = False                                                         │
    │ is_dumb_terminal = False                                                         │
    │   is_interactive = True                                                          │
    │       is_jupyter = False                                                         │
    │      is_terminal = True                                                          │
    │   legacy_windows = False                                                         │
    │         no_color = False                                                         │
    │          options = ConsoleOptions(                                               │
    │                        size=ConsoleDimensions(width=211, height=54),             │
    │                        legacy_windows=False,                                     │
    │                        min_width=1,                                              │
    │                        max_width=211,                                            │
    │                        is_terminal=True,                                         │
    │                        encoding='utf-8',                                         │
    │                        max_height=54,                                            │
    │                        justify=None,                                             │
    │                        overflow=None,                                            │
    │                        no_wrap=False,                                            │
    │                        highlight=None,                                           │
    │                        markup=None,                                              │
    │                        height=None                                               │
    │                    )                                                             │
    │            quiet = False                                                         │
    │           record = False                                                         │
    │         safe_box = True                                                          │
    │             size = ConsoleDimensions(width=211, height=54)                       │
    │        soft_wrap = False                                                         │
    │           stderr = False                                                         │
    │            style = None                                                          │
    │         tab_size = 8                                                             │
    │            width = 211                                                           │
    ╰──────────────────────────────────────────────────────────────────────────────────╯
    

    Output of pip freeze | grep rich

     (.venv)  chris@i61nb083  ~/tmp/mwe_rich  pip freeze | grep rich
    rich==12.6.0
    
    Needs triage 
    opened by christiandreher 1
Releases(v13.0.1)
  • v13.0.1(Jan 6, 2023)

    Fix for an issue where Segment.split_cells produced the wrong result.

    Mostly a hotfix for the benefit of Textual.

    [13.0.1] - 2023-01-06

    Fixed

    • Fixed issue with Segment.split_cells for mixed single and double cell widths
    Source code(tar.gz)
    Source code(zip)
  • v13.0.0(Dec 30, 2022)

    Some relatively minor fixes and improvements. The most significant update (and the reason for the major version bump) is that Rich has dropped Python3.6 support.

    If you are a Python3.6 user and can't upgrade for whatever reason, pin to version 12.6.0.

    [13.0.0] - 2022-12-30

    Fixed

    • Reversed pre and code tags in base HTML format https://github.com/Textualize/rich/pull/2642
    • Improved detection of attrs library, that isn't confused by the presence of the attr library.
    • Fixed issue with locals_max_length parameter not being respected in Traceback https://github.com/Textualize/rich/issues/2649
    • Handling of broken fileno made more robust. Fixes https://github.com/Textualize/rich/issues/2645
    • Fixed missing fileno on FileProxy

    Changed

    • Bumped minimum Python version to 3.7 https://github.com/Textualize/rich/pull/2567
    • Pretty-printing of "tagged" __repr__ results is now greedy when matching tags https://github.com/Textualize/rich/pull/2565
    • progress.track now supports deriving total from __length_hint__

    Added

    • Add type annotation for key_separator of pretty.Node https://github.com/Textualize/rich/issues/2625
    Source code(tar.gz)
    Source code(zip)
  • v12.6.0(Oct 2, 2022)

    NOTE: 12.6.0 may be the last version to support Python3.6. The next version will be 13.0.0, and will be Python3.7+

    [12.6.0] - 2022-10-02

    Added

    • Parse ANSI escape sequences in pretty repr https://github.com/Textualize/rich/pull/2470
    • Add support for FORCE_COLOR env var https://github.com/Textualize/rich/pull/2449
    • Allow a max_depth argument to be passed to the install() hook https://github.com/Textualize/rich/issues/2486
    • Document using None as name in __rich_repr__ for tuple positional args https://github.com/Textualize/rich/pull/2379
    • Add font_aspect_ratio parameter in SVG export https://github.com/Textualize/rich/pull/2539/files
    • Added Table.add_section method. https://github.com/Textualize/rich/pull/2544

    Fixed

    • Handle stdout/stderr being null https://github.com/Textualize/rich/pull/2513
    • Fix NO_COLOR support on legacy Windows https://github.com/Textualize/rich/pull/2458
    • Fix pretty printer handling of cyclic references https://github.com/Textualize/rich/pull/2524
    • Fix missing mode property on file wrapper breaking uploads via requests https://github.com/Textualize/rich/pull/2495
    • Fix mismatching default value of parameter ensure_ascii https://github.com/Textualize/rich/pull/2538
    • Remove unused height parameter in Layout class https://github.com/Textualize/rich/pull/2540
    • Fixed exception in Syntax.rich_measure for empty files

    Changed

    • Removed border from code blocks in Markdown
    Source code(tar.gz)
    Source code(zip)
  • 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)
Owner
Will McGugan
I'm a full-stack software developer, and Python expert. Creator of Rich and @PyFilesystem.
Will McGugan
Cleo allows you to create beautiful and testable command-line interfaces.

Cleo Create beautiful and testable command-line interfaces. Cleo is mostly a higher level wrapper for CliKit, so a lot of the components and utilities

Sébastien Eustace 984 Jan 2, 2023
Simple cross-platform colored terminal text in Python

Colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. PyPI for releases |

Jonathan Hartley 3k Jan 1, 2023
A CLI tool to build beautiful command-line interfaces with type validation.

Piou A CLI tool to build beautiful command-line interfaces with type validation. It is as simple as from piou import Cli, Option cli = Cli(descriptio

Julien Brayere 310 Dec 7, 2022
Python library that measures the width of unicode strings rendered to a terminal

Introduction This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. Problem Statement

Jeff Quast 305 Dec 25, 2022
Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments

Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments, that will make your code clear and readable.

Dallas 0 Jun 19, 2022
A simple terminal Christmas tree made with Python

Python Christmas Tree A simple CLI Christmas tree made with Python Installation Just clone the repository and run $ python terminal_tree.py More opti

Francisco B. 64 Dec 27, 2022
emoji terminal output for Python

Emoji Emoji for Python. This project was inspired by kyokomi. Example The entire set of Emoji codes as defined by the unicode consortium is supported

Taehoon Kim 1.6k Jan 2, 2023
A thin, practical wrapper around terminal capabilities in Python

Blessings Coding with Blessings looks like this... from blessings import Terminal t = Terminal() print(t.bold('Hi there!')) print(t.bold_red_on_brig

Erik Rose 1.4k Jan 7, 2023
plotting in the terminal

bashplotlib plotting in the terminal what is it? bashplotlib is a python package and command line tool for making basic plots in the terminal. It's a

Greg Lamp 1.7k Jan 2, 2023
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

null 3.2k Jan 9, 2023
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 23.6k Dec 31, 2022
Color text streams with a polished command line interface

colout(1) -- Color Up Arbitrary Command Output Synopsis colout [-h] [-r RESOURCE] colout [-g] [-c] [-l min,max] [-a] [-t] [-T DIR] [-P DIR] [-d COLORM

nojhan 1.1k Dec 21, 2022
Library for building powerful interactive command line applications in Python

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 8.1k Dec 30, 2022
prompt_toolkit is a library for building powerful interactive command line applications in Python.

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 8.1k Jan 4, 2023
Python and tab completion, better together.

argcomplete - Bash tab completion for argparse Tab complete all the things! Argcomplete provides easy, extensible command line tab completion of argum

Andrey Kislyuk 1.1k Jan 8, 2023
Python composable command line interface toolkit

$ click_ Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Comm

The Pallets Projects 13.3k Dec 31, 2022
Typer, build great CLIs. Easy to code. Based on Python type hints.

Typer, build great CLIs. Easy to code. Based on Python type hints. Documentation: https://typer.tiangolo.com Source Code: https://github.com/tiangolo/

Sebastián Ramírez 10.1k Jan 2, 2023
Python Command-line Application Tools

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022
Cement is an advanced Application Framework for Python, with a primary focus on CLI

Cement Framework Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introdu

Data Folk Labs, LLC 1.1k Dec 31, 2022