Skip to main content

ProgressBar

Let us consider a few examples explaining how to use the ProgressBar class from the module progress:

from deeppy.progress import ProgressBar
from time import sleep

bar = ProgressBar(max=20, width=50, elapsed=True)

for i in range(10):
    sleep(1)
    bar.next()

bar.finish()
print()

for i in range(15):
    sleep(1)
    bar.next()
Out:
Processing: [#########################                         ] 50% [elapsed: 10s; ETA: 10s]
Processing: [#####################################             ] 75% [elapsed: 15s; ETA: 5s]

The class supports the context management protocol and can be used with the with statement. Alternative bar formats are also available:

with ProgressBar("Charging", max=20, width=50) as bar:
    for i in range(10):
        sleep(1)
        bar.next()
print()

with ProgressBar("FillingSquares", max=20, width=50) as bar:
    for i in range(15):
        sleep(1)
        bar.next()
Out:
Processing: [█████████████████████████∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙] 50% [ETA: 10s]              
Processing: [▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▣▢▢▢▢▢▢▢▢▢▢▢▢▢] 75% [ETA: 5s]

Note that the next method can be replaced by the show method with index argument supplied:

with ProgressBar("FillingCircles", max=20, width=50, eta=False) as bar:
    for i in range(10):
        sleep(1)
        bar.show(i + 1)
Out:
Processing: [◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯◯] 50%

ProgressSpinner

The following examples explain how to use the ProgressSpinner class from the module progress:

from deeppy.progress import ProgressSpinner
from time import sleep, time

spinner = ProgressSpinner()

since = time()
while True:
    # Do some work
    sleep(0.2)
    spinner.next()
    if time() - since > 5:
        break

Alternative spinner formats are also available:

with ProgressSpinner("Pie") as spinner:
    since = time()
    while True:
        sleep(0.2)
        spinner.next()
        if time() - since > 5:
            break
print()

with ProgressSpinner("Moon") as spinner:
    since = time()
    while True:
        sleep(0.2)
        spinner.next()
        if time() - since > 5:
            break
print()

with ProgressSpinner("Pixel") as spinner:
    since = time()
    while True:
        sleep(0.2)
        spinner.next()
        if time() - since > 5:
            break
Out:
Processing: ◷
Processing: ◐
Processing: ⣷

Installation

Download from PyPI:

pip install deep-py

Release files for deep-py 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deep-py 0.0.4
File Size Uploaded
deep-py-0.0.4.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deep-py 0.0.4
File Interpreter ABI Platform
deep_py-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / deep-py-0.0.4.tar.gz

Download URL deep-py-0.0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
323ad1e1918f30b316dfd19abb32360489d55bdea1aa160c9583eb478b0b6eed
BLAKE2b-256 checksum
How to use checksums
d2e0b019c72c6a4d75bbc88d91c4d3abd03ea25664468a53088d625e8aabd4c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

Release files / deep_py-0.0.4-py3-none-any.whl

Download URL deep_py-0.0.4-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bec8f07cf93e85478ea371ebb32f42a7530c2a7ccf820a6576c2e6f6c529549
BLAKE2b-256 checksum
How to use checksums
a5d28a21e7f79e42609c1be291bcce7ae49626b1e962f466cf5f882b2b7526fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page