Halo
Halo is a Python library that provides beautiful terminal spinners, offering visual feedback for long-running operations in command-line applications, IPython, and Jupyter. It is currently at version 0.0.31 and is actively maintained, though new releases are not frequent.
Warnings
- deprecated The library internally uses `threading.Thread.setDaemon`, which has been deprecated in Python 3.10 in favor of setting the `daemon` attribute directly. This may lead to deprecation warnings or unexpected behavior in newer Python environments.
- breaking There is an open bug where using text animations and then switching to a new message that is shorter than the current animated text can cause a crash.
- gotcha On Windows operating systems, the default spinner might be 'line' instead of the commonly shown 'dots' spinner due to terminal compatibility. Users should explicitly specify `spinner='dots'` if they want that animation on Windows.
- gotcha Text provided to the `Halo` spinner may incorrectly ignore leading spaces, which can affect precise formatting and alignment in the terminal.
- gotcha Halo spinners may not render correctly or appear at all in certain continuous integration (CI/CD) environments, such as Jenkins, due to terminal emulation differences.
Install
-
pip install halo
Imports
- Halo
from halo import Halo
Quickstart
import time
from halo import Halo
# Basic usage with a 'with' statement for automatic start/stop and cleanup
with Halo(text='Loading data...', spinner='dots', color='cyan') as spinner:
time.sleep(2) # Simulate a long-running operation
spinner.succeed('Data loaded successfully!')
print("Application continues...")