Binary package “python3-line-profiler” in ubuntu bionic

line-by-line profiling for Python

 LineProfiler can be given functions to profile, and it will time the execution
 of each individual line inside those functions. In a typical workflow, one
 only cares about line timings of a few functions because wading through the
 results of timing every single line of code would be overwhelming. However,
 LineProfiler does need to be explicitly told what functions to profile.
 .
 If you are using IPython, there is an implementation of an %lprun magic
 command which will let you specify functions to profile and a statement to
 execute.