Skip to main content

Dead-simple terminal spinners and progress indicators for CLI scripts

Project description

philiprehberger-cli-spinner

Tests PyPI version License

Dead-simple terminal spinners and progress indicators for CLI scripts.

Install

pip install philiprehberger-cli-spinner

Usage

from philiprehberger_cli_spinner import spinner

with spinner("Loading data"):
    do_work()

Finish with status

from philiprehberger_cli_spinner import spinner

s = spinner("Deploying")
s.start()
try:
    deploy()
    s.succeed("Deployed successfully")
except Exception:
    s.fail("Deploy failed")

Decorator

from philiprehberger_cli_spinner import spin

@spin("Computing")
def heavy_task():
    ...

Update text

from philiprehberger_cli_spinner import spinner

with spinner("Step 1") as s:
    step_one()
    s.update("Step 2")
    step_two()

Styles

Five built-in animation styles are available:

from philiprehberger_cli_spinner import spinner

with spinner("Working", style="braille"):
    do_work()

Available styles: dots, line, bounce, braille, arrow.

API

Function / Method Description
spinner(text, *, style) Create a Spinner (context manager)
spin(text, *, style) Decorator that shows a spinner during execution
Spinner.start() Start the spinner animation
Spinner.stop() Stop the spinner and clear the line
Spinner.update(text) Change the displayed text
Spinner.succeed(text) Stop with a success symbol
Spinner.fail(text) Stop with a failure symbol
Spinner.warn(text) Stop with a warning symbol

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philiprehberger_cli_spinner-0.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philiprehberger_cli_spinner-0.1.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_cli_spinner-0.1.3.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fbb1f11bcd129b8ce2eeb8a90933eca58dde0d92258b116a40973a7a9678dc5c
MD5 0ce15bee3858d25475c35ea5df0aabda
BLAKE2b-256 bdabdae6969f716d13f3750e3191aed160a31480563f6b834b3662461cc5e047

See more details on using hashes here.

File details

Details for the file philiprehberger_cli_spinner-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9f042dd6a5a1dc31a26da3aec082c308fe7090c61ae4a9a2b62567c3621564b2
MD5 8e83088beabb8e177612cba29ec3ab7d
BLAKE2b-256 509ea506a336181e4ff26d71fc0338c8be306956582e90ff9da8b9fd7e4e86aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page