Skip to main content

Enlighten Progress Bar

Project description

Documentation Status Travis-CI Build Status Coverage Status
Linux supported Windows supported MacOS supported BSD supported
PyPI Package latest release Supported versions Supported implementations
Latest Fedora Version Latest EPEL Version Latest Arch Linux Version Latest Debian Version Latest Ubuntu Version Latest Conda Forge Version

Overview

Enlighten Progress Bar is a console progress bar library for Python.

The main advantage of Enlighten is it allows writing to stdout and stderr without any redirection or additional code. Just print or log as you normally would.

Enlighten also includes experimental support for Jupyter Notebooks.


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

The code for this animation can be found in demo.py in examples.

Documentation

https://python-enlighten.readthedocs.io

Installation

PIP

$ pip install enlighten

RPM

Fedora and EL8 (RHEL/CentOS)

(EPEL repositories must be configured for EL8)

$ dnf install python3-enlighten

EL7 (RHEL/CentOS)

(EPEL repositories must be configured)

$ yum install python2-enlighten
$ yum install python36-enlighten

PKG

Arch Linux

$ pacman -S python-enlighten

DEB

Debian and Ubuntu

$ apt-get install python3-enlighten

Conda

$ conda install -c conda-forge 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.10.1.tar.gz (321.0 kB view details)

Uploaded Source

Built Distribution

enlighten-1.10.1-py2.py3-none-any.whl (53.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: enlighten-1.10.1.tar.gz
  • Upload date:
  • Size: 321.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for enlighten-1.10.1.tar.gz
Algorithm Hash digest
SHA256 3391916586364aedced5d6926482b48745e4948f822de096d32258ba238ea984
MD5 b88f77292c4f9e82529ed503c79a0565
BLAKE2b-256 8ed4f3c521d852d3adb8f17487a435ee1f51346ad27618f510c8c6566a373b25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: enlighten-1.10.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for enlighten-1.10.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d6c3eec8cf3eb626ee7b65eddc1b3e904d01f4547a2b9fe7f1da8892a0297e8
MD5 c994db4fa0c8e17e4057848ca4d8efe7
BLAKE2b-256 2e157a22630323eb816bd560bb2b60b98c9c829a3fb90f55d9d224f3aa4d7bf3

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