All Projects → bcicen → slack-progress

bcicen / slack-progress

Licence: MIT license
A realtime progress bar for Slack

Programming Languages

python
139335 projects - #7 most used programming language

slack-progress

PyPI version

A realtime progress bar for Slack

screencap

Installing

pip install slack-progress

Usage

Create a SlackProgress object with your Slack token and channel name:

from slack_progress import SlackProgress
sp = SlackProgress('SLACK_TOKEN', 'CHANNEL_NAME')

Now you can simply wrap any iterator:

for i in sp.iter(range(500)):
    time.sleep(.2)

The bar position can also be set manually:

pbar = sp.new() # create new bar where 100% == pos 100
pbar.pos = 10
time.sleep(1)
pbar.pos = 100

pbar = sp.new(total=500) # create new bar where 100% == pos 500
pbar.pos = 100 # 20% complete
time.sleep(1)
pbar.pos = 500 # 100% complete

You can add logging messages too:

pbar.pos = 50
pbar.log("Step 1 complete")
pbar.pos = 100
pbar.log("Step 2 complete")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].