Enlighten Progress Bar is a console progress bar module for Python. It allows writing to stdout and stderr without any redirection, offering features for single or multiple progress bars, counters, and status bars, with experimental support for Jupyter Notebooks. As of version 1.14.1, it is actively maintained with regular updates and bug fixes.
pip install enlightenVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `enlighten` to create and manage multiple progress bars, allowing interleaved console output. It's crucial to call `manager.stop()` for proper cleanup.
Close progress bars when complete, or manage terminal height; for multi-threaded/processed applications, ensure `threaded=True` is passed to `get_manager()` to defer resize handling if other writes are expected.
Enable 'Emulate terminal in output console' in PyCharm run configurations (Run -> Edit Configurations -> Templates -> Python).
To remove a bar immediately upon closing, call `counter.close(clear=True)`. Alternatively, set `leave=False` when creating the counter if you want it to be removed automatically by `manager.stop()` or when other bars take its place.
Always call `manager.stop()` when all progress bars are finished or use the `manager` as a context manager (`with enlighten.get_manager() as manager: ...`).
Upgrade to `enlighten` 1.12.0 or newer to ensure `elapsed` time accurately reflects active progress.
If your application relied on the old behavior, adjust your output logic. For the new behavior, upgrade to `enlighten` 0.14.0 or newer.
Run `pip install enlighten` in your terminal to install the library.
In PyCharm, enable 'Emulate terminal in output console' in your Run/Debug configuration settings. For other environments, ensure your console supports VT escape codes or try running directly from a command prompt.
Enlighten attempts to defer resize handling in threaded/multiprocess environments. Ensure Enlighten is aware of threading by setting `threaded=True` or `multiprocess=True` when initializing the manager (e.g., `enlighten.get_manager(threaded=True)`). If the problem persists, careful synchronization of writes to standard streams is necessary.
To ensure a progress bar clears from the screen upon completion, call `counter.close(clear=True)` or set `leave=False` when creating the counter.
Provide custom `bar_format` and `counter_format` arguments to your counter or manager that support float formatting. For example: `manager.counter(total=10.0, desc='Progress', unit='items', bar_format='{desc}{desc_pad}{percentage:3.1f}%|{bar}|')`No dependency data recorded yet.