(OLD REPO) Line-by-line profiling for Python - Current repo ->

Overview

line_profiler and kernprof

line_profiler is a module for doing line-by-line profiling of functions. kernprof is a convenient script for running either line_profiler or the Python standard library's cProfile or profile modules, depending on what is available.

They are available under a BSD license.

Installation

Note: As of version 2.1.2, pip install line_profiler does not work. Please install as follows until it is fixed in the next release:

git clone https://github.com/rkern/line_profiler.git
find line_profiler -name '*.pyx' -exec cython {} \;
cd line_profiler
pip install . --user

Releases of line_profiler can be installed using pip:

$ pip install line_profiler

Source releases and any binaries can be downloaded from the PyPI link.

http://pypi.python.org/pypi/line_profiler

To check out the development sources, you can use Git:

$ git clone https://github.com/rkern/line_profiler.git

You may also download source tarballs of any snapshot from that URL.

Source releases will require a C compiler in order to build line_profiler. In addition, git checkouts will also require Cython >= 0.10. Source releases on PyPI should contain the pregenerated C sources, so Cython should not be required in that case.

kernprof is a single-file pure Python script and does not require a compiler. If you wish to use it to run cProfile and not line-by-line profiling, you may copy it to a directory on your PATH manually and avoid trying to build any C extensions.

line_profiler

The current profiling tools supported in Python 2.7 and later only time function calls. This is a good first step for locating hotspots in one's program and is frequently all one needs to do to optimize the program. However, sometimes the cause of the hotspot is actually a single line in the function, and that line may not be obvious from just reading the source code. These cases are particularly frequent in scientific computing. Functions tend to be larger (sometimes because of legitimate algorithmic complexity, sometimes because the programmer is still trying to write FORTRAN code), and a single statement without function calls can trigger lots of computation when using libraries like numpy. cProfile only times explicit function calls, not special methods called because of syntax. Consequently, a relatively slow numpy operation on large arrays like this,

a[large_index_array] = some_other_large_array

is a hotspot that never gets broken out by cProfile because there is no explicit function call in that statement.

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. The easiest way to get started is to use the kernprof script.

$ kernprof -l script_to_profile.py

kernprof will create an instance of LineProfiler and insert it into the __builtins__ namespace with the name profile. It has been written to be used as a decorator, so in your script, you decorate the functions you want to profile with @profile.

@profile
def slow_function(a, b, c):
    ...

The default behavior of kernprof is to put the results into a binary file script_to_profile.py.lprof . You can tell kernprof to immediately view the formatted results at the terminal with the [-v/--view] option. Otherwise, you can view the results later like so:

$ python -m line_profiler script_to_profile.py.lprof

For example, here are the results of profiling a single function from a decorated version of the pystone.py benchmark (the first two lines are output from pystone.py, not kernprof):

Pystone(1.1) time for 50000 passes = 2.48
This machine benchmarks at 20161.3 pystones/second
Wrote profile results to pystone.py.lprof
Timer unit: 1e-06 s

File: pystone.py
Function: Proc2 at line 149
Total time: 0.606656 s

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
   149                                           @profile
   150                                           def Proc2(IntParIO):
   151     50000        82003      1.6     13.5      IntLoc = IntParIO + 10
   152     50000        63162      1.3     10.4      while 1:
   153     50000        69065      1.4     11.4          if Char1Glob == 'A':
   154     50000        66354      1.3     10.9              IntLoc = IntLoc - 1
   155     50000        67263      1.3     11.1              IntParIO = IntLoc - IntGlob
   156     50000        65494      1.3     10.8              EnumLoc = Ident1
   157     50000        68001      1.4     11.2          if EnumLoc == Ident1:
   158     50000        63739      1.3     10.5              break
   159     50000        61575      1.2     10.1      return IntParIO

The source code of the function is printed with the timing information for each line. There are six columns of information.

  • Line #: The line number in the file.
  • Hits: The number of times that line was executed.
  • Time: The total amount of time spent executing the line in the timer's units. In the header information before the tables, you will see a line "Timer unit:" giving the conversion factor to seconds. It may be different on different systems.
  • Per Hit: The average amount of time spent executing the line once in the timer's units.
  • % Time: The percentage of time spent on that line relative to the total amount of recorded time spent in the function.
  • Line Contents: The actual source code. Note that this is always read from disk when the formatted results are viewed, not when the code was executed. If you have edited the file in the meantime, the lines will not match up, and the formatter may not even be able to locate the function for display.

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. It will also add its LineProfiler instance into the __builtins__, but typically, you would not use it like that.

