πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

pysnurr

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pysnurr

A beautiful terminal spinner library for Python

0.6.0
PyPI
Maintainers
1

pysnurr

Tests

A beautiful terminal spinner library for Python. Provides non-blocking spinner animations at the current cursor position.

Installation

pip install pysnurr

Usage

from pysnurr import Snurr, SPINNERS
import time

# Basic usage with context manager (recommended)
with Snurr() as spinner:
    spinner.status = "Working..."
    time.sleep(2)  # Do some work

# Traditional usage
spinner = Snurr()
spinner.start()
spinner.status = "Processing..."
time.sleep(2)  # Do some work
spinner.stop()

# Choose from various spinner styles
spinner = Snurr(frames=SPINNERS["CLASSIC"])  # /-\|
spinner = Snurr(frames=SPINNERS["EARTH"])    # 🌍🌎🌏
spinner = Snurr(frames=SPINNERS["HEARTS"])   # πŸ’›πŸ’™πŸ’œπŸ’š
spinner = Snurr(frames=SPINNERS["MOON"])     # πŸŒ‘πŸŒ’πŸŒ“πŸŒ”πŸŒ•πŸŒ–πŸŒ—πŸŒ˜
...

# Show spinner at end of line
print("Processing", end="")
with Snurr() as spinner:
    time.sleep(2)
print(" Done!")

# Set initial status message
with Snurr(status="Starting up...") as spinner:
    time.sleep(1)
    spinner.status = "Processing..."
    time.sleep(1)

# Update status message during spinning
with Snurr(frames=SPINNERS["EARTH"]) as spinner:
    spinner.status = "Starting a long process..."
    time.sleep(1)
    spinner.status = "Step 1: Data processing"
    time.sleep(1)
    spinner.status = "Step 2: Analysis complete"

Features

  • Non-blocking animation
  • Dynamic status messages
  • Multiple built-in spinner styles:
    • CLASSIC: Classic ASCII spinner (/-|)
    • ARROWS: Arrow rotation (β†β†–β†‘β†—β†’β†˜β†“β†™)
    • BAR: ASCII loading bar (β–β–‚β–ƒβ–„β–…β–†β–‡β–ˆβ–‡β–†β–…β–„β–ƒβ–‚β–)
    • BLOCKS: Minimal blocks (β–Œβ–€β–β–„)
    • DOTS_BOUNCE: Bouncing dots (.oO᐀°᐀Oo.)
    • EARTH: Earth rotation (🌍🌎🌏)
    • HEARTS: Colorful hearts (πŸ’›πŸ’™πŸ’œπŸ’š)
    • MOON: Moon phases (πŸŒ‘πŸŒ’πŸŒ“πŸŒ”πŸŒ•πŸŒ–πŸŒ—πŸŒ˜)
    • SPARKLES: Sparkling animation (βœ¨β­οΈπŸ’«)
    • TRIANGLES: Rotating triangles (β—’β—£β—€β—₯)
    • WAVE: Wave pattern (⎺⎻⎼⎽⎼⎻)
  • Cursor hiding during animation
  • Thread-safe status updates
  • Flexible positioning at current cursor position
  • Python 3.10+ support

Development

Clone the repository and install in development mode with all development dependencies:

git clone https://github.com/dewe/pysnurr.git
cd pysnurr
make dev-install  # Installs package and test dependencies

Run tests and checks:

make test        # Run type checking and tests
make lint        # Run code style checks (black & ruff)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

cli

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts