Enlighten Progress Bar is a console progress bar library for Python
npx @tessl/cli install tessl/pypi-enlighten@1.14.0A Python console progress bar library that allows writing to stdout and stderr without redirection. Enlighten supports multiple concurrent progress bars, extensive customization options, real-time rate calculations, multicolored subcounters, and experimental Jupyter Notebook compatibility.
pip install enlightenimport enlightenStandard pattern for most use cases:
from enlighten import get_managerFor specific components:
from enlighten import Counter, Manager, StatusBar, SubCounter, EnlightenWarning, Justify, format_timeOptional import (may not be available in all environments):
from enlighten import NotebookManagerimport enlighten
import time
# Get a manager instance (auto-detects TTY vs notebook environment)
manager = enlighten.get_manager()
# Create a progress bar
pbar = manager.counter(total=100, desc='Processing', unit='items')
# Update progress
for i in range(100):
time.sleep(0.1) # Simulate work
pbar.update()
# Clean up
manager.stop()Enlighten uses a manager-counter architecture:
The library automatically detects the environment (TTY vs Jupyter notebook) and uses the appropriate manager implementation for optimal display.
Core manager functionality for creating and controlling progress bar displays, including TTY detection, multiple concurrent bars, and environment-specific rendering.
def get_manager(stream=None, counter_class=Counter, **kwargs): ...
class Manager:
def __init__(self, stream=None, counter_class=Counter, status_bar_class=StatusBar,
set_scroll=True, companion_stream=None, enabled=True,
no_resize=False, threaded=None, width=None, **kwargs): ...
def counter(self, position=None, **kwargs): ...
def status_bar(self, *args, **kwargs): ...
def write(self, output='', flush=True, counter=None, **kwargs): ...
def remove(self, counter): ...
def stop(self): ...
def __enter__(self): ...
def __exit__(self, *args): ...
class NotebookManager:
def __init__(self, counter_class=Counter, status_bar_class=StatusBar,
enabled=True, width=100, **kwargs): ...
def counter(self, **kwargs): ...
def status_bar(self, *args, **kwargs): ...
def write(self, output='', flush=True, counter=None, **kwargs): ...
def remove(self, counter): ...
def stop(self): ...
def __enter__(self): ...
def __exit__(self, *args): ...Progress bar and counter functionality with customizable formatting, rate calculations, ETAs, and visual styling options.
class Counter:
def __init__(self, total=None, desc=None, unit=None, count=0, enabled=True,
manager=None, stream=None, color=None, bar_format=None,
counter_format=None, all_fields=False, fill=' ', fields=None,
leave=True, min_delta=0.1, offset=0, series=None, **kwargs): ...
def update(self, incr=1, force=False, **fields): ...
def add_subcounter(self, color, count=0, all_fields=None): ...
def format(self, width=None, elapsed=None): ...
def refresh(self, flush=True, elapsed=None): ...
def clear(self, flush=True): ...
def close(self, clear=False): ...
def reset(self): ...
def __enter__(self): ...
def __exit__(self, *args): ...
def __call__(self, iterable): ...
@property
def count(self): ...
@property
def elapsed(self): ...
@property
def rate(self): ...
@property
def subcount(self): ...
class SubCounter:
def __init__(self, parent, color=None, count=0, all_fields=False): ...
def update(self, incr=1, force=False): ...
def update_from(self, source, incr=1, force=False): ...
@property
def count(self): ...
@property
def parent(self): ...Status bar functionality for displaying text-based status updates with formatting and justification options.
class StatusBar:
def __init__(self, enabled=True, color=None, fields=None, fill=' ',
justify=Justify.LEFT, leave=True, min_delta=0.1,
status_format='{message}', manager=None, **kwargs): ...
def update(self, *args, force=False, **kwargs): ...
def format(self, width=None, elapsed=None): ...
def refresh(self, flush=True, elapsed=None): ...
def clear(self, flush=True): ...
def close(self, clear=False): ...
def reset(self): ...
def __enter__(self): ...
def __exit__(self, *args): ...
def __call__(self, iterable): ...
@property
def elapsed(self): ...Helper functions and classes for time formatting, warnings, text justification, and HTML conversion.
def format_time(seconds): ...
def warn_best_level(message, category): ...
class Justify:
CENTER = 'center'
LEFT = 'ljust'
RIGHT = 'rjust'
class EnlightenWarning(Warning): ...
class HTMLConverter:
def __init__(self, term): ...
def to_html(self, text): ...
@property
def style(self): ...
class Lookahead:
def __init__(self, iterator): ...
def __getitem__(self, key): ...# Type aliases for common parameter types
StreamType = typing.TextIO
ColorType = typing.Union[str, typing.Tuple[int, int, int]]