Indicates progress during runtime, while keeping track of time consumed by user-defined tasks. Not quite a progress bar, not quite a profiler, but something in between which I personally have found to be very handy, especially when working with computationally intensive programs.
Consider this simple dummy program:
from tasktimer import TaskTimer
from time import sleep
timer = TaskTimer()
for n in timer.range(40):
timer.task('Assembling load vector (b)')
sleep(0.1) # Dummy
timer.task('Solving linear system Au=b')
sleep(0.5) # Dummy
print(timer)
The task() method is used to indicate that from now on the program is working on another task. TaskTimer will indicate progress, and display the current task, for instance:
Step 11/40 (28%). 17.5s of 24.1s remaining. Assembling load vector (b)
When all tasks are completed, print(timer) can be used to print statistics of the tasks:
# Mean StDev Total % Assembling load vector (b) 40 101ms 89.2us 4.02s 17 Solving linear system Au=b 40 501ms 140us 20.0s 83 Total 24.1s 100
Many more options than demonstrated here are available, and the functionality is extensively documented in the docstrings. For instance, customization of the progress string (see TaskTimer), iterating over general iterables using the iterate() method, sorting the statistics (see the summary() method). The time tracking of the individual tasks are performed by the Timer class, which can also be used stand-alone.
Installation
Install from PyPI using pip:
pip install TaskTimer
Or download the GitHub repository https://github.com/sigvaldm/TaskTimer.git and run:
python setup.py install
Metadata
Release files for TaskTimer 1.0.4
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 |
|---|---|---|---|---|
| tasktimer-1.0.4.tar.gz | 7.7 kB | Without provenance | Details for tasktimer-1.0.4.tar.gz |
Release files / tasktimer-1.0.4.tar.gz
| Download URL | tasktimer-1.0.4.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a06453597ee5d779ea4163bf5ba4430bf8097003738f044d6b02f83f4a98478
|
|
BLAKE2b-256 checksum How to use checksums |
318d6722accfd312e52e71cb061457215ed864f5c3c3eed9ad90e3b744868ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0a4+
|
Security for TaskTimer 1.0.4
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.