Package: progressist
ProgressistMinimalist and pythonic progress bar.Installpip install progressistUsagefrom progressist import ProgressBar
bar = ProgressBar(total=mytotalstuff)
for item in mystuff:
    # do_stuff
    bar.update()Or usebar.itertransparentlyfor item in bar.iter(mystuff):
    do_stuffIt comes with a default rendering that is enough for starting, but it's made to be
customised very easily: just writting a template string:bar = ProgressBar(total=mytotalstuff, template='{prefix} {progress} ETA: {eta}')It's just plainpython formattingso you can use any valid string formatting to take control over the appearance.
For example:bar = ProgressBar(total=mytotalstuff, template='{progress} {percent:.2%} ETA: {eta:%H:%M:%S}')You can also just change the fill character:bar = ProgressBar(total=mytotalstuff, done_char='#')You can change the progress logic itself, for example to use a spinner (included):bar = ProgressBar(total=mytotalstuff, progress='{spinner}')
# 'progress' kwarg must return a valid template variable.
# included ones are {bar} and {spinner}You can step by more than one at a time:for item in mystuff:
    amount = do_stuff()
    bar.update(step=amount)You can add more template vars by subclassingProgressBar:class MyBar(ProgressBar):

    @property
    def swap(self):
        return psutil.swap_memory().total

bar = MyBar(total=20, template='{prefix} {progress} Swap usage: {swap}')If you are using the same configuration at different places, create a subclass and
set its configuration as class properties:class MyBar(ProgressBar):
    template = ('Download |{animation}| {done:B}/{total:B}')
    done_char = '⬛'

bar = MyBar()You want to compute yourself the done part?bar.update(done=myvar / othervar * another)Or the target total may change during process?bar.update(total=newcomputedtotal)To use asurlretrievecallback:bar = ProgressBar(template="Download |{animation}| {done:B}/{total:B}")
urllib.request.urlretrieve(myurl, mydest, reporthook=bar.on_urlretrieve)Seeexamplesfor inspiration.To run examples, when git cloned the repository, simply run:python examples.pyIf you want to run only one example, add its name to the command line:python examples.py example_downloadParametersYou can set all of those parameters either as class properties:class MyBar(ProgressBar):
    done_char = 'x'

bar = Bar()Or at init:bar = ProgressBar(done_char='x')Or at update:bar = Bar()
bar.update(prefix='Finishing')namedefaultdescriptiondone_char=Char used for filling the progress barremain_char' '(a space)Char used for filling the empty portion of the progress bartemplate{prefix} {progress} {percent} ({done}/{total})The template of the whole lineprefixProgress:The leading labelanimation'{progress}'The actual widget used for progress, can be{bar},{spinner}or{stream}throttle0Minimum value between twoupdatecall to issue a render: can accept anintfor an absolute throttling, a float for a percentage throttling (total must then be set) or a dimedelta for a throttling in secondsBuilt in template varsnamedescriptiontypedefault formattingprefixLeading label in default templatestringstrelapsedThe elapsed time from the first iteration (in seconds)intas timedeltaetaThe computed ETAdatetime%H:%M:%Sif less than 24 hours, else%Y-%m-%d %H:%M:%SttaThe estimated remaining time (time to arrival; in seconds)intas timedeltaavgThe average time per iteration, in secondsfloat.2fspeedThe average number of iterations per secondfloat.2fdoneThe number of done iterationsintegertotalThe total number of iterations to be doneintegerremaingThe number of iterations remaining to be doneintegerpercentThe percent of iterations already donefloat.2%animationThe actual progress bartemplate string ({bar},{spinner}or{stream})Custom formattingWe extend python default Formatter with some handy custom specs:Btype: render an int as human friendly bytes size. For example:> bar.total = 109830983
  > bar.template = '{total:B}'
  > bar.render()
  '104.7 MiB'You can still override the ndigits value:> bar.total = 109830983
  > bar.template = '{total:0.2B}'
  > bar.render()
  '104.74 MiB'Dtype: try to cast to integer. For example:> bar.speed = 103.23
  > bar.template = '{speed:D}'
  > bar.render()
  '103'