Interaction
Interaction is a Python package for creating nice and colourful progress bars using the map() and apply() method as well as for loops.
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 interaction 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 interaction 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 interaction 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 interaction 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 interaction import iterate
for i in iterate(range(100)):
# do something
pass
Metadata
Release files for interaction 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 | Provenance | Actions |
|---|---|---|---|---|
| interaction-1.3.tar.gz | 5.3 kB | Without provenance | Details for interaction-1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| interaction-1.3-py3-none-any.whl | Python 3 | none | any | Details for interaction-1.3-py3-none-any.whl |
Total release size: 12.5 kB
Release files / interaction-1.3.tar.gz
| Download URL | interaction-1.3.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e23e423f91856f109c69a3508cb7d2f08abcb404109f14fc7b1e1c7541bc9fa
|
|
BLAKE2b-256 checksum How to use checksums |
7b966b66ea12f5a5a3af6bad58e92746b1f880cb27e2d8f3cbdaf7ff5e513d53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Release files / interaction-1.3-py3-none-any.whl
| Download URL | interaction-1.3-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3edcf4f027a4158c5971747dd44fc28c06868c47b2ed2215e62d4ae1cc0c2ca1
|
|
BLAKE2b-256 checksum How to use checksums |
ce9303a2763ee1b6c325f4c2440d88080adac44f1b5b09506a0aa37549da537f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Security for interaction 1.3
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.