Enlighten Progress Bar
Project description
Overview
Enlighten Progress Bar is a console progress bar module for Python. (Yes, another one.)
The main advantage of Enlighten is it allows writing to stdout and stderr without any redirection.
Documentation
Installation
PIP
$ pip install enlighten
EL6 and EL7 (RHEL/CentOS/Scientific)
(EPEL repositories must be configured)
$ yum install python-enlighten
Fedora
$ dnf install python2-enlighten
$ dnf install python3-enlighten
Examples
Basic
For a basic status bar, invoke the Counter class directly.
import time
import enlighten
pbar = enlighten.Counter(total=100, desc='Basic', unit='ticks')
for num in range(100):
time.sleep(0.1) # Simulate work
pbar.update()
Advanced
To maintain multiple progress bars simultaneously or write to the console, a manager is required.
Advanced output will only work when the output stream, sys.stdout by default, is attached to a TTY. get_manager can be used to get a manager instance. It will return a disabled Manager instance if the stream is not attached to a TTY and an enabled instance if it is.
import time
import enlighten
manager = enlighten.get_manager()
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.1) # Simulate work
print(num)
ticks.update()
if not num % 5:
tocks.update()
manager.stop()
Counters
The Counter class has two output formats, progress bar and counter.
The progress bar format is used when a total is not None and the count is less than the total. If neither of these conditions are met, the counter format is used:
import time
import enlighten
counter = enlighten.Counter(desc='Basic', unit='ticks')
for num in range(100):
time.sleep(0.1) # Simulate work
counter.update()
Additional Examples
basic - Basic progress bar
context manager - Managers and counters as context managers
floats - Support totals and counts that are floats
multicolored - Multicolored progress bars
multiple with logging - Nested progress bars and logging
FTP downloader - Show progress downloading files from FTP
Customization
Enlighten is highly configurable. For information on modifying the output, see the Series and Format sections of the Counter documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file enlighten-1.3.2.tar.gz
.
File metadata
- Download URL: enlighten-1.3.2.tar.gz
- Upload date:
- Size: 193.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 783a442213465843d386ec283f975470eb1fdf23681b0d863764c8c4c47cde9c |
|
MD5 | 27286211219880ac88379ff24ebd3a39 |
|
BLAKE2b-256 | 0c1d223a86227960a26f436cfcfebb349e332b3477fd0e67f6c0793d8ffb7a23 |
File details
Details for the file enlighten-1.3.2-py2.py3-none-any.whl
.
File metadata
- Download URL: enlighten-1.3.2-py2.py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f3a6a5ed071011b056d6334b522f6e3c66d66ce5ef56eda3cd91cb1c630fe4d |
|
MD5 | 7e66d2bb082fe2fee601d40d7c91209a |
|
BLAKE2b-256 | ac0728ee32cb4ea87b4ce5ced1b982afd605e9ec3b919be470943d6f2401208c |