• Stars
    star
    2,831
  • Rank 15,450 (Top 0.4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’« Beautiful spinners for terminal, IPython and Jupyter


halo

Build Status Build status Coverage Status PyPI awesome Downloads Downloads

Beautiful spinners for terminal, IPython and Jupyter

halo

Install

$ pip install halo

Usage

from halo import Halo

spinner = Halo(text='Loading', spinner='dots')
spinner.start()

# Run time consuming work here
# You can also change properties for spinner as and when you want

spinner.stop()

Alternatively, you can use halo with Python's with statement:

from halo import Halo

with Halo(text='Loading', spinner='dots'):
    # Run time consuming work here

Finally, you can use halo as a decorator:

from halo import Halo

@Halo(text='Loading', spinner='dots')
def long_running_function():
    # Run time consuming work here
    pass

long_running_function()

API

Halo([text|text_color|spinner|animation|placement|color|interval|stream|enabled])

text

Type: str

Text shown along with spinner.

text_color

Type: str Values: grey, red, green, yellow, blue, magenta, cyan, white

Color of the spinner text. Defaults to None.

spinner

Type: str|dict

If string, it should be one of the spinners listed in the given json file. If a dict is passed, it should define interval and frames. Something like:

{
    'interval': 100,
    'frames': ['-', '+', '*', '+', '-']
}

Defaults to dots spinner. For Windows users, it defaults to line spinner.

animation

Type: str Values: bounce, marquee

Animation 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.

placement

Type: str Values: left, right

Which side of the text the spinner should be displayed. Defaults to left

color

Type: str Values: grey, red, green, yellow, blue, magenta, cyan, white

Color of the spinner. Defaults to cyan.

interval

Type: float

Interval between each frame. Defaults to spinner interval (recommended).

stream

Type: file

Stream to write the output. Defaults to sys.stdout.

enabled

Type: bool

Enable or disable the spinner. Defaults to True.

Methods

Following are the methods available:

spinner.start([text])

Starts the spinner. If text is 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: str

Stops 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: str

Stops 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: str

Stops 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: str

Stops 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.

symbol

Type: str

Symbol to replace the spinner with. Defaults to ' '.

text

Type: str

Text to be persisted. Defaults to instance text.

Persist spin

spinner.text

Change the text of spinner.

spinner.color

Change the color of spinner

spinner.spinner

Change the spinner itself.

spinner.enabled

Enable or disable the spinner.

How to contribute?

Please see Contributing guidelines for more information.

Like it?

🌟 this repo to show support. Let me know you liked it on Twitter. Also, share the project.

Related

  • py-spinners - Spinners in Python
  • py-log-symbols - Log Symbols in Python
  • ora - Elegant terminal spinners in JavaScript (inspiration behind this project)

License

MIT Β© Manraj Singh

More Repositories

1

SingleDivProject

☝️One <div>. Many possibilities.
HTML
1,590
star
2

football-cli

⚽ Command line interface for Hackers who love football
JavaScript
1,063
star
3

organize-cli

πŸ“‹ Organize your files, imagine cleaning up your downloads in an instant
JavaScript
320
star
4

py-spinners

πŸ”„ More than 60 spinners for terminal, python wrapper for amazing node library cli-spinners
Python
205
star
5

algorithms-js

Consumable Data Structures and Algorithms library in JavaScript
JavaScript
193
star
6

py-log-symbols

Colored symbols for various log levels for Python
Python
39
star
7

microbar

πŸŽ‰ A zero dependency, 1.2kb g-zipped, lightweight JavaScript Library for slim progress bars for Ajax'y applications. Inspired by YouTube and Github.
JavaScript
24
star
8

Puzzles

A repository for collecting all interesting puzzles found in interviews and internet
22
star
9

Tutorials-PDF

Download tutorial pdfs from http://www.tutorialspoint.com/
Python
19
star
10

HackerRank-CLI

CLI for running code using HackerRank API
JavaScript
17
star
11

geekiT

Google Chrome extension to mark problems solved on GeeksForGeeks.org so as to focus on unsolved problems. Also view your analysis.
JavaScript
16
star
12

HackNSIT

iConnect, a Social Reporting App, provides an easy-to-use yet powerful way to report crimes in REAL-TIME by the citizens.
JavaScript
8
star
13

MokshaWebsite

[Depricated] Moksha Website
PHP
8
star
14

InventoryManagement

This project is for the IT Team of Practo provide easy and efficient management of technical inventory of Practo.
Java
7
star
15

Hack-Kuku-Kube

JavaScript Hack for Kuku Kube - Eye Test Game (http://kuku-kube.com/)
JavaScript
7
star
16

HackerEarth-CLI

CLI for compiling and running code on HackerEarth
JavaScript
6
star
17

HackerRank-Node-Wrapper

HackerRank API Node Wrapper
JavaScript
6
star
18

react-native-box-loaders

React Native Falling Boxes loader
Java
5
star
19

hbg

CLI for generating boilerplate for coding competitions
JavaScript
5
star
20

Evento

View your Github events in a better way
Python
4
star
21

notebooks

Jupyter Notebooks from practices, challenges, data exploration, competitions and more
Jupyter Notebook
4
star
22

Ideone-Solutions-Downloader

Code downloader for IDEONE
JavaScript
4
star
23

Github-Summary

Android App for knowing more about a Github user
JavaScript
3
star
24

manrajgrover.github.io

Code powering my current website
HTML
3
star
25

Safe-Journey

Android App that tweets your location on shake (Handy in case of emergency)
JavaScript
3
star
26

Treasure-Hunt-Platform

Platform developed on Php, MySQL, jQuery, CSS and HTML with Facebook Login implemented.
PHP
2
star
27

papers

Notes and summaries of papers I've read
2
star
28

Python-Socket-Chat

Socket chat developed using Python.Run server first and then launch client to chat.
Python
2
star
29

Memory-Game

Memory Game based on jQuery,CSS and HTML
HTML
2
star
30

mastering-meteor

A curated list of delightful Meteor packages and resources.
2
star
31

img2tab

Convert images to html tables, for dynamic QR Codes, barcodes and more
JavaScript
2
star
32

blog

Yeah, let's call it a blog!
JavaScript
2
star
33

chat

Web and Android Chat Application
PHP
2
star
34

Codes

Contains solutions of questions of various judges and new concepts I encounter.
HTML
2
star
35

docker-ds

Personal docker environment for data science
Dockerfile
1
star
36

RAKE-Algorithm

Implementation Of RAKE Algorithm
Python
1
star
37

battery_status

A Python Module for Windows to notify when battery is below certain set percentage
Python
1
star
38

BasicCRUD

This is a Basic CRUD API
PHP
1
star
39

Mastering-Android

Here I will upload all my basic Android Apps till I perfect in Android
Java
1
star
40

trailerify

Chrome extension to add IMDB ratings of a particular movie on Trailers Addict
JavaScript
1
star
41

MathLab

A repository to implement and maintain commonly used math related functions needed during coding competitions.
C++
1
star
42

Crick-Info-API

Unofficial Crick Info API.
Python
1
star