Package: halo
haloBeautiful spinners for terminal, IPython and JupyterInstall$pipinstallhaloUsagefromhaloimportHalospinner=Halo(text='Loading',spinner='dots')spinner.start()# Run time consuming work here# You can also change properties for spinner as and when you wantspinner.stop()Alternatively, you can use halo with Python'swithstatement:fromhaloimportHalowithHalo(text='Loading',spinner='dots'):# Run time consuming work hereFinally, you can use halo as a decorator:fromhaloimportHalo@Halo(text='Loading',spinner='dots')deflong_running_function():# Run time consuming work herepasslong_running_function()APIHalo([text|text_color|spinner|animation|placement|color|interval|stream|enabled])textType:strText shown along with spinner.text_colorType:strValues:grey,red,green,yellow,blue,magenta,cyan,whiteColor of the spinner text. Defaults toNone.spinnerType:str|dictIf string, it should be one of the spinners listed in the givenjsonfile. If a dict is passed, it should defineintervalandframes. Something like:{'interval':100,'frames':['-','+','*','+','-']}Defaults todotsspinner. For Windows users, it defaults tolinespinner.animationType:strValues:bounce,marqueeAnimation to apply to the text if it's too large and doesn't fit in the terminal. If no animation is defined, the text will be ellipsed.placementType:strValues:left,rightWhich side of the text the spinner should be displayed. Defaults toleftcolorType:strValues:grey,red,green,yellow,blue,magenta,cyan,whiteColor of the spinner. Defaults tocyan.intervalType:floatInterval between each frame. Defaults to spinner interval (recommended).streamType:fileStream to write the output. Defaults tosys.stdout.enabledType:boolEnable or disable the spinner. Defaults toTrue.MethodsFollowing are the methods available:spinner.start([text])Starts the spinner. Iftextis passed, it is set as spinner text. Returns the instance.spinner.stop()Stops and clears the spinner. Returns the instance.spinner.clear()Clears the spinner. Returns the instance.spinner.render()Manually renders a new frame. Returns the instance.spinner.frame()Returns next frame to be rendered.spinner.succeed([text])text:Type:strStops the spinner and changes symbol to✔. If text is provided, it is persisted else current text is persisted. Returns the instance.spinner.fail([text])text:Type:strStops the spinner and changes symbol to✖. If text is provided, it is persisted else current text is persisted. Returns the instance.spinner.warn([text])text:Type:strStops the spinner and changes symbol to⚠. If text is provided, it is persisted else current text is persisted. Returns the instance.spinner.info([text])text:Type:strStops the spinner and changes symbol toℹ. If text is provided, it is persisted else current text is persisted. Returns the instance.spinner.stop_and_persist([symbol|text])Stops the spinner and changes symbol and text. Returns the instance.symbolType:strSymbol to replace the spinner with. Defaults to' '.textType:strText to be persisted. Defaults to instance text.spinner.textChange the text of spinner.spinner.colorChange the color of spinnerspinner.spinnerChange the spinner itself.spinner.enabledEnable or disable the spinner.How to contribute?Please seeContributing guidelinesfor more information.Like it?🌟 this repo to show support. Let me know you liked it onTwitter.
Also, share theproject.Relatedpy-spinners- Spinners in Pythonpy-log-symbols- Log Symbols in Pythonora- Elegant terminal spinners in JavaScript (inspiration behind this project)LicenseMIT© Manraj Singh