Skip to main content

Dead-simple terminal spinners and progress indicators for CLI scripts

Project description

philiprehberger-cli-spinner

Tests PyPI version Last updated

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

Installation

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
Spinner.info(text) Stop with an info symbol

Development

pip install -e .
python -m pytest tests/ -v

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

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.2.0.tar.gz (6.5 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.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fdd29f394c923bc004481c8d68ec445721518519454a1cd05a15f03552e4fa96
MD5 572992859adb855ee9ec9dc64db599fa
BLAKE2b-256 f263906ca3eb4f8fb482ee8198e7f645e9f8158c5f89c4ebaf0ced44b0ac9a2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 832c4a73ce60203bfde95a0d6715ff2f79085b061d8e7834bfe65c8cc84e3009
MD5 16f85641cc63022d8323e433fceb7b6e
BLAKE2b-256 5f7c2c5e83fce70eff281b22e48e779b210dcbf6339f7800ac90391f5c7d21af

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