Skip to main content

A progress bar for command line tools.

Project description

A simple way of providing an informative and clean progress bar on the terminal that respects the terminal’s width, has a header, and the current %age for Python 2.6+ and 3.0+

Synopsis

                   reading names.dmp
[========================79.3%===============>          ]

Installation

pip install progress_bar

Usage

Generally, to create any kind of progress bar with a default “size” of 100 arbitrary units:

from progress_bar import initBar

pbar = initBar("title")
pbar(10)  # update % to 10%
pbar(20)  # update % to 20%
pbar(15)  # simulate Microsoft progress effects

del pbar  # move bar to final 100% and write the newline

To easily create a progress bar for reporting (reading) progress in a filehandle that can tell() its offset:

from progress_bar import initBarForInfile

pbar = initBarForInfile("path")
instream = open("path")

for line in instream:
  pbar(instream.tell())

del pbar

With those default arguments, the bar will be as wide as the terminal window. Terminal window width is defined by termios using fcntl, both from the standard library.

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

progress_bar-1.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file progress_bar-1.tar.gz.

File metadata

  • Download URL: progress_bar-1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for progress_bar-1.tar.gz
Algorithm Hash digest
SHA256 0ead88145d4eedbd620a966d866e6812577afef4cbe86435a220e89a374c3544
MD5 368a9570dbe27bd2b9abe809d0d25299
BLAKE2b-256 e2832c6e08e201b67ad3575e52af836d4067995097730bb9410dce6f97f38a23

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