Registry / testing / enlighten

enlighten

JSON →
library1.14.1pypypi✓ verified 23d ago

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 enlighten
INSTALL
IMPORT
SIG · ENLIGHTEN
E
enlighten
testingpythonv1.14.1
Install
2.0s avg
Import
641ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.14.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.680s · 26.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.602s · 27MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_manager
from enlighten import get_manager
The primary entry point for managing multiple progress bars.
Counter
from enlighten import Counter
Used for individual progress bars or counters, often instantiated via a manager.
Justify
from enlighten import Justify
An Enum used for justifying status bar text.

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.

import time import enlighten # Get a manager instance to handle multiple progress bars manager = enlighten.get_manager() # Create two counters/progress bars ticks = manager.counter(total=100, desc='Ticks', unit='ticks') tocks = manager.counter(total=20, desc='Tocks', unit='tocks') for num in range(100): time.sleep(0.05) # Simulate work print(f"Working on item {num}") # Output outside progress bars ticks.update() if not num % 5: tocks.update() # Ensure all progress bars are cleaned up from the terminal manager.stop() print("Process complete!")
Debug
Known issues
gotchaTerminal output can become scrambled or cut off if the number of progress bars exceeds terminal height, or if other threads/processes write to standard streams simultaneously with a resize event.
fix
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.
affects: All versions
gotchaEnlighten does not work natively in the PyCharm Python console due to `sys.stdout` not referencing a valid TTY. It requires terminal emulation for 'Run' or 'Debug' modes.
fix
Enable 'Emulate terminal in output console' in PyCharm run configurations (Run -> Edit Configurations -> Templates -> Python).
affects: All versions
gotchaProgress bars created with a `Manager` might remain visible after `close()` is called if `leave=True` (the default) or `clear=True` is not explicitly used.
fix
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.
affects: All versions
gotchaFailing to call `manager.stop()` at the end of your program can leave progress bars on the terminal, consume resources, and prevent proper cleanup.
fix
Always call `manager.stop()` when all progress bars are finished or use the `manager` as a context manager (`with enlighten.get_manager() as manager: ...`).
affects: All versions
breakingPrior to version 1.12.0, the `elapsed` time on counters might continue to increment even after the counter was conceptually 'closed' or reached its total, leading to incorrect time measurements.
fix
Upgrade to `enlighten` 1.12.0 or newer to ensure `elapsed` time accurately reflects active progress.
affects: < 1.12.0
breakingBefore version 0.14.0, the column position of the progress bar was not preserved when updating, always returning to the start of the line. This behavior changed to preserve column position.
fix
If your application relied on the old behavior, adjust your output logic. For the new behavior, upgrade to `enlighten` 0.14.0 or newer.
affects: < 0.14.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'enlighten'
The 'enlighten' package is not installed in your Python environment.
fix
Run `pip install enlighten` in your terminal to install the library.
OSError: [WinError 6] The handle is invalid.
This error typically occurs on Windows, especially when running in an IDE like PyCharm, because the output console is not a true TTY and Enlighten cannot properly interact with the terminal handle.
fix
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.
RuntimeError: reentrant call
This error occurs when another thread or process writes to a standard stream (STDOUT/STDERR) at the same time Enlighten's resize signal handler is trying to write to the stream.
fix
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.
enlighten progress bar not clearing
By default, when a counter is closed, it might not be explicitly cleared from the screen, especially if `leave=True` or if no other bar takes its place.
fix
To ensure a progress bar clears from the screen upon completion, call `counter.close(clear=True)` or set `leave=False` when creating the counter.
enlighten floats not working in counter
With Enlighten's default `bar_format` and `counter_format`, float values cannot be used for `total`, `count`, or in `update()` calls.
fix
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}|')`
Upgrade
Version history
1.14.1latest on PyPI · released Mar 10, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
enlighten — pip install enlighten · libregistry