A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Nodd/lineprofilergui below:

Nodd/lineprofilergui: A Qt GUI to run and display line by line profiling data using line_profiler for python

This is a Qt GUI for the line_profiler python utility.

It allows to run and display the profiling results using an interactive interface. It is functionnaly equivalent to the kernprof script, which is used to invoque line_profiler from the command line.

Line Profiler GUI can be installed from pypi using pip:

$ pip install line-profiler-gui

Line Profiler GUI can use anyon of the Qt python bindings by using QtPy: PyQt5, PyQt6, PySide2 or PySide6. You can install the Qt python bindings of your choice in one go by specifying it between square brackets:

$ pip install line-profiler-gui[PySide2]
$ pip install line-profiler-gui[PyQt5]

Source releases can be downloaded from PyPI. To check out the development sources, you can use Git:

$ git clone https://github.com/Nodd/lineprofilergui.git

Users should be familiar with the line_profiler line_profiler documentation, but here is a quick reminder. Since the line by line profiling slown down the execution, not all functions are profiled. The functions to be profiled have to be marked with a @profile decorator (see the example/ directory for more examples):

@profile
def my_slow_function():
    ...

No import is needed, profile is added to the python builtins for the execution. Don't forget to remove the added decorators afterwards!

Once the profilng is done, the following data will be disaplyed for each line of the decorated functions:

In the displayed table, the lines are higlighted depending on their % Time. This allows to easily spot the lines to be optimised, and to not be distracted by the rest od the code.

$ lineprofilergui -h
usage: lineprofilergui [-h] [-V] [-l LPROF] [-r] [-o OUTFILE] [-s SETUP]
                    [script] ...

Run, profile a python script and display results.

positional arguments:
script                The python script file to run
args                  Optional script arguments

options:
-h, --help            show this help message and exit
-V, --version         show program's version number and exit
-l LPROF, --lprof LPROF
                        Display data from a .lprof file
-r, --run             Profile the python script on launch
-o OUTFILE, --outfile OUTFILE
                        Save stats to OUTFILE (default: 'scriptname.lprof')
-s SETUP, --setup SETUP
                        Python script to execute before the code to profile

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4