Package: progress1bar
progress1barA customizable ANSI-based progress bar.Installationpipinstallprogress1barProgressBarProgressBar(
    total=None,
    fill=None,
    regex=None,
    completed_message=None,
    clear_alias=False,
    show_prefix=True,
    show_fraction=True,
    show_percentage=True,
    show_duration=False,
    show_complete=True,
    ticker=None,
    use_color=True,
    show_bar=True)Documentationtotal- An integer for the total number of items the progress bar will show that need to be completed.fill- A dictionary whose key values are integers that dictate the number of leading zeros the progress bar should add to thetotalandcompletedvalues; this is optional and should be used to format the progress bar appearance. The supported key values aremax_totalandmax_completed.regex- A dictionary whose key values are regular expressions fortotal,countandalias. The regular expressions will be checked against the log messages intercepted from the executing function, if matched the value will be used to assign the attribute for the respective progress bar. Thetotalandcountkey values are required, thealiaskey value is optional.completed_message- A string to designate the message the progress bar should display when complete. Default is 'Processing complete'clear_alias- A boolean to designate if the progress bar should clear the alias when complete.show_prefix- A boolean to designate if the prefix ofProcessingshould be printed prefixing the progress bar.show_fraction- A boolean to designate if the fraction should be printed with the progress bar.show_percentage- A boolean to designate if the percentage should be printed with the progress bar.show_duration- A boolean to designate if the duration should be printed after progress bar execution.show_complete- A boolean to designate if the completed message is to be displayed upon progress bar completion.ticker- A integer representing unicode character to print as the progress bar ticker. Refer tounicode chartfor values. Default is 9632 (black square ■).use_color- A boolean to designate if the progress bar should be displayed with color. Default isTrue.show_bar- A boolean to designate if the progress bar tickers should be printed.Attributescount- An integer attribute to increment that designates the current count. When count reaches total the progress bar will show complete.alias- A string attribute to set the alias of the progress bar.Functionsreset()Reset the progress bar so that it can be used again. It will maintain and show the number of times the progress bar has been used.ExamplesVariousexamplesare included to demonstrate the progress1bar package. To run the examples, build the Docker image and run the Docker container using the instructions described in theDevelopmentsection.example1TheProgressBarclass is used to display function execution as a progress bar. Use it as a context manager, and simply set the.totaland.countattributes accordingly. Here is an example:importtimefromprogress1barimportProgressBarwithProgressBar(total=250)aspb:for_inrange(pb.total):pb.count+=1# simulate worktime.sleep(.01)example2ConfigureProgressBarto display an alias for the item that is currently being processed by setting thealiasparameter:importtimefromfakerimportFakerfromprogress1barimportProgressBarkwargs={'total':75,'completed_message':'Processed names complete','clear_alias':True,'show_fraction':False,'show_prefix':False,'show_duration':True}withProgressBar(**kwargs)aspb:for_inrange(pb.total):pb.alias=Faker().name()# simulate worktime.sleep(.08)pb.count+=1example2bConfigureProgressBarto display an alias for the item that is currently being processed, but do not print out the ticker, instead show percentage and fraction complete:fromfakerimportFakerfromprogress1barimportProgressBarkwargs={'total':575,'clear_alias':True,'show_complete':False,'show_prefix':False,'show_duration':True,'show_bar':False}withProgressBar(**kwargs)aspb:for_inrange(pb.total):pb.alias=Faker().sentence()# simulate workpb.count+=1example3ConfigureProgressBarwith a custom ticker, show duration, do not use color, and use regular expressions to determine thetotal,countandaliasattributes:importrandomfromfakerimportFakerfromprogress1barimportProgressBarkwargs={'ticker':9733,'regex':{'total':r'^processing total of (?P<value>\d+)$','count':r'^processed .*$','alias':r'^processor is (?P<value>.*)$'},'use_color':False,'show_duration':False}withProgressBar(**kwargs)aspb:pb.match(f'processor is{Faker().name()}')total=random.randint(500,750)pb.match(f'processing total of{total}')for_inrange(total):pb.match(f'processed{Faker().name()}')example4ConfigureProgressBarto show and reuse progress for several iterations:importrandomimporttimefromfakerimportFakerfromprogress1barimportProgressBarTOTAL_ITEMS=300ITERATIONS=4kwargs={'show_prefix':False,'show_fraction':False,'show_duration':True}print(f'Execute{ITERATIONS}iterations of varying totals:')withProgressBar(**kwargs)aspb:iterations=0whileTrue:ifiterations==ITERATIONS:pb.alias=''pb.complete=Truebreakpb.alias=Faker().name()pb.total=random.randint(100,TOTAL_ITEMS)for_inrange(pb.total):Faker().name()pb.count+=1iterations+=1pb.reset()time.sleep(.4)Programs usingprogress1barpypbarsmppbarDevelopmentClone the repository and ensure the latest version of Docker is installed on your development server.Build the Docker image:dockerimagebuild\-tprogress1bar:latest.Run the Docker container:dockercontainerrun\--rm\-it\-v$PWD:/code\progress1bar:latest\bashExecute the build:pyb-X