ff0631a790acd4ceed7d71649e6421a4d4765753
Table of Contents
About
Python CLI Progress bar. This module is an iterator that can not only, iterate, but display its self as a progressbar along with some other usefull iformation such as iterations a second, estimated time, elapsed time, etc.
00:25 100% [====================] [100/100] 3.99/s 00:00
Built With
Setup
Production
Prerequisites
Instructions
- Download and add script to project:
curl https://git.zakscode.com/ztimson/py-bar/raw/branch/develop/progressbar.py - Use in python script:
from progressbar import Progressbar
for i in Progressbar(100):
...
# OR
progress = Progressbar(100, display=False) # Output manually
for i in progress:
print(str(progress)) # Print progress bar
...
Documentation
Progressbar
Constructor Arguments
| Name | Description |
|---|---|
| start | Iterator starting position |
| end | Iterator ending position |
| current | Current iteration position |
| step | Added to current index after each iteration |
| length | ASCII progress bar string length |
| units | Unit to append to progress rate |
| color | ANSI escape code to color progress bar |
| display | Automatically output to sdtout |
| bar_format | Custom progress bar format string |
Properties
| Name | Description |
|---|---|
| elapsed | Time ellapsed since first iteration: mm:ss |
| percentage | Percentage of completion: 50% |
| bar | ASCII progress bar: |==========| |
| fraction | Position as a fraction: [index/total] |
| rate | Iterations per second: 2.00/s |
| eta | Estimated time until complete: mm:ss |
Methods
| Name | Description |
|---|---|
| elapsed(self) | Elapsed time in seconds |
| estimated_time(self) | Estimated time until completion in seconds |
| fraction(self) | Create fraction string |
| generate_bar | Progress bar ASCII string |
| per_second | Calculate iteration rate per second as float |
| percentage | Percentage as a floating point |
License
Copyright © 2023 Zakary Timson | Available under the GNU General Public License
See the license for more information.
Languages
Python
100%