Time named sections of your code with a with block or a decorator. Sections nested inside
each other form a tree, so you see where the time actually went, not just one number at the
end.
Zero dependencies. Fully typed. Works with threads and asyncio.
Documentation
seba2390.github.io/ExecutionTimer
Installation
pip install executiontimer
Requires Python 3.11+. The install name is executiontimer; the import name is
execution_timer.
Quick start
import time
from execution_timer import TimerContext, get_execution_times_report
with TimerContext("load_data"):
time.sleep(0.12)
with TimerContext("solve"):
for i in range(3):
with TimerContext("step", category="gpu", counter=i):
time.sleep(0.05)
with TimerContext("postprocess", category="cpu"):
time.sleep(0.03)
print(get_execution_times_report())
Total time: 312.838 ms.
load_data: 124.682 ms (39.85%)
solve: 188.157 ms (60.15%)
.. step: 154.718 ms (49.46%)
.. postprocess: 33.295 ms (10.64%)
TimerContext also works as a decorator, including on async def functions:
@TimerContext("preprocess")
def preprocess(rows: list[str]) -> list[str]:
return [row.strip() for row in rows]
Learn more
- Getting started
- User guide: timing code, counters, categories, reports and JSON export, threads, asyncio and generators
- API reference
- Changelog and contributing guide
License
MIT — see LICENSE.
Metadata
Release files for executiontimer 1.1.1
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 |
|---|---|---|---|---|
| executiontimer-1.1.1.tar.gz | 39.7 kB | With provenance | Details for executiontimer-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| executiontimer-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for executiontimer-1.1.1-py3-none-any.whl |
Total release size: 50.7 kB
Release files / executiontimer-1.1.1.tar.gz
| Download URL | executiontimer-1.1.1.tar.gz |
|---|---|
| Size | 39.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca0286f23a0991e1069a0c5107dd91f10c38705150ba6f1b21a2f1947edbba31
|
|
BLAKE2b-256 checksum How to use checksums |
5d5e38a68fcec6fe9f0780a20222dc13f87e0aa7dbb830acf28da65b94791764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / executiontimer-1.1.1-py3-none-any.whl
| Download URL | executiontimer-1.1.1-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1ff3b17b4956723e48090f59444a0cac419432c63fde4825fa2b2a2fc56f728
|
|
BLAKE2b-256 checksum How to use checksums |
09bbcf3b8540f8aa0e7c81e6397faea524a41a1ed13e2800f3f3f7278736b00f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logSecurity for executiontimer 1.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for executiontimer-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logA 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.