yaspin
Yet another terminal spinner for Python — provides animated spinner for long-running CLI operations with context manager API. yaspin features: 80+ spinner styles (dots, lines, clock, moon phases, etc.), context manager interface, .ok()/.fail() for success/failure indication, color support via termcolor, side text alongside spinner, write() for side output without disrupting spinner, sigmap for signal handling, timer display, nested spinners, thread-safe output, and yaspin.kbi_safe context manager for KeyboardInterrupt handling.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Terminal output library with no network calls. No security concerns. Do not write sensitive data via sp.write() as it appears in terminal output.
⚡ Reliability
Best When
Indicating long-running indeterminate operations in CLI tools — yaspin provides the simplest API for animated spinners with success/failure states.
Avoid When
Determinate progress bars (use tqdm), non-interactive/piped output, complex TUI (use rich/urwid), or when rich is already a dependency (use rich.spinner instead).
Use Cases
- • Agent CLI progress — from yaspin import yaspin; with yaspin(text='Processing...') as sp: result = long_running_task(); sp.ok('Done!') — spinner with success; agent shows animated spinner during API calls or processing; sp.ok() stops spinner with checkmark; sp.fail() shows failure indicator
- • Agent colored spinner — from yaspin import yaspin; from yaspin.spinners import Spinners; with yaspin(Spinners.dots12, text='Loading', color='cyan') as sp: result = fetch_data(); sp.green.ok('✓ Loaded!') — styled spinner; agent uses specific spinner style and color; Spinners enum lists all available animations
- • Agent spinner with output — with yaspin(text='Processing') as sp: for item in items: result = process(item); sp.write(f'> {item}: {result}') — inline output; agent writes progress lines without disrupting spinner; sp.write() prints above spinner; spinner continues animating
- • Agent timer display — with yaspin(text='Waiting', timer=True) as sp: time.sleep(30) — shows elapsed time; agent displays elapsed time alongside spinner; useful for operations with variable duration; timer=True shows HH:MM:SS next to spinner
- • Agent failure handling — with yaspin(text='Connecting') as sp: try: connect(); sp.ok('Connected'); except ConnectionError as e: sp.fail(f'Failed: {e}') — error indication; agent shows explicit success/failure to user at completion; ok/fail change final spinner state
Not For
- • Determinate progress — yaspin is for indeterminate (spinner) not percentage-based; for progress bars use tqdm or rich
- • Non-interactive output — yaspin disables spinner when not a TTY (piped/redirected); for non-interactive progress use logging
- • Complex TUI — yaspin is single-line spinner; for full TUI use rich or urwid
Interface
Authentication
No auth — terminal output library.
Pricing
yaspin is MIT licensed. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ Spinner disables silently in non-TTY — yaspin auto-detects TTY; when output is piped or in CI without TTY, spinner is disabled and ok()/fail() write plain text; agent code should not rely on spinner being active; test output in both TTY and non-TTY environments
- ⚠ print() inside context manager corrupts spinner — using print() inside with yaspin() writes without coordinating with spinner thread, causing display corruption; always use sp.write() inside the context manager: sp.write('log message') writes cleanly above spinner line
- ⚠ ok() and fail() text replaces spinner permanently — sp.ok('Done!') stops animation and writes final status; cannot restart after ok/fail; agent code needing multiple phases: use separate yaspin context managers per phase, not one context manager with multiple ok() calls
- ⚠ Exceptions inside context manager leave spinner running — if code inside with yaspin() raises exception, spinner keeps running until context exits; yaspin cleans up on __exit__ but exception message may be hidden by running spinner; agent code: use try/except inside context with explicit sp.fail() before raising
- ⚠ sp.text assignment updates text dynamically — sp.text = 'New status...' changes displayed text while spinner runs; agent code can update spinner text during long operations to show current step; sp.text = f'Processing item {i}/{total}'; useful for multi-step operations with one spinner
- ⚠ Nested spinners require careful management — yaspin supports nested spinners but ANSI cursor movement can conflict; agent code with nested spinners: test display in actual terminal; nested spinners work better with different animation styles to distinguish; simpler to use sp.text updates instead of nesting
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for yaspin.
Scores are editorial opinions as of 2026-03-06.