================
Pretty progress and load indicators.
Installation:
pip install python-propeller
$ python
>>> from propeller import demo, propeller
>>> demo()
Usage as spinner:
with propeller("spinning propeller") as p:
# do something
p.spin()
# do more
p.spin()
# print to console
p.println("without messing up the spinner")
# replace "spinning propeller"
p.msg("spinner")
...
Usage with progress indicator:
with propeller("progress propeller") as p:
n = 1000
for i in range(n):
# do something
p.progress(i, n)
Process a collections:
def preprocessor(item):
# preprocess
def finalizer(item):
# finalize
pre_processed = propeller("preprocessing").map(preprocess, in_list)
propeller("finalizing").process(finalizer, pre_processed)
If the length of your collections can be determined, a progress bar will be
displayed. If iterables are given, a spinner will be displayed. If you know
the size of your iterables, you can explicitly specify it with the `n`
keyword argument:
def doit(item):
# work
propeller().process(doit, a_iterable, b_iterable, n=42)
`python-propeller` uses threading and needs to be ended cleanly. This can be
done by using `process`, `map` or `imap` functions, using the `with` statement
or explicitly calling the `end` method when you are finished.
p = propeller()
try:
# do something
finally:
p.end()
Various measurements are optional:
with propeller(eta=False, ops=False, eta=False, percent=False) as plain_p:
plain_p.spin()
Customization
-------------
The classic propeller can be made like so:
from time import sleep
def noop(item):
sleep(0.01)
propeller(spinner="|/-\\").process(noop, iter(range(300)))
But this is also one of the many preconfigured styles:
propeller(spinner='lines').process(noop, iter(range(300)))
With progress bars the first character of the string is used for the unfilled
portion of the bar and the last character for the filled portion:
propeller(bar=' -+=').process(noop, range(300))
# produces something like this:
========- [ops: 99][eta: 2s][23%]
Included styles for both spinners and progress bars:
`shades` ┄░▒▓█ (default)
`hbar` ▁▂▃▄▅▆▇█
`vbar` ▏▎▍▌▋▊▉█
`dots` ⠀⠁⠃⠇⡇⣇⣧⣷⣿
# print all spinner and progress bar styles
from propeller import print_styles
print_styles()
Metadata
Release files for python-propeller 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-propeller-0.2.6.tar.gz | 6.0 kB | Without provenance | Details for python-propeller-0.2.6.tar.gz |
Release files / python-propeller-0.2.6.tar.gz
| Download URL | python-propeller-0.2.6.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a38d47bbf547341b544085b67425fb5b5fdd4d534f1e82e1741fa8a9cfa1bdc7
|
|
BLAKE2b-256 checksum How to use checksums |
0db1211c1f3141aa5bca2b75a293a143a77c23a1666960110677c87896ea40d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-propeller 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.