Repository navigation
v0.1.0
First public release of executiontimer — hierarchical execution timing with user-defined categories.
pip install executiontimerfrom 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 isexecution_timer.
Highlights
TimerContextworks as both a context manager and a decorator- Nested
withblocks automatically form a hierarchy in the report - Native
async defsupport — timing spans the wholeawait - 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 withflatten=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.