Display a counter to monitor a numeric variable while waiting:
c = bk.Counter(message="Reading lines", speed=1.0, speed_unit="line/s")
c.show()
for i inrange(505):
time.sleep(0.013) # read & process line
c += 1
c.done()
Display a progress bar to monitor a numeric variable and measure its completion by comparing against a total:
bar = bk.ProgressBar(message="Reading lines", speed=1.0, speed_unit="line/s", total=505)
bar.show()
for i inrange(505):
time.sleep(0.013) # read & process line
bar += 1
bar.done()
Combine diplays using | operator to monitor multiple variables:
import random
sents = bk.ProgressBar(total=1010, message="Sents")
toks = bk.Counter(message="Toks", speed_unit="tok/s", speed=1.0)
bar = sents | toks
bar.show()
for i inrange(1010):
# do work
time.sleep(0.013)
sents += 1
toks += 1 + random.randrange(5)
bar.done()
Use "no tty" mode to, e.g., output to log files:
bar = bk.ProgressBar(total=401, message="Sents", speed=1.0, interval=1.0, no_tty=True)
bar.show()
for i inrange(401):
time.sleep(0.013)
bar += 1
bar.done()
no_tty achieves two things:
Change the delimiter from \r to \n to avoid wonky looking output in your log files.
Change the default interval to a minute to avoid overwhelming logs (in the example above, we set the interval ourselves explicitly).
FAQs
Unknown package
We found that barkeep demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.