ETA Time
A library for tracking, computing, and formatting time estimates in Python. (Based on tqdm.)
Why?
tqdm is probably the most popular option for Python programmers to show progress in their programs. However, I wasn't happy with the default formatting code options, and wanted something that was easier to read and understand for an average user.
In addition, I wanted to be able to access information like ETA in my code. While tqdm sort of lets you do this, it's not well documented, and you would have to dig through the source code to get the values and formulas you want.
etatime is my answer to this. It's a minimal wrapper around tqdm that adds additional formatting codes and well-documented progress stats tracking.
Basic Usage
The main feature of this library is the EtaBar class. This is a wrapper for the tqdm.tqdm class that provides variables which track important ETA state information for use elsewhere in your code.
This uses another package I made called timefmt to format the times into human-readable text.
For more information on the := (walrus) operator, see the documentation.
import time, random
import timefmt
from etatime import EtaBar
for item in (eta := EtaBar(range(9999999))): # Creates a progress bar which tracks stats
... # Do your processing here
print(f"Done processing {eta.stats.total_items} items in {timefmt.td.long(eta.stats.elapsed_timedelta)}!\n")
Here is an example of the sort of output this produces:
14%|█▍ | 1432400/9999999 | R: 0:00:02 | ETA: 5:22:13 PM
...
100%|██████████| 9999999/9999999 | R: ??? | ETA: ???
Done processing 9999999 items in 2 seconds!
You can get more verbose information by replacing the for loop with this:
from etatime import EtaBar
for item in (eta := EtaBar(range(9999999), bar_format="{l_bar}{bar}{r_barL}")):
... # Do your processing here
Here is an example of the long output:
35%|███▌ | 3545009/9999999 | R: 1 second | ETA: 5:26:11 PM MST
All keyword arguments other than bar_format get passed directly to tqdm.tqdm. bar_format is pre-processed by etatime in order to inject some new custom formatting codes:
startS: The starting time in short digit format.startL: The starting time written out in plain english.currentS: The current (loop start time) time in short digit format.currentL: The current (loop start time) time written out in plain english.elapsedS: The elapsed time in short digit format.elapsedL: The elapsed time written out in plain english.remainingS: The remaining time in short digit format.remainingL: The remaining time written out in plain english.etaS: The ETA time in short digit format.etaL: The ETA time written out in plain english.r_barS=="| {n_fmt}/{total_fmt} | {remainingS} | {etaS}"r_barL=="| {n_fmt}/{total_fmt} | {remainingL} | {etaL}"
The following attributes are available in the stats data class of the EtaBar instance:
total_itemsrateinitialnpercentstart_time(seconds)start_datetime
current_time(seconds)current_datetime
elapsed_time(seconds)elapsed_timedelta
remaining_time(seconds)remaining_timedelta
eta_time(seconds)eta_datetime
Full Documentation
Metadata
Release files for etatime 3.5.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 |
|---|---|---|---|---|
| etatime-3.5.4.tar.gz | 16.5 kB | Without provenance | Details for etatime-3.5.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| etatime-3.5.4-py3-none-any.whl | Python 3 | none | any | Details for etatime-3.5.4-py3-none-any.whl |
Total release size: 33.8 kB
Release files / etatime-3.5.4.tar.gz
| Download URL | etatime-3.5.4.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d48ec84c7d6daba4c6cc11d9acac9604f709cad935d6910925229315850d288
|
|
BLAKE2b-256 checksum How to use checksums |
e1dc44275bfbc8c40da86b71948858e91d7c3dd6142b712b45113a36268c7bbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / etatime-3.5.4-py3-none-any.whl
| Download URL | etatime-3.5.4-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fe8ab862318f4ea31a9a105ed3e746078b070936ffaf5311aed7199bac8e9f3
|
|
BLAKE2b-256 checksum How to use checksums |
4f3ec2bfd79ea9b086ec54617fe765eb07680fef875b1347a3cbd870602c7053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for etatime 3.5.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.