For IPython 0.11+, you can install it by editing the IPython configuration file ~/.ipython/profile_default/ipython_config.py to add the 'line_profiler' item to the extensions list:

c.TerminalIPythonApp.extensions = [
    'line_profiler',
]

To get usage help for %lprun, use the standard IPython help mechanism:

In [1]: %lprun?

These two methods are expected to be the most frequent user-level ways of using LineProfiler and will usually be the easiest. However, if you are building other tools with LineProfiler, you will need to use the API. There are two ways to inform LineProfiler of functions to profile: you can pass them as arguments to the constructor or use the add_function(f) method after instantiation.

profile = LineProfiler(f, g)
profile.add_function(h)

LineProfiler has the same run(), runctx(), and runcall() methods as cProfile.Profile as well as enable() and disable(). It should be noted, though, that enable() and disable() are not entirely safe when nested. Nesting is common when using LineProfiler as a decorator. In order to support nesting, use enable_by_count() and disable_by_count(). These functions will increment and decrement a counter and only actually enable or disable the profiler when the count transitions from or to 0.

After profiling, the dump_stats(filename) method will pickle the results out to the given file. print_stats([stream]) will print the formatted results to sys.stdout or whatever stream you specify. get_stats() will return LineStats object, which just holds two attributes: a dictionary containing the results and the timer unit.

kernprof

kernprof also works with cProfile, its third-party incarnation lsprof, or the pure-Python profile module depending on what is available. It has a few main features:

  • Encapsulation of profiling concerns. You do not have to modify your script in order to initiate profiling and save the results. Unless if you want to use the advanced __builtins__ features, of course.
  • Robust script execution. Many scripts require things like __name__, __file__, and sys.path to be set relative to it. A naive approach at encapsulation would just use execfile(), but many scripts which rely on that information will fail. kernprof will set those variables correctly before executing the script.
  • Easy executable location. If you are profiling an application installed on your PATH, you can just give the name of the executable. If kernprof does not find the given script in the current directory, it will search your PATH for it.
  • Inserting the profiler into __builtins__. Sometimes, you just want to profile a small part of your code. With the [-b/--builtin] argument, the Profiler will be instantiated and inserted into your __builtins__ with the name "profile". Like LineProfiler, it may be used as a decorator, or enabled/disabled with enable_by_count() and disable_by_count(), or even as a context manager with the "with profile:" statement.
  • Pre-profiling setup. With the [-s/--setup] option, you can provide a script which will be executed without profiling before executing the main script. This is typically useful for cases where imports of large libraries like wxPython or VTK are interfering with your results. If you can modify your source code, the __builtins__ approach may be easier.

The results of profile script_to_profile.py will be written to script_to_profile.py.prof by default. It will be a typical marshalled file that can be read with pstats.Stats(). They may be interactively viewed with the command:

$ python -m pstats script_to_profile.py.prof

Such files may also be viewed with graphical tools like kcachegrind through the converter program pyprof2calltree or RunSnakeRun.

