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.2.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.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.2.tar.gz
Algorithm Hash digest
SHA256 84d4266de540f641f23c1db5c81dfc484585379a8ee899f2214c4801f9979d11
MD5 3cb6afbe1eb63780a2b7f20f94195fba
BLAKE2b-256 58b1c0b3cf269c5aed2d30e3c0f92962153ea483a703fffb3660ac6faf560cbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f8fa66c91c76bce6f99c1885af0c5a9d74e793000e9fa6c5a751d9a28d8e7571
MD5 8d8405326891d60c448a9e0e24574c9b
BLAKE2b-256 65d64971e7c0ead496d8da389f96e53af3037abfaaf6a03dc34a231f3d69389b

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