Skip to main content

Status indicator inline

Project description

SIL

SIL (Status In-Line) is a simple progress bar that provides sufficient flexibility and compatibility with the multiprocessing library.

Basic Usage

from sil import Sil

status = Sil(
    total=200,     # what is the number you are counting to
    length=40,     # how many characters should be use to print the progress bar
    every=10,      # after how many elements should the progress bar update (e.g. throttling)
    indicator='*' # what character should be used in the progress bar
)

for i, el in elements:
    status.tick()

Multiprocessing example

It can be useful to see the progress of you code when parallelized

from sil import Sil
from multiprocessing import Pool, Value

# global shared memory counter
_i = Value('i', -1, lock=True)

def mp_tick(i, status):
    # do something for current element in parallel

    with _i.get_lock():
        _i.value += 1

    status.update(_i.value)

with Pool(processes=4) as pool:
    pool.starmap(mp_tick, [(i, status) for i in range(200)])

Project details


Download files

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

Source Distribution

sil-0.1.6.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

sil-0.1.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file sil-0.1.6.tar.gz.

File metadata

  • Download URL: sil-0.1.6.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for sil-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8a52c3aadc07a7045e9049ff8cb3b055968fbb1b2b0ffe616db07dd82860be5d
MD5 388b999685d2f65e15a0c299345da1a6
BLAKE2b-256 b6215c8a059fc055528ebec7bb5d4cb69c4dc2d4c916dee09a52d02071ecb514

See more details on using hashes here.

File details

Details for the file sil-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sil-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for sil-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 43e2a6f990fe870285cace5a5e05503421e8f808fbfcfaba02132defd6a14a31
MD5 9cb7deea3fa4be72817c1468a573a572
BLAKE2b-256 b3fed38748c27654ca816c45e3057ff490c4fa460b2f092dd60ce66374deaf0c

See more details on using hashes here.

Supported by

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