Frequently Asked Questions

  • Why the name "kernprof"?

    I didn't manage to come up with a meaningful name, so I named it after myself.

  • Why not use hotshot instead of line_profile?

    hotshot can do line-by-line timings, too. However, it is deprecated and may disappear from the standard library. Also, it can take a long time to process the results while I want quick turnaround in my workflows. hotshot pays this processing time in order to make itself minimally intrusive to the code it is profiling. Code that does network operations, for example, may even go down different code paths if profiling slows down execution too much. For my use cases, and I think those of many other people, their line-by-line profiling is not affected much by this concern.

  • Why not allow using hotshot from kernprof.py?

    I don't use hotshot, myself. I will accept contributions in this vein, though.

  • The line-by-line timings don't add up when one profiled function calls another. What's up with that?

    Let's say you have function F() calling function G(), and you are using LineProfiler on both. The total time reported for G() is less than the time reported on the line in F() that calls G(). The reason is that I'm being reasonably clever (and possibly too clever) in recording the times. Basically, I try to prevent recording the time spent inside LineProfiler doing all of the bookkeeping for each line. Each time Python's tracing facility issues a line event (which happens just before a line actually gets executed), LineProfiler will find two timestamps, one at the beginning before it does anything (t_begin) and one as close to the end as possible (t_end). Almost all of the overhead of LineProfiler's data structures happens in between these two times.

    When a line event comes in, LineProfiler finds the function it belongs to. If it's the first line in the function, we record the line number and t_end associated with the function. The next time we see a line event belonging to that function, we take t_begin of the new event and subtract the old t_end from it to find the amount of time spent in the old line. Then we record the new t_end as the active line for this function. This way, we are removing most of LineProfiler's overhead from the results. Well almost. When one profiled function F calls another profiled function G, the line in F that calls G basically records the total time spent executing the line, which includes the time spent inside the profiler while inside G.

    The first time this question was asked, the questioner had the G() function call as part of a larger expression, and he wanted to try to estimate how much time was being spent in the function as opposed to the rest of the expression. My response was that, even if I could remove the effect, it might still be misleading. G() might be called elsewhere, not just from the relevant line in F(). The workaround would be to modify the code to split it up into two lines, one which just assigns the result of G() to a temporary variable and the other with the rest of the expression.

    I am open to suggestions on how to make this more robust. Or simple admonitions against trying to be clever.

  • Why do my list comprehensions have so many hits when I use the LineProfiler?

    LineProfiler records the line with the list comprehension once for each iteration of the list comprehension.

  • Why is kernprof distributed with line_profiler? It works with just cProfile, right?

    Partly because kernprof.py is essential to using line_profiler effectively, but mostly because I'm lazy and don't want to maintain the overhead of two projects for modules as small as these. However, kernprof.py is a standalone, pure Python script that can be used to do function profiling with just the Python standard library. You may grab it and install it by itself without line_profiler.

  • Do I need a C compiler to build line_profiler? kernprof.py?

    You do need a C compiler for line_profiler. kernprof.py is a pure Python script and can be installed separately, though.

  • Do I need Cython to build line_profiler?

    You should not have to if you are building from a released source tarball. It should contain the generated C sources already. If you are running into problems, that may be a bug; let me know. If you are building from a git checkout or snapshot, you will need Cython to generate the C sources. You will probably need version 0.10 or higher. There is a bug in some earlier versions in how it handles NULL PyObject* pointers.

  • What version of Python do I need?

    Both line_profiler and kernprof have been tested with Python 2.7, and 3.2-3.4.

To Do

cProfile uses a neat "rotating trees" data structure to minimize the overhead of looking up and recording entries. LineProfiler uses Python dictionaries and extension objects thanks to Cython. This mostly started out as a prototype that I wanted to play with as quickly as possible, so I passed on stealing the rotating trees for now. As usual, I got it working, and it seems to have acceptable performance, so I am much less motivated to use a different strategy now. Maybe later. Contributions accepted!

Bugs and Such

Bugs and pull requested can be submitted on GitHub.

Changes

2.1

  • ENH: Add support for Python 3.5 coroutines
  • ENH: Documentation updates
  • ENH: CI for most recent Python versions (3.5, 3.6, 3.6-dev, 3.7-dev, nightly)
  • ENH: Add timer unit argument for output time granularity spec

2.0

  • BUG: Added support for IPython 5.0+, removed support for IPython <=0.12

1.1

  • BUG: Read source files as bytes.

1.0

  • ENH: kernprof.py is now installed as kernprof.
  • ENH: Python 3 support. Thanks to the long-suffering Mikhail Korobov for being patient.
  • Dropped 2.6 as it was too annoying.
  • ENH: The stripzeros and add_module options. Thanks to Erik Tollerud for contributing it.
  • ENH: Support for IPython cell blocks. Thanks to Michael Forbes for adding this feature.
  • ENH: Better warnings when building without Cython. Thanks to David Cournapeau for spotting this.

1.0b3

  • ENH: Profile generators.
  • BUG: Update for compatibility with newer versions of Cython. Thanks to Ondrej Certik for spotting the bug.
  • BUG: Update IPython compatibility for 0.11+. Thanks to Yaroslav Halchenko and others for providing the updated imports.

1.0b2

  • BUG: fixed line timing overflow on Windows.
  • DOC: improved the README.

1.0b1

  • Initial release.
