Package: pyloaders
pyloadersBasic animated ASCII loaders for Python scripts. Python 2 & 3 compatible.Spinning LoaderText LoaderBar LoaderProgress LoaderInstallationpipinstallpyloadersFrom Sourcegitclonehttps://gitlab.com/ml394/pyloaders.gitcdpyloaders
pythonsetup.pyinstallUsageAll loaders are declared by callingLoaderClass(<arguments>)ArgumentsOptionDescriptionTypeChoicesDefaultValid FortextText displayed while loadingstr'Loading'Text, SpinningsizeFull width of loaderstrsmall, medium, large'medium'Text, Bar, ProgresscharacterASCII value used in loaderstr. = * > ~ # @ $ + ! ? ,'.' / '='Text, Bar, ProgressspeedTime between loader paintsfloat.25Text, Spinning, BardurationRuntime of fixed loader, in secondsint10Text, Spinning, BardirectionInitial direction of moving loaderstrltr, rtl'ltr'Text, BaranimationContinuous or oscillating movementstrloop, bounce'loop'Text, BarcolourTerminal colour support requiredstrblue, green, yellow, redNoneALLstyleTerminal styles support requiredstrheader, bold, underlineNoneALLcomplete_textText displayed after loader endsstr'Done!'ALLstartProgress loader start positionint0ProgresstotalProgress loader total countint100ProgressIndeterminateAvailable Classes:SpinningLoader, TextLoader, BarLoaderRun as threads which can be started and stopped dynamically by you at any stage.To start a loader, call itsstart()method.After you have completed your tasks, call the loader'sstop()method to terminate the thread.If you have set a fixeddurationof the loader, call therun()method to run the loader for the set amount of time.ThreadedfromloadersimportTextLoaderloader=TextLoader()loader.start()# Perform some tasksloader.stop()Fixed DurationfromloadersimportTextLoaderfixed_loader=TextLoader(duration=10)fixed_loader.run()# Pauses program execution and runs loader for 10sOutput/ Loading...        # SpinningLoader

.....Loading...     # TextLoader

|   ======    |     # BarLoaderRemember: Don't try to start more than one loader at the same time!DeterminateAvailable Classes:ProgressLoaderUsed to measure the completion progress of a loop or function.When you initialize aProgressLoaderobject, you should specify the total number of iterations that will be performed in your loop as thetotalargument.On each iteration, call the loader'sprogress(n)method, wherenis the current iteration count, to update the progress bar in the terminal.fromloadersimportProgressLoaderloader=ProgressLoader(total=10)foriinrange(10):# Perform some task each looploader.progress(i)Output|==========          | 50%Remember:Don't print anything to the console while the loader is running!BashNew in version 0.0.5You can now start a loader for shell commands$ load some --shell command
[    ========    ]TestsThere is a small test suite that uses thepytestmodule.Clone the repositoryInstall pytest and dependenciesRun pytest from project foldergitclonehttps://gitlab.com/ml394/pyloaders.gitcdpyloaders
pipinstall-rrequirements.txt
pytestExamplesAn visual example can be performed by runningexample.pyfrom the project directory.This will run a suite of example loaders specified in the file for 5s each. By default, the indeterminate examples are run on fixed durations. To run them as threads, use the optionalthreadargument.# Fixed durationpythonexample.py# Threadedpythonexample.pythreadContributingTo contribute to this project, clone master and create your own development branch.gitclonehttps://gitlab.com/ml394/pyloaders.git
gitcheckout-b<feature-name>Push your branch remotely, and create a merge request to master so we can review your code.If the merge request is approved, your new feature will be merged and pushed for the next release.To DoLoader colours / stylesCI/CD PipelineAPI DocumentationPrint output while loader runningDonateBTC donations (no matter how tiny) accepted at wallet address:1PSWQrgbagNARvtum6pGS7rPUub4YiLmzX