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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| executiontimer-1.1.0.tar.gz | 38.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| executiontimer-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.2 kB
Release files / executiontimer-1.1.0.tar.gz
| Download URL | executiontimer-1.1.0.tar.gz |
|---|---|
| Size | 38.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b17883cb3bd8d249b98c7e6c527379c8237c74e592c289df855938754cb21d
|
|
BLAKE2b-256 checksum How to use checksums |
c907fe1799d04a0aa87b9b79ebddae35d59f22b72374511ac867d9941f7133ad
|
| 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.0-py3-none-any.whl
| Download URL | executiontimer-1.1.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f569af8f26504c90e24dd6217e0bf7c06634a6d50150bbf181f46b209deb110f
|
|
BLAKE2b-256 checksum How to use checksums |
e971f3ad4b9d846250f8bb61e2fe14afcea17620954802e8faa29f03f3eddd7b
|
| 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 log