or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

basic-logging.mdindex.mdprogress-bars.mdworkers.md
tile.json

tessl/pypi-proglog

Log and progress bar manager for console, notebooks, web applications with unified APIs and nested progress tracking.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/proglog@0.1.x

To install, run

npx @tessl/cli install tessl/pypi-proglog@0.1.0

index.mddocs/

Proglog

A comprehensive progress logging system for Python that enables developers to add flexible progress bars and logging capabilities to their applications. Proglog offers unified APIs for displaying progress across different environments including console applications, Jupyter notebooks, and web interfaces, with support for nested progress bars, selective display control, custom callback functions, and integration with popular progress bar libraries like tqdm.

Package Information

  • Package Name: proglog
  • Language: Python
  • Installation: pip install proglog

Core Imports

import proglog

Common imports for basic usage:

from proglog import ProgressLogger, TqdmProgressBarLogger, default_bar_logger

For notebook integration:

from proglog import notebook

Basic Usage

from proglog import default_bar_logger
import time

def my_routine(iterations=10, logger='bar'):
    """Run several loops to showcase Proglog."""
    logger = default_bar_logger(logger)  # Create appropriate logger
    
    # Nested progress bars with automatic tracking
    for i in logger.iter_bar(iteration=range(iterations)):
        for j in logger.iter_bar(animal=["dog", "cat", "rat", "duck"]):
            time.sleep(0.02)  # simulate some work
            
    # Manual progress updates
    logger(message="Processing complete!")

# Run with default tqdm progress bars
my_routine()

# Run silently 
my_routine(logger=None)

# Run with custom configuration
from proglog import TqdmProgressBarLogger
custom_logger = TqdmProgressBarLogger(ignored_bars=["animal"])
my_routine(logger=custom_logger)

Architecture

Proglog uses a hierarchical logger architecture that separates concerns:

  • ProgressLogger: Base logging class with state management and message logging
  • ProgressBarLogger: Extends logging with multiple named progress bar management
  • TqdmProgressBarLogger: Concrete implementation using tqdm for display
  • Worker Loggers: Specialized loggers for Redis Queue (RQ) worker integration
  • Factory Functions: Convenience functions for logger instantiation and configuration

This design enables maximum reusability across different deployment contexts, allowing users to control which progress bars are displayed without modifying the underlying code, and enabling complex applications to manage multiple concurrent progress tracking operations with hierarchical organization and customizable output formats.

Capabilities

Basic Progress Logging

Core logging functionality with state management, message logging, and iteration tracking. Provides the foundation for all other proglog capabilities.

class ProgressLogger:
    def __init__(self, init_state=None): ...
    def log(self, message): ...
    def dump_logs(self, filepath=None): ...
    def callback(self, **kw): ...
    def store(self, **kw): ...
    def iter(self, **kw): ...
    def __call__(self, **kw): ...

Basic Logging

Progress Bar Management

Advanced progress bar functionality with support for multiple named bars, selective display control, and automatic tracking during iteration. Includes both generic bar management and tqdm-powered display.

class ProgressBarLogger(ProgressLogger):
    def __init__(self, init_state=None, bars=None, ignored_bars=None, 
                 logged_bars="all", min_time_interval=0, ignore_bars_under=0): ...
    def iter_bar(self, bar_prefix="", **kw): ...
    def bars_callback(self, bar, attr, value, old_value=None): ...

class TqdmProgressBarLogger(ProgressBarLogger):
    def __init__(self, init_state=None, bars=None, leave_bars=False,
                 ignored_bars=None, logged_bars="all", notebook="default",
                 print_messages=True, min_time_interval=0, ignore_bars_under=0): ...

Progress Bars

Worker Integration

Redis Queue (RQ) worker integration for progress tracking in distributed job processing environments. Enables progress state persistence and retrieval across worker processes.

class RqWorkerProgressLogger:
    def __init__(self, job): ...
    def callback(self, **kw): ...

class RqWorkerBarLogger(RqWorkerProgressLogger, ProgressBarLogger):
    def __init__(self, job, init_state=None, bars=None, ignored_bars=(), 
                 logged_bars="all", min_time_interval=0): ...

Worker Integration

Utility Functions

Logger Factory

def default_bar_logger(logger, bars=None, ignored_bars=None, logged_bars="all", 
                      min_time_interval=0, ignore_bars_under=0):
    """
    Factory function to create appropriate logger based on type.
    
    Parameters:
    - logger: "bar" for TqdmProgressBarLogger, None for MuteProgressBarLogger, 
             or existing logger instance
    - bars: Bar configuration (None, list, tuple, or dict)
    - ignored_bars: Bars to ignore (None, list, or "all_others")
    - logged_bars: Bars to log ("all" or list of bar names)
    - min_time_interval: Minimum time between updates (seconds)
    - ignore_bars_under: Ignore bars with fewer than N items
    
    Returns:
    Configured logger instance
    """

Global Configuration

def notebook(turn="on"):
    """
    Configure global notebook mode setting.
    
    Parameters:
    - turn: "on" to enable notebook mode, any other value to disable
    """

Silent Logger

class MuteProgressBarLogger(ProgressBarLogger):
    """Silent progress bar logger that ignores all bars."""
    def bar_is_ignored(self, bar): ...  # Always returns True

Version Information

__version__: str  # Package version string (currently "0.1.12")