Skip to main content

Enlighten Progress Bar

Project description

Documentation Status Travis-CI Build Status Coverage Status
PyPI Package latest release Supported versions Supported implementations
Linux supported Windows supported MacOS supported BSD supported
Fedora version support EPEL version support

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.

https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/doc/_static/demo.gif

Documentation

https://python-enlighten.readthedocs.io

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

Customization

Enlighten is highly configurable. For information on modifying the output, see the Series and Format sections of the Counter documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enlighten-1.5.2.tar.gz (246.7 kB view details)

Uploaded Source

Built Distribution

enlighten-1.5.2-py2.py3-none-any.whl (37.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file enlighten-1.5.2.tar.gz.

File metadata

  • Download URL: enlighten-1.5.2.tar.gz
  • Upload date:
  • Size: 246.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for enlighten-1.5.2.tar.gz
Algorithm Hash digest
SHA256 84767f6c97a5a3437b9452f2e305f5550e52da14e740ae5c613d6ec09158f9b5
MD5 9ae991ec8fec4e90902c989b17111e95
BLAKE2b-256 2fe180709f095504f4c11c7c1ac8b984bd7707f7dbbcf168bf052bf7e8573b40

See more details on using hashes here.

File details

Details for the file enlighten-1.5.2-py2.py3-none-any.whl.

File metadata

  • Download URL: enlighten-1.5.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for enlighten-1.5.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 71f7c251c19d3bd9da598a4c18f8cd03ce6eb62b75e282be43818b4f0f230048
MD5 49d4265f492fdd4d199f7bf7d2facc3c
BLAKE2b-256 bfae0b9d1912bf91b01a61ea2b8784696d551850c74bb3a2a9eec95a111d4aa5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page