Skip to main content

executiontimer

PyPI version Python versions CI License Documentation

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

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)

Source distribution for executiontimer 1.1.1
File Size Uploaded
executiontimer-1.1.1.tar.gz 39.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for executiontimer 1.1.1
File Interpreter ABI Platform
executiontimer-1.1.1-py3-none-any.whl Python 3 none any Details

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 log

Release 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 log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page