Progress Indicators for Python
GitHub Page: flamechain/ConsLoadingBar
Full Docs: flamechain/ConsLoadingBar/Documentation.md
Backwards Compatible Since 3.0.0
Note: Please report bugs, give feedback, and make suggestions on my github page
Import
Imported simply:
import consloadingbar, time # time import is not required, but will be used for eta calculation later
Built-In Demo
You can use demo.py, or call SimulateTasks() to see another bult-in demo class. You can read more about how this class works in the full docs here.
clb = consloadingbar.SimulateTasks()
Progress Indicators
There are 4 indicators to choose from:
progressBarprogressCharspinnercounter
ProgressBar()
Global Params
| Name | Description | Type | Default |
|---|---|---|---|
| barLength | Length of bar in characters | int | 20 |
| useETACalculation | Stall bar depending on current eta | boolean | False |
| taskCount | Total amount of tasks displayed | int | None |
| mainBarChar | Character of the filled-in bar | string | '█' |
| progressPointBarChar | Last character of the filled-in bar | string | None |
| endPointChars | Suffix and prefix of the bar | list | ['|', '|'] |
| title | Title to show when the bar is running | string | 'Running...' |
| emptyBarChar | Character for the non-filled-in bar | string | ' ' |
| maxValue | Max value the bar reaches | float | 100 |
| maxValueLabel | Unit for the current value | string | '%' |
Local Params
| Name | Description | Type | Default |
|---|---|---|---|
| percentage | Current percentage complete | int | |
| time_ | Current time passed since start, used for eta calculations | float | None |
| tasksDone | How many tasks done to display | int | 0 |
| lazyLoad | If used, only updates when needed, no tasks or eta displayed | int-bool | None |
| returnString | Return a string value of the bar instead of printing to the console | boolean | False |
You can use the params from Bar() to customize the look of the bar (see demo) and the params from the method for iter-specific things like current percentage.
clb = consloadingbar.Bar(useColor=True, taskCount=10)
start = time.time()
for i in range(101):
currentTime = time.time() - start
# Do something. For demo purposes you can sleep the program for about 0.01 seconds.
clb.progressBar(i, time_=currentTime, tasksDone=i//10)
This will display tasks and eta. You can also call the start() method for multiline titles:
clb.start()
Running...
| | 0% [tasks=0/10]
Or you can use the end() method to show a full bar. This example has useColor enabled.
clb.end()
Finished |████████████████████| 100% [tasks=10/10]
ProgressChar()
| Name | Description | Type | Default |
|---|---|---|---|
| index | Index of phases to print | integer | |
| phases | List of characters that the index calls from | list | [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'] |
| title | Title to show while running | string | 'Loading' |
This shows a character for progress. Like spinner but has a sense of completion.
clb = consloadingbar.Bar()
clb.progressChar(1) # Will run for 2 seconds
Loading ▁
Spinner()
| Name | Description | Type | Default |
|---|---|---|---|
| stop() | Used if on a seperate thread to call on main to stop | func-bool | False |
| time_ | Instead you can hardcode how long it should take | float | None |
| title | Title to display while running | string | 'Loading' |
| phases | A list of values to loop through to display | list | [' |
| returnString | Used if you want to return the string value instead of print | boolean | False |
As seen in the demo, you can do lots. Here are a couple examples that are shown in the demo:
clb = consloadingbar.Bar()
clb.spinner(time_=2)
clb.spinner(time_=4.7, phases='preset')
This last one uses a preset, and the preset takes about 4.7 seconds to complete once.
Counter()
| Name | Description | Type | Default |
|---|---|---|---|
| totalTime | Total time for completion | float | |
| start | Start number | float | |
| end | End number | float | |
| title | Title to display | string | 'Loading' |
Here is how to count up and count down in 2 seconds each:
clb = consloadingbar.Bar()
clb.counter(2, start=0, end=100)
clb.counter(2, start=100, end=0)
This will count up to 100, then back down to 0
Installation
Install via pip using pip install ConsLoadingBar.
pip install ConsLoadingBar
To make sure you have the current version you can use this command instead:
pip install --upgrade ConsLoadingBar
You can also directly call the module from python:
python3 -m pip install ConsLoadingBar
License
ConsLoadingBar is licensed under the MIT License
Metadata
Release files for ConsLoadingBar 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ConsLoadingBar-3.0.2.tar.gz | 13.2 kB | Without provenance | Details for ConsLoadingBar-3.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ConsLoadingBar-3.0.2-py3-none-any.whl | Python 3 | none | any | Details for ConsLoadingBar-3.0.2-py3-none-any.whl |
Total release size: 17.4 kB
Release files / ConsLoadingBar-3.0.2.tar.gz
| Download URL | ConsLoadingBar-3.0.2.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23297844bd39ef02160f5efa052eaf1cd44a557a90c43c17ebc16838e2863350
|
|
BLAKE2b-256 checksum How to use checksums |
4663ceef02054d90d9232876d5e14c0ec17c0aeb00545a51d20d4a1fd3c84542
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Release files / ConsLoadingBar-3.0.2-py3-none-any.whl
| Download URL | ConsLoadingBar-3.0.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86b2f5884cf7cbba93bdea51bb51f5befebb5b9cc9a9cc87e36730637628dceb
|
|
BLAKE2b-256 checksum How to use checksums |
5bd4e0e5d83ecdcf2981ec6df061aa62e1e41caa10320849e7b6534b6d307735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0
|
Security for ConsLoadingBar 3.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.