Skip to content

v0.1.0

Choose a tag to compare

@seba2390 seba2390 released this 20 Aug 19:56
· 20 commits to main since this release
39cdf36

First public release of executiontimer — hierarchical execution timing with user-defined categories.

pip install executiontimer
from execution_timer import TimerContext, get_execution_times_report

with TimerContext("solve"):
    with TimerContext("step", category="gpu"):
        ...

print(get_execution_times_report())

The install name is executiontimer; the import name is execution_timer.

Highlights

  • TimerContext works as both a context manager and a decorator
  • Nested with blocks automatically form a hierarchy in the report
  • Native async def support — timing spans the whole await
  • Per-thread and per-asyncio-task context isolation via contextvars
  • User-defined categories with per-category totals, and optional forbidden-nesting rules
  • Loop counters via counter=, merged back together with flatten=True
  • JSON export for dashboards, CI, or an LLM
  • Zero dependencies, fully typed, ships py.typed

Requires Python 3.12+. Tested on 3.12, 3.13 and 3.14 across Linux, macOS and Windows.

See CHANGELOG.md for the full list.