Skip to main content


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

Metadata

Release files for halo 0.0.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for halo 0.0.31
File Size Uploaded
halo-0.0.31.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for halo 0.0.31
File Interpreter ABI Platform
halo-0.0.31-py2-none-any.whl Python 2 none any Details

Total release size: 22.9 kB

Release files / halo-0.0.31.tar.gz

Download URL halo-0.0.31.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b67a3521ee91d53b7152d4ee3452811e1d2a6321975137762eb3d70063cc9d6
BLAKE2b-256 checksum
How to use checksums
ee48d53580d30b1fabf25d0d1fcc3f5b26d08d2ac75a1890ff6d262f9f027436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / halo-0.0.31-py2-none-any.whl

Download URL halo-0.0.31-py2-none-any.whl
Size 11.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
5350488fb7d2aa7c31a1344120cee67a872901ce8858f60da7946cef96c208ab
BLAKE2b-256 checksum
How to use checksums
86e3065611830ffe8c859130eb99336d26045c477cf55162dd92065e9f1c2938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.31 This release

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.22

2 release files

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page