nirs4all.utils.spinner module

Simple spinner utility for showing loading progress during long operations.

class nirs4all.utils.spinner.Spinner(message: str = 'Loading', chars: str = '|/-\\', speed: float = 0.1)[source]

Bases: object

A simple rotating spinner for showing loading progress.

start()[source]

Start the spinner.

stop()[source]

Stop the spinner and clear the line.

nirs4all.utils.spinner.spinner_context(message: str = 'Processing', chars: str = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', speed: float = 0.1)[source]

Context manager for easy spinner usage.

Usage:
with spinner_context(“Training model”):

# Long running operation time.sleep(5)

Parameters:
  • message – Message to display before spinner

  • chars – Characters to cycle through for animation

  • speed – Time between character changes (seconds)