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
Release history Release notifications | RSS feed
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.4.tar.gz
(3.2 kB
view hashes)
Built Distribution
sil-0.1.4-py3-none-any.whl
(3.8 kB
view hashes)