Progress-checkpoint
Helpers for reporting a progress from functions by the means of callbacks.
Examples
Trivial
from progress_checkpoint import dummy_checkpoint, with_progress
def time_consuming_operation(checkpoint=dummy_checkpoint):
for i in with_progress(range(10), checkpoint):
time.sleep(0.2)
time_consuming_operation(lambda p, _: print("{:.0f}%% ready".format(p*100)))
Subcheckpoints
from progress_checkpoint import dummy_checkpoint, with_progress, with_progress_sub
def time_consuming_operation(checkpoint=dummy_checkpoint):
for _ in with_progress(range(10), checkpoint):
sleep(0.1)
def compound_time_consuming_operation(checkpoint=dummy_checkpoint):
for _, subcheckpoint in with_progress_sub(range(2), checkpoint):
time_consuming_operation(subcheckpoint)
compound_time_consuming_operation(lambda p, _: print("{:.0f}% ready".format(p * 100)))
Subcheckpoints with different weights
def time_consuming_operation(num, checkpoint=dummy_checkpoint):
for _ in with_progress(range(num), checkpoint):
sleep(0.1)
def compound_time_consuming_operation(checkpoint=dummy_checkpoint):
counts = [1, 3, 7]
for cnt, subcheckpoint in with_progress_sub(counts, checkpoint, weights=counts):
time_consuming_operation(cnt, subcheckpoint)
compound_time_consuming_operation(lambda p, _: print("{:.0f}% ready".format(p * 100)))
Reporting using progresssbar package
from progress_checkpoint.console import ProgressbarCheckpoint
def time_consuming_operation(checkpoint=dummy_checkpoint):
for _ in with_progress(range(10), checkpoint):
sleep(0.1)
time_consuming_operation(ProgressbarCheckpoint())
Metadata
Release files for progress-checkpoint 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| progress_checkpoint-1.0.5.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| progress_checkpoint-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / progress_checkpoint-1.0.5.tar.gz
| Download URL | progress_checkpoint-1.0.5.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93a154eb9a9a168abc796976622cbc6b241b16a490e11183f17316cdc4c5cc6e
|
|
BLAKE2b-256 checksum How to use checksums |
4e366cb25aec6013a3f24fb5df67c665ea8f21cc2da5ad2539da442c1efec127
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Release files / progress_checkpoint-1.0.5-py3-none-any.whl
| Download URL | progress_checkpoint-1.0.5-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ad0dd4fcd657bcd6b1fe809c92a0330ea570322bc0fd82f57ec63d835eb0b92
|
|
BLAKE2b-256 checksum How to use checksums |
54e04aa4f2d5a736fb4525b1744146a5fdb63f0923d99323cf93b3dfe13e7a2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|