Comments
  • Update for compatibility with IPython 5.0

    Update for compatibility with IPython 5.0

    Replaces the depreciated ip.define_magic() method with ip.register_magics() and some modifications to handle the different API required.

    Also tested with IPython 4.1.1. I don't know how far back the ip.register_magics() method goes, so I'm not sure how far back it's compatible.

    Edit: Apparently the new API was included as far back as 0.13, and the old API was finally removed in 5.0. So removing support for the old API entirely is pretty unlikely to cause problems.

    opened by caethan 32
  • UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 553: illegal multibyte sequence

    UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 553: illegal multibyte sequence

    On windows, if the python script is encoded with utf-8 while the system default encoding is gbk, when running kernprof -l it would throw error like:

    Traceback (most recent call last):
      File "C:\Anaconda3\lib\runpy.py", line 170, in _run_module_as_main
        "__main__", mod_spec)
      File "C:\Anaconda3\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Anaconda3\Scripts\kernprof.exe\__main__.py", line 9, in <module>
      File "C:\Anaconda3\lib\site-packages\kernprof.py", line 221, in main
        execfile(script_file, ns, ns)
      File "C:\Anaconda3\lib\site-packages\kernprof.py", line 34, in execfile
        exec_(compile(f.read(), filename, 'exec'), globals, locals)
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 553: illegal multibyte sequence
    

    I currently workaround this by converting the python file to gbk first, run kernprof. If I try to view the FILE.lprof file with python -m line_profiler FILE.lprof now, it would also give encoding error, and then I have to convert the python script back to utf-8 and run python -m line_profiler FILE.lprof to view the results. Is there a better way?

    opened by xgdgsc 21
  • Better document @profile usage

    Better document @profile usage

    It's unclear to me as to whether this is required, but after running without using this decorator anywhere, I got no results, so I'm assuming it is. I tried importing line_profiler in ipython and seeing if the decorator was there, but I didn't see it. I'm digging through the code now to see if I can figure it out.

    opened by dellis23 19
  • Get support for new 3.5 Python coroutines

    Get support for new 3.5 Python coroutines

    This commit implement the proper stuff to decorate the new coroutine style implemented by Python3.5 and their new statments, making the canonical profile decorator compatible.

    To hide incompatible 3.5 statements between versions. The idea is be able to run all Python versions, since 2.X to 3.5 without break the current behaviour. The Python 3.5 specific code is hidden into private files that will be imported only in 3.5 environments.

    opened by pfreixes 9
  • 'line_profiler' is a package and cannot be directly executed

    'line_profiler' is a package and cannot be directly executed

    Command: python -m line_profiler test.py.lprof

    Error messages:

    /data/anaconda/envs/p36/bin/python: No module named line_profiler.__main__; 'line_profiler' is a package and cannot be directly executed
    
    opened by donglixp 7
  • Installation failure

    Installation failure

    running install
    
    running build
    
    running build_py
    
    creating build
    
    creating build\lib.win-amd64-3.4
    
    copying line_profiler.py -> build\lib.win-amd64-3.4
    
    copying kernprof.py -> build\lib.win-amd64-3.4
    
    running build_ext
    
    building '_line_profiler' extension
    
    error: Unable to find vcvarsall.bat
    

    I get this error when I try to install using pip. After that, the installation terminates and the tool is not available.

    opened by Darker 7
  • Error when loading profile data: cPickle.UnpicklingError: invalid load key

    Error when loading profile data: cPickle.UnpicklingError: invalid load key

    Current version on PyPI (1.0) errors out when loading the pickled data. This is a virtualenv'ed Python on Fedora 20.

    (virtualenv)rbu@saul ~ $ cat bla.py 
    @profile
    def hello():
        print('Hello, world!')
    
    hello()
    
    
    (virtualenv)rbu@saul ~ $ kernprof --line-by-line bla.py
    Hello, world!
    Wrote profile results to bla.py.lprof
    
    (virtualenv)rbu@saul ~ $ python -m line_profiler bla.py
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/home/rbu/devel/virtualenvs/virtualenv/lib/python2.7/site-packages/line_profiler.py", line 394, in <module>
        main()
      File "/home/rbu/devel/virtualenvs/virtualenv/lib/python2.7/site-packages/line_profiler.py", line 390, in main
        lstats = load_stats(args[0])
      File "/home/rbu/devel/virtualenvs/virtualenv/lib/python2.7/site-packages/line_profiler.py", line 380, in load_stats
        return pickle.load(f)
    cPickle.UnpicklingError: invalid load key, '@'.
    
    (virtualenv)1 rbu@saul ~ $ python --version
    Python 2.7.5
    
    (virtualenv)rbu@saul ~ $ hexdump -C  bla.py.lprof    
    00000000  80 02 63 5f 6c 69 6e 65  5f 70 72 6f 66 69 6c 65  |..c_line_profile|
    00000010  72 0a 4c 69 6e 65 53 74  61 74 73 0a 71 01 29 81  |r.LineStats.q.).|
    00000020  71 02 7d 71 03 28 55 04  75 6e 69 74 71 04 47 3e  |q.}q.(U.unitq.G>|
    00000030  b0 c6 f7 a0 b5 ed 8d 55  07 74 69 6d 69 6e 67 73  |.......U.timings|
    00000040  71 05 7d 71 06 55 06 62  6c 61 2e 70 79 71 07 4b  |q.}q.U.bla.pyq.K|
    00000050  01 55 05 68 65 6c 6c 6f  71 08 87 5d 71 09 4b 03  |.U.helloq..]q.K.|
    00000060  4b 01 4b 1e 87 71 0a 61  73 75 62 2e              |K.K..q.asub.|
    0000006c
    
    opened by rbu 7
  • [Cannot install via pip on Windows 10] error: Unable to find vcvarsall.bat

    [Cannot install via pip on Windows 10] error: Unable to find vcvarsall.bat

    I am using Python 3.5.2 on Windows 10. I have Microsoft Visual Studio 14 installed. In environment variables, I have the following:

    VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
    VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\
    

    I could not find any prebuilt binaries. So have to build. I ran pip install line_profiler from Developer Command Prompt VS2015 and I get this error:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0>pip install line_profiler
    Collecting line_profiler
      Using cached line_profiler-1.0.tar.gz
    Building wheels for collected packages: line-profiler
      Running setup.py bdist_wheel for line-profiler ... error
      Complete output from command C:\Users\arvindpdmn\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ARVIND~1\\AppData\\Local\\Temp\\pip-build-3v9i325n\\line-profiler\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\ARVIND~1\AppData\Local\Temp\tmppb24vd4kpip-wheel- --python-tag cp35:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.5
      copying line_profiler.py -> build\lib.win-amd64-3.5
      copying kernprof.py -> build\lib.win-amd64-3.5
      running build_ext
      skipping '_line_profiler.c' Cython extension (up-to-date)
      building '_line_profiler' extension
      error: Unable to find vcvarsall.bat
    
      ----------------------------------------
      Failed building wheel for line-profiler
      Running setup.py clean for line-profiler
    Failed to build line-profiler
    Installing collected packages: line-profiler
      Running setup.py install for line-profiler ... error
        Complete output from command C:\Users\arvindpdmn\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ARVIND~1\\AppData\\Local\\Temp\\pip-build-3v9i325n\\line-profiler\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ARVIND~1\AppData\Local\Temp\pip-rw3tld7h-record\install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.5
        copying line_profiler.py -> build\lib.win-amd64-3.5
        copying kernprof.py -> build\lib.win-amd64-3.5
        running build_ext
        skipping '_line_profiler.c' Cython extension (up-to-date)
        building '_line_profiler' extension
        error: Unable to find vcvarsall.bat
    
        ----------------------------------------
    Command "C:\Users\arvindpdmn\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ARVIND~1\\AppData\\Local\\Temp\\pip-build-3v9i325n\\line-profiler\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ARVIND~1\AppData\Local\Temp\pip-rw3tld7h-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ARVIND~1\AppData\Local\Temp\pip-build-3v9i325n\line-profiler\
    
    opened by arvindpdmn 6
  • NameError: name 'profile' is not defined

    NameError: name 'profile' is not defined

    @rkern - I have recently installed line_profiler using pip, with no apparent problems. I attempt to run the exact trivial test in #35 and run into the exact same error message. #35 refers to #25 as the resolution to the problem, but reading through #25 I do not see where the problem was resolved. I use OS X with python 2.7.11

    Traceback (most recent call last): File "/Users/aphearin/anaconda/bin/kernprof", line 11, in sys.exit(main()) File "/Users/aphearin/anaconda/lib/python2.7/site-packages/kernprof.py", line 221, in main execfile(script_file, ns, ns) File "hello_world.py", line 2, in @profile NameError: name 'profile' is not defined

    opened by aphearin 6
  • Set number of times to run function with line_profiler

    Set number of times to run function with line_profiler

    It might be nice to get some better statistics to set some number of times to run the function like what is done with timeit. This way if there is some drift from run to run it will hopefully cancel out on the average. This would also allow for some error bars to be added. If there is already a way to do this, please let me know.

    Also, thanks for such an awesome tool. This is my favorite Python profiling tool by far.

    opened by jakirkham 6
  • TypeError: main() takes exactly 1 argument (0 given)

    TypeError: main() takes exactly 1 argument (0 given)

    I use this script to profile.

    But when I run kernprof, get the error like this:

    R:\>kernprof -l example.py
    Traceback (most recent call last):
      File "C:\Anaconda\Scripts\kernprof-script.py", line 9, in <module>
        load_entry_point('line-profiler==1.0', 'console_scripts', 'kernprof')()
    TypeError: main() takes exactly 1 argument (0 given)
    

    I use python(anaconda) on windows x64, and have installed line-profiler 1.0 already.

    Can you give me some advises?

    opened by HaveF 6
