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

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.1.7.tar.gz (5.8 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.7-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1645d717e10707ce81449e552426571bbbdc87ef93bcdeadd68fe190b0a1aab1
MD5 56ffe0bc6211c3b81345600c4afc51c2
BLAKE2b-256 e1a98024a4f542c02566319244c522534b58c58ce70a423167d5b35e5cf273a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_cli_spinner-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1ccb042fdc29d70386f456e2d0d4c5e76751aaf6a7526d776f940f8aa2211dbd
MD5 07542ec1551385dc4e86a35eb6134458
BLAKE2b-256 c257ab25ab7725dad2757b2f0561a46b5a822d418163f4c2d035038233a1c218

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