A little terminal spinner lib. Heavily inspired by go-spin.
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.
Metadata
Release files for pyspin 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyspin-1.2.0.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyspin-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / pyspin-1.2.0.tar.gz
| Download URL | pyspin-1.2.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
457977f3a01c566e27da14353d04afdf4144b8f79ca750178514bfc31aefd046
|
|
BLAKE2b-256 checksum How to use checksums |
28a42cc932613ad076efb62fe2d059f664ddfe72b720a3d75ad9cc0560a76d1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / pyspin-1.2.0-py3-none-any.whl
| Download URL | pyspin-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
258550f13d9641882e8ddc573789b761cdc22756489669c2d7434c97711d29ef
|
|
BLAKE2b-256 checksum How to use checksums |
6ce972e2e93c4a9e16a7a2c31b69776445c9b82e8927115316eff58785bf1661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|