Silky smooth profiling for Django

Silk Silk is a live profiling and inspection tool for the Django framework. Silk intercepts and stores HTTP requests and database queries before prese

Jazzband 3.7k Jan 1, 2023
An x86 old-debug-like program.

An x86 old-debug-like program.

Pablo Niklas 1 Jan 10, 2022
A configurable set of panels that display various debug information about the current request/response.

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

Jazzband 7.3k Dec 31, 2022
A configurable set of panels that display various debug information about the current request/response.

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

Jazzband 7.3k Dec 29, 2022
pdb++, a drop-in replacement for pdb (the Python debugger)

pdb++, a drop-in replacement for pdb What is it? This module is an extension of the pdb module of the standard library. It is meant to be fully compat

null 1k Dec 24, 2022
Full-screen console debugger for Python

PuDB: a console-based visual debugger for Python Its goal is to provide all the niceties of modern GUI-based debuggers in a more lightweight and keybo

Andreas Klöckner 2.6k Jan 1, 2023
Trace any Python program, anywhere!

lptrace lptrace is strace for Python programs. It lets you see in real-time what functions a Python program is running. It's particularly useful to de

Karim Hamidou 687 Nov 20, 2022
Debugging manhole for python applications.

Overview docs tests package Manhole is in-process service that will accept unix domain socket connections and present the stacktraces for all threads

