Debugging and Profiling¶
These libraries help you with Python development: the debugger enables you to step through code, analyze stack frames and set breakpoints etc., and the profilers run code and give you a detailed breakdown of execution times, allowing you to identify bottlenecks in your programs. Auditing events provide visibility into runtime behaviors that would otherwise require intrusive debugging or patching.
- Audit events table
bdb— Debugger frameworkBdbQuitBreakpointBdbcanonic()reset()trace_dispatch()dispatch_line()dispatch_call()dispatch_return()dispatch_exception()is_skipped_line()stop_here()break_here()break_anywhere()user_call()user_line()user_return()user_exception()do_clear()set_step()set_next()set_return()set_until()set_trace()set_continue()set_quit()set_break()clear_break()clear_bpbynumber()clear_all_file_breaks()clear_all_breaks()get_bpbynumber()get_break()get_breaks()get_file_breaks()get_all_breaks()get_stack()format_stack_entry()run()runeval()runctx()runcall()
checkfuncname()effective()set_trace()
faulthandler— Dump the Python tracebackpdb— The Python Debugger- The Python Profilers
timeit— Measure execution time of small code snippetstrace— Trace or track Python statement executiontracemalloc— Trace memory allocations