question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

[BUG] Flickering large progress display on Alacritty

See original GitHub issue

Describe the bug

I have a progress bar that sometimes has up to 20 items, and it flickers kind of annoyingly.

I made a representative example that flickers:

from rich.progress import (
    Progress,
    TimeElapsedColumn,
    SpinnerColumn,
    TimeRemainingColumn,
    TransferSpeedColumn,
    BarColumn,
    DownloadColumn,
)
from rich.console import Console
import time


def gen_stream():
    for i in range(20):
        msg = {"bar": i, "total": 1, "completed": 0}
        yield msg
    for i in range(20_000):
        cycle = int(i / 20)
        bar_num = i % 20
        msg = {"bar": bar_num, "total": 1000, "completed": cycle}
        yield msg


def main():
    console = Console(record=True)
    bars = {}

    with Progress(
        SpinnerColumn(),
        BarColumn(),
        DownloadColumn(),
        TransferSpeedColumn(),
        TimeElapsedColumn(),
        TimeRemainingColumn(),
        console=console,
        transient=True,
    ) as progress:

        for msg in gen_stream():
            bar = msg["bar"]
            if bar not in bars:
                bars[bar] = progress.add_task("bar1", start=False, total=1)
            else:
                to_update = {}
                task_id = bars[bar]
                task = progress._tasks[task_id]
                if not task.started:
                    progress.start_task(bars[bar])
                if task.total == 1:
                    to_update["total"] = msg["total"]
                to_update["completed"] = msg["completed"]

                progress.update(task_id, **to_update)
            time.sleep(0.01)


if __name__ == "__main__":
    main()

Platform

Mac OSX with Alacritty

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

Mac OSX with Alacritty as a terminal, however Iโ€™ve had the same issue on a Linux box as well. NOTE: It seems to perform fine on iterm

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:

poetry run python -m rich.diagnose
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ <class 'rich.console.Console'> โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ A high level console interface.                                                  โ”‚
โ”‚                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ <console width=205 ColorSystem.TRUECOLOR>                                    โ”‚ โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚                                                                                  โ”‚
โ”‚     color_system = 'truecolor'                                                   โ”‚
โ”‚         encoding = 'utf-8'                                                       โ”‚
โ”‚             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> โ”‚
โ”‚           height = 53                                                            โ”‚
โ”‚    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=205, height=53),             โ”‚
โ”‚                        legacy_windows=False,                                     โ”‚
โ”‚                        min_width=1,                                              โ”‚
โ”‚                        max_width=205,                                            โ”‚
โ”‚                        is_terminal=True,                                         โ”‚
โ”‚                        encoding='utf-8',                                         โ”‚
โ”‚                        max_height=53,                                            โ”‚
โ”‚                        justify=None,                                             โ”‚
โ”‚                        overflow=None,                                            โ”‚
โ”‚                        no_wrap=False,                                            โ”‚
โ”‚                        highlight=None,                                           โ”‚
โ”‚                        markup=None,                                              โ”‚
โ”‚                        height=None                                               โ”‚
โ”‚                    )                                                             โ”‚
โ”‚            quiet = False                                                         โ”‚
โ”‚           record = False                                                         โ”‚
โ”‚         safe_box = True                                                          โ”‚
โ”‚             size = ConsoleDimensions(width=205, height=53)                       โ”‚
โ”‚        soft_wrap = False                                                         โ”‚
โ”‚           stderr = False                                                         โ”‚
โ”‚            style = None                                                          โ”‚
โ”‚         tab_size = 8                                                             โ”‚
โ”‚            width = 205                                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
poetry show rich
 poetry show rich
name         : rich
version      : 10.16.2
description  : Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal

dependencies
 - colorama >=0.4.0,<0.5.0
 - commonmark >=0.9.0,<0.10.0
 - pygments >=2.6.0,<3.0.0
 - typing-extensions >=3.7.4,<5.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
mmu094commented, Oct 17, 2022

Adding rails!!

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Sergey Polzunov @.> Sent: Monday, October 17, 2022 3:59:51 PM To: Textualize/rich @.> Cc: mmu094 @.>; Comment @.> Subject: Re: [Textualize/rich] [BUG] Flickering large progress display on Alacritty (Issue #2139)

Iโ€™m experiencing a similar issue โ€“ wild flickering in the iTerm if the hyperlink output is used. Not only that, CPU usage of iTerm2 jumps to 70-80%. Setting refresh_per_second to 5 seconds helped a bit when only a few progress bars are shown, but has no effect on flickering with, say, 20 progress bars active

โ€” Reply to this email directly, view it on GitHubhttps://github.com/Textualize/rich/issues/2139#issuecomment-1280678187, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX2N6YFVUFJGRXM6Y5I3W4LWDUWSPANCNFSM5SGJC3VA. You are receiving this because you commented.Message ID: @.***>

0reactions
trautcommented, Oct 17, 2022

Iโ€™m experiencing a similar issue โ€“ wild flickering in the iTerm if the hyperlink output is used. Not only that, CPU usage of iTerm2 jumps to 70-80%. Setting refresh_per_second to 5 seconds helped a bit when only a few progress bars are shown, but has no effect on flickering with, say, 20 progress bars active

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alacritty flickering on changing workspace : r/i3wm - Reddit
I installed i3-gaps and Alacritty, but whenever I would switch workspaces Alacritty ... Ueberzug not displaying image properly in Alacritty.
Read more >
Game Update 7.0 - Legacy of the Sith Known Issues - SWTOR
This bug is preventing players from completing the Mission without taking damage unless they use Quick Travel. There is a typo in the...
Read more >
Emily Dickinson Poems
The life doth prove the precept, who obey shall happy be,. Who will not serve the sovereign, be hanged on fatal tree. The...
Read more >
Chocolatey Software | Alacritty (Portable) 0.11.0-rc1
Chocolatey is software management automation for Windows that wraps installers, executables, zips, and scripts into compiled packages.
Read more >
Destiny 2 Season of the Haunted Patch Notes - Solar, Vault ...
Fixed a bug that would cause a flashing effect that could potentially ... Weapon Crafting: Reduced the amount of time it takes to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found