Skip to main content

Allows for easy creation of progress-bars and text

Project description

https://travis-ci.org/MisanthropicBit/progress.svg?branch=prop_exts https://pypip.in/license/progress2/badge.png

Allows for easy creation of progress-bars and text.

progress has been tested with Python 2.6, 2.7, 3.2, 3.3 and PyPy, and as of now requires at least Python 2.6

Installation:

Note: PyPI already contains a progress entry, so this module is located at progress2.

You can install via pip:

pip install progress2

Alternatively, download the source files and run the following command from the download directory:

python setup.py install

Usage:

Creating a ProgressBar:

>>> import progress
>>> bar = progress.ProgressBar("[{progress}] {percentage:.2f}% ({minutes}:{seconds})", width=30)
>>> bar.show()
[                              ] 0.00% (0:0)>>>
>>> bar.update(26)
>>> bar.show()
[======>                       ] 26.00% (0:0)>>>
>>>

Alternatively, you can use the autoupdate method:

>>> bar.autoupdate(42)
[===================>          ] 68.00% (0:45)>>>
>>>

Creating a ProgressText:

>>> text = progress.ProgressText("Searching: {progress}", "|/-\\", autoreset=True)
>>> text.show()
|>>>
>>> text.update(); text.show()
/>>>
>>> text.update(); text.show()
->>>
>>> text.update(); text.show()
\>>>

You can supply custom args and kwargs to show and autoupdate:

>>> bar = progress.ProgressBar("[{progress}] {key} {},{},{}")
>>> d = dict(key=33)
>>> l = range(3)
>>> bar.update(50)
>>> bar.show(*l, **d)
[=========>          ] 33 0,1,2>>>
>>> bar.autoupdate(25, *l, **d)
[==============>     ] 33 0,1,2>>>
>>>

Refer to the examples/ directory for more examples. There are also examples of how to use progress with the threading module.

Implementation Notes:

Since most terminals cannot clear their output buffers across newlines or carriage returns, progress does not work if you insert them, e.g. progress.ProgressBar("{progress}\n{percentage}") will not be cleared from the terminal.

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

progress2-1.3.0.tar.gz (16.2 kB view details)

Uploaded Source

File details

Details for the file progress2-1.3.0.tar.gz.

File metadata

  • Download URL: progress2-1.3.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for progress2-1.3.0.tar.gz
Algorithm Hash digest
SHA256 327d67bcdf67c60addc743dd42d07a488d2af29ce76ff6b8c277d3aca06432f9
MD5 af20cbacfe714af9fee3d5cff2fda7d4
BLAKE2b-256 83f0f29651777475a170f2a8793f89f9006941a8cfe369e7c8982b4db0249135

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