pip install pudb python import pudb def my_function(): pudb.set_trace() # code goes here python import pudb def my_function(): with pudb.Profiler() as p: # code goes here p.print_stats()