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: 0.3156 s.

load_data: 0.1219 s (38.62%)
solve: 0.1937 s (61.38%)
..  step: 0.1585 s (50.24%)
..  postprocess: 0.0350 s (11.10%)

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.0.3

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.0.3
File Size Uploaded
executiontimer-1.0.3.tar.gz 37.3 kB Details

Built distribution (wheel)

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

Total release size: 48.1 kB

Release files / executiontimer-1.0.3.tar.gz

Download URL executiontimer-1.0.3.tar.gz
Size 37.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cfe21d322a43b143e3e6a73b3013cfb1c6c14b1a2bbe8b3aa63018cc69dc5af6
BLAKE2b-256 checksum
How to use checksums
ab00507ca1c43cbe13d37ce4bff5e2baf93bec4c8a8e8af54d52b917f3485be6
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.0.3-py3-none-any.whl

Download URL executiontimer-1.0.3-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdd8a581045f0ebcecb72766d1c0cb8aad5ff4c1206f2cd6a75866dacaa32499
BLAKE2b-256 checksum
How to use checksums
ee28ffbf038fbc6f9b26263d1efca8973c0adf99d96ead3c8a11df4d3b425c28
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

1.1.1

2 release files

1.1.0

2 release files

This release

1.0.3 This release

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