/spout

A Custom Python Progress Bar

Primary LanguagePythonMIT LicenseMIT

Generic badge

SPOUT

A Custom Python Progress Bar

There are many progress bar implementations out there, such as progress2 and tdqm. However, I wanted to try my hand at making one, and having it be independent of wrapping any Python iterable as the aforementioned libraries seem to do.

Usage:

pb = ProgressBar(width=30, pad=30, color=True)

pb.begin(label="Performing Operation 1", stages=10)
pb.checkpoint()
...
pb.checkpoint()
pb.end()

pb.begin(label="Performing Operation 2", stages=5)
...
pb.end()

Configurations:

  • stages- sets the number of stages to be completed for the bar (required)
  • width - sets the width (in characters) of the progress bar
  • pad - sets the width (in characters) of the label + padding (e.g."Label...")
  • color - allows for colored output vs uncolored.

Example:

asciicast