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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep-py-0.0.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deep_py-0.0.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file deep-py-0.0.4.tar.gz.

File metadata

  • Download URL: deep-py-0.0.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for deep-py-0.0.4.tar.gz
Algorithm Hash digest
SHA256 323ad1e1918f30b316dfd19abb32360489d55bdea1aa160c9583eb478b0b6eed
MD5 b864b633f79bc3693db136f1e24fe9b3
BLAKE2b-256 d2e0b019c72c6a4d75bbc88d91c4d3abd03ea25664468a53088d625e8aabd4c2

See more details on using hashes here.

File details

Details for the file deep_py-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: deep_py-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for deep_py-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1bec8f07cf93e85478ea371ebb32f42a7530c2a7ccf820a6576c2e6f6c529549
MD5 192547e620b33533990cb234a8d8eb6c
BLAKE2b-256 a5d28a21e7f79e42609c1be291bcce7ae49626b1e962f466cf5f882b2b7526fa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page