Skip to main content

Little terminal spinner lib.

Project description

Latest Version
Build Status
Python Versions

A little terminal spinner lib. Heavily inspired by go-spin.

Demo

pyspin_demo

Install

$ pip install pyspin

Usage

make a spinner by hand:

import sys
import time

from pyspin.spin import Default, Spinner

# Choose a spin style.
spin = Spinner(Default)
# Spin it now.
for i in range(50):
    print(u"\r{0}".format(spin.next()), end="")
    sys.stdout.flush()
    time.sleep(0.1)

or you can use the decorator pyspin provide:

import time

from pyspin.spin import make_spin, Default

# Choose a spin style and the words when showing the spin.
@make_spin(Default, "Downloading...")
def download_video():
    time.sleep(10)

if __name__ == '__main__':
    print("I'm going to download a video, and it'll cost much time.")
    download_video()
    print("Done!")

You can also use Spinner as a context manager:

import time

from pyspin.spin import Default, Spinner

def download_video():
    time.sleep(10)

if __name__ == '__main__':
    print("I'm going to download a video, and it'll cost much time.")
    with Spinner(Default, "Downloading...", "Done!\n"):
        download_video()

You can have a look at the example code in the example folder. Run it via:

$ python example/example_spin.py
$ python example/usage_example.py

Contribute

  • If you find an interesting spinner, send me a pull request <3

  • If you find a bug or have any suggestions, open an issue.

Contributions are always welcome at any time! ✨ 🍰 ✨

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

pyspin-1.2.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

pyspin-1.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pyspin-1.2.0.tar.gz.

File metadata

  • Download URL: pyspin-1.2.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyspin-1.2.0.tar.gz
Algorithm Hash digest
SHA256 457977f3a01c566e27da14353d04afdf4144b8f79ca750178514bfc31aefd046
MD5 66f510d63dafe96eec266bcfeff3fc81
BLAKE2b-256 28a42cc932613ad076efb62fe2d059f664ddfe72b720a3d75ad9cc0560a76d1c

See more details on using hashes here.

File details

Details for the file pyspin-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyspin-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyspin-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 258550f13d9641882e8ddc573789b761cdc22756489669c2d7434c97711d29ef
MD5 93b8720c4456362c25420ef6fda5098e
BLAKE2b-256 6ce972e2e93c4a9e16a7a2c31b69776445c9b82e8927115316eff58785bf1661

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