Lucifer
Lucifer is a Python package for creating nice and colourful progress bars using the map() and apply() method as well as for loops.
Etymology
Old English Lucifer "Satan," also "morning star, Venus in the morning sky before sunrise," also an epithet or name of Diana, from Latin Lucifer "morning star," noun use of adjective, literally "light-bringing," from lux (genitive lucis) "light" (from PIE root *leuk- "light, brightness") + ferre "to carry, bear," from PIE root *bher- (1) "to carry," also "to bear children." Venus in the evening sky was Hesperus.
ProgressBar
To use a progress bar you need to initiate a ProgressBar object with the maximum progress amount (total) and call the show method of the object with the amount to update the progress bar.
from lucifer import ProgressBar
from time import sleep
bar = ProgressBar(total=100)
for i in range(100):
sleep(0.05)
bar.show(amount=i+1)
You can also add your own text to the progress bar.
from lucifer import ProgressBar
from time import sleep
bar = ProgressBar(total=100)
for i in range(100):
sleep(0.05)
bar.show(amount=i+1, text=f'working on {i}')
map
You can also use the ProgressBar's map method instead of Python's map method. The output is an iterable. As soon as you turn the iterable object into a list the progress bar will be displayed.
from lucifer import ProgressBar
from time import sleep
list1 = list(range(100))
def wait_and_double(x, wait_time):
sleep(wait_time)
return x*2
# this will not make the progress bar appear
iterable2 = ProgressBar.map(
function=lambda x: wait_and_double(x=x, wait_time=0.05),
iterable=list1
)
# this will make the progress bar appear
list2 = list(iterable2)
apply
ProgressBar also works with Panda's DataFrame and Series objects.
from lucifer import ProgressBar
from time import sleep
from pandas import DataFrame
data = DataFrame({
'name':['Arminius', 'Boudica', 'Alaric', 'Attila', 'Genseric'],
'ethnicity': ['German', 'Celt', 'Goth', 'Hun', 'Vandal']
})
data['name_and_ethnicity'] = ProgressBar.apply(
data=data,
function=lambda x: x['name']+' the '+x['ethnicity']
)
data['name_lower'] = ProgressBar.apply(
series=data['name'],
function=lambda x: x.lower()
)
iterate
You can also use ProgressBar to for iterating over iterable objects, especially for loops.
from lucifer import iterate
for i in iterate(range(100)):
# do something
pass
Release files for lucifer 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lucifer-1.3.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lucifer-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / lucifer-1.3.tar.gz
| Download URL | lucifer-1.3.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2cb298f7b0eea1139327dd24a6bb43bfa4619ce43800e0b87ecfe083afb6af2
|
|
BLAKE2b-256 checksum How to use checksums |
b806b4e5ec093cea8b23898f6f59bf2f1609b6d88d73a963cc15f678de1fe4e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.13.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Release files / lucifer-1.3-py3-none-any.whl
| Download URL | lucifer-1.3-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64e4b1195ed25a5a6de54c8345073a81caa458cf8b2d52c90a20b1ac8678be6a
|
|
BLAKE2b-256 checksum How to use checksums |
c9536725fd9965c36f8e7cf2fa417c3c9b7345b868c68192a8cd89a764096584
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.13.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|