Ionel Cristian Mărieș 332 Dec 7, 2022
Debugger capable of attaching to and injecting code into python processes.

DISCLAIMER: This is not an official google project, this is just something I wrote while at Google. Pyringe What this is Pyringe is a python debugger

Google 1.6k Dec 15, 2022
Monitor Memory usage of Python code

Memory Profiler This is a python module for monitoring memory consumption of a process as well as line-by-line analysis of memory consumption for pyth

Fabian Pedregosa 80 Nov 18, 2022
Sampling profiler for Python programs

py-spy: Sampling profiler for Python programs py-spy is a sampling profiler for Python programs. It lets you visualize what your Python program is spe

Ben Frederickson 9.5k Jan 8, 2023
🔥 Pyflame: A Ptracing Profiler For Python. This project is deprecated and not maintained.

Pyflame: A Ptracing Profiler For Python (This project is deprecated and not maintained.) Pyflame is a high performance profiling tool that generates f

Uber Archive 3k Jan 7, 2023
Visual profiler for Python

vprof vprof is a Python package providing rich and interactive visualizations for various Python program characteristics such as running time and memo

Nick Volynets 3.9k Jan 1, 2023
Parsing ELF and DWARF in Python

pyelftools pyelftools is a pure-Python library for parsing and analyzing ELF files and DWARF debugging information. See the User's guide for more deta

Eli Bendersky 1.6k Jan 4, 2023
pdb++, a drop-in replacement for pdb (the Python debugger)

pdb++, a drop-in replacement for pdb What is it? This module is an extension of the pdb module of the standard library. It is meant to be fully compat

null 1k Jan 2, 2023
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex Grönholm 1.1k Jan 5, 2023
Graphical Python debugger which lets you easily view the values of all evaluated expressions

birdseye birdseye is a Python debugger which records the values of expressions in a function call and lets you easily view them after the function exi

Alex Hall 1.5k Dec 24, 2022
A powerful set of Python debugging tools, based on PySnooper

snoop snoop is a powerful set of Python debugging tools. It's primarily meant to be a more featureful and refined version of PySnooper. It also includ

Alex Hall 874 Jan 8, 2023
Inject code into running Python processes

pyrasite Tools for injecting arbitrary code into running Python processes. homepage: http://pyrasite.com documentation: http://pyrasite.rtfd.org downl

Luke Macken 2.7k Jan 8, 2023