Skip to content

Commit

Permalink
Merge pull request #3 from boegel/show_progress
Browse files Browse the repository at this point in the history
use random spinner in progress bar
  • Loading branch information
nordmoen authored Sep 11, 2021
2 parents 5a2276d + 33df74b commit 5c3bd50
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions easybuild/tools/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
:author: Kenneth Hoste (Ghent University)
:author: Jørgen Nordmoen (University of Oslo)
"""
import random

try:
from rich.progress import Progress, TextColumn, BarColumn, TimeElapsedColumn
from rich.progress import BarColumn, Progress, SpinnerColumn, TextColumn, TimeElapsedColumn
HAVE_RICH = True
except ImportError:
HAVE_RICH = False
Expand Down Expand Up @@ -62,11 +64,15 @@ def create_progress_bar():
or a shim DummyProgress instance otherwise.
"""
if HAVE_RICH:

# pick random spinner, from a selected subset of available spinner (see 'python3 -m rich.spinner')
spinner = random.choice(('aesthetic', 'arc', 'bounce', 'dots', 'line', 'monkey', 'point', 'simpleDots'))

progress_bar = Progress(
TextColumn("[bold blue]Installing {task.description} ({task.completed:.0f}/{task.total})"),
BarColumn(),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
SpinnerColumn(spinner),
TimeElapsedColumn(),
transient=True,
)
Expand Down

0 comments on commit 5c3bd50

Please sign in to comment.