ez-timer
The easiest way to time a code block in Python.
Quick Links:
Overview
ez-timer provides a single, easy to use API for timing function calls.
with ez_timer() as timer:
1 + 1
timer.result
# 0.000001
That is it. That is the API. Solves one problem, and solves it well.
Background
When working on extensive profiling for an enterprise Python project I regularly found myself writing:
start = time.time()
# some code
end = time.time()
result = end - start
# do something with result
While timeit exists, I found timeit to be heavy handed for what I needed in 90% of cases.
This inspired me to create ez-timer.
Installation
ez-timer can be installed from pypi:
pip install ez-timer
Usage
Using ez-timer is simple:
from ez_timer import ez_timer
with ez_timer() as timer:
# run expensive computation
time.sleep(1)
print(timer.result)
# > 1.0001
That's all. That is the API.
Metadata
Release files for ez-timer 0.0.2
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 |
|---|---|---|---|---|
| ez-timer-0.0.2.tar.gz | 2.7 kB | Without provenance | Details for ez-timer-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ez_timer-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for ez_timer-0.0.2-py3-none-any.whl |
Total release size: 5.4 kB
Release files / ez-timer-0.0.2.tar.gz
| Download URL | ez-timer-0.0.2.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
528debbe3e59a369f6eb755bc96f8be54b59b34e00da87b4502b2aecff146542
|
|
BLAKE2b-256 checksum How to use checksums |
57be029be6d0f3200b39b2e54ed15ca75c95ae3e8d97bb8fc34605de644de0da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
|
Release files / ez_timer-0.0.2-py3-none-any.whl
| Download URL | ez_timer-0.0.2-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c9456423266a1276e4a037096fc6345f5b69b6e941e0230e0e6e79bab598c02
|
|
BLAKE2b-256 checksum How to use checksums |
62c55e745951f7d31e3b10140f989587ed98d5792eefb75f241abc13643b50e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.0 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
|
Security for ez-timer 0.0.2
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.