ipython-autotime

raw JSON →
0.3.2 verified Mon Apr 27 auth: no python

An IPython extension that automatically measures and displays the execution time of every cell. Requires IPython/Jupyter. Version 0.3.2; last release 2024. Minimal and stable.

pip install ipython-autotime
error ModuleNotFoundError: No module named 'autotime'
cause Trying to import autotime as a Python module directly, or running outside IPython.
fix
Run 'pip install ipython-autotime' and then use '%load_ext autotime' inside IPython/Jupyter.
error UsageError: Line magic function `%autotime` not found.
cause Forgot to load the extension first, or extension not installed correctly.
fix
First run '%load_ext autotime', then '%autotime' can be used (though usually you just load it).
error TypeError: enable_autotime() got an unexpected keyword argument 'started'
cause Using an older version of ipython-autotime that doesn't support the 'started' argument.
fix
Update to the latest version: 'pip install --upgrade ipython-autotime'
gotcha Running '%load_ext autotime' in a terminal that doesn't support IPython will fail with ImportError or ModuleNotFoundError.
fix Ensure you are using IPython, Jupyter notebook, or JupyterLab. Do not run in plain Python interpreter.
gotcha Timing includes the time to import modules and run setup inside the cell, not just the main computation.
fix If you need to exclude import overhead, move imports outside the timed cell.
gotcha autotime uses time.perf_counter or monotonic clock; wall time may vary due to system load.
fix For reproducible benchmarks, use %timeit or timeit module instead.
deprecated Versions before 0.3.0 did not show the 'started' timestamp. If you rely on old output format, format changed.
fix Update to 0.3.0+ or parse the new output format.

Load the extension in IPython or Jupyter notebook. It will start timing all cells.

%load_ext autotime
# After loading, every cell shows execution time automatically