A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
npx @tessl/cli install tessl/pypi-alive-progress@3.3.0A new kind of Progress Bar with real-time throughput, ETA, and very cool animations! Alive Progress provides an animated progress bar library for Python that displays real-time animated progress indicators with comprehensive visual feedback including live spinners, accurate ETA calculations, multithreaded bar updates, and extensive customization options.
pip install alive-progressfrom alive_progress import alive_bar, alive_it, config_handlerAdditional imports for styles and customization:
from alive_progress.styles import show_spinners, show_bars, show_themes, showtime, Show, BARS, SPINNERS, THEMES
from alive_progress.animations import bar_factory, frame_spinner_factory, scrolling_spinner_factory
from alive_progress.tools import print_charsfrom alive_progress import alive_bar
import time
# Basic progress bar with known total
with alive_bar(100, title='Processing') as bar:
for i in range(100):
time.sleep(0.1) # simulate work
bar() # advance the barfrom alive_progress import alive_it
import time
items = range(100)
for item in alive_it(items, title='Processing Items'):
time.sleep(0.05) # simulate processing
# No need to call bar() - automatically managedfrom alive_progress import alive_bar
# Progress bar without known total
with alive_bar(title='Processing') as bar:
for item in some_iterable():
process_item(item) # simulate work
bar() # advance counterAlive Progress uses a multithreaded architecture with the following key components:
alive_bar context manager that orchestrates all componentsbar(), properties, methods)The design enables smooth visual feedback while maintaining low CPU overhead through calibrated refresh rates and efficient animation compilation.
Core progress bar functionality with context managers, iterator adapters, manual and automatic modes, pause/resume capabilities, and comprehensive progress monitoring.
def alive_bar(total: Optional[int] = None, *, calibrate: Optional[int] = None, **options: Any):
"""Create an alive progress bar context manager."""
def alive_it(it: Collection[T], total: Optional[int] = None, *,
finalize: Callable[[Any], None] = None,
calibrate: Optional[int] = None, **options: Any) -> Iterable[T]:
"""Iterator adapter that automatically tracks progress."""Global and local configuration system for customizing bar appearance, behavior, widgets, and output formatting across all progress bars or individual instances.
config_handler.set_global(**options)
config_handler.reset()
config_handler.create_context(**options)Comprehensive styling system with predefined spinners, bars, and themes, plus factories for creating custom animations and visual effects.
def showtime(show=Show.SPINNERS, *, fps=None, length=None, pattern=None):
"""Display animated demos of all available styles."""
def show_spinners(*, fps=None, length=None, pattern=None):
"""Show all available spinner animations."""
def show_bars(*, fps=None, length=None, pattern=None):
"""Show all available bar styles."""
def show_themes(*, fps=None, length=None, pattern=None):
"""Show all available themes."""Advanced animation creation system with factories for custom spinners and bars, supporting frame-based, scrolling, bouncing, sequential, and delayed animations.
def bar_factory(**options):
"""Create custom bar animations."""
def frame_spinner_factory(frames, **options):
"""Create frame-based spinners."""
def scrolling_spinner_factory(chars, **options):
"""Create horizontally scrolling spinner animations."""
def bouncing_spinner_factory(chars, **options):
"""Create spinners that bounce back and forth."""Development and debugging utilities for character discovery and terminal testing, primarily useful for creating custom animations and testing Unicode support.
def print_chars(line_length: int = 32, max_char: int = 0x20000):
"""Print Unicode characters to help find characters for custom spinners/bars."""from typing import Optional, Any, Callable, Collection, Iterable, TypeVar
from collections.abc import Collection, Iterable
from types import FunctionType
from enum import Enum
T = TypeVar('T')
class Show(Enum):
SPINNERS = "SPINNERS"
BARS = "BARS"
THEMES = "THEMES"
# Bar Handle Interface (returned by alive_bar context manager)
class AliveBarHandle:
# Callable interface
def __call__(self, count: int = 1, *, skipped: bool = False) -> None: ...
# Read-only properties
@property
def current(self) -> Union[int, float]: ...
@property
def monitor(self) -> str: ...
@property
def rate(self) -> str: ...
@property
def eta(self) -> str: ...
@property
def elapsed(self) -> float: ...
@property
def receipt(self) -> str: ...
# Assignable properties
@property
def text(self) -> Optional[str]: ...
@text.setter
def text(self, value: Optional[str]) -> None: ...
@property
def title(self) -> Optional[str]: ...
@title.setter
def title(self, value: Optional[str]) -> None: ...
# Methods
def pause(self) -> Any: ... # Context manager