Skip to main content

WSGI middleware for line-by-line profiling

Project description

PyPI version PyPI Supported Python Versions GitHub Actions (Tests) Build Status Documentation Status

wsgi_lineprof is a WSGI middleware for line-by-line profiling.

wsgi_lineprof has the following features:

  • WSGI middleware: It can be integrated with any WSGI-compatible applications and frameworks including Django, Pyramid, Flask, Bottle, and more.

  • Easily pluggable: All configurations for profiling in one place. Users don’t need to make any changes to their application.

wsgi_lineprof is not recommended to be used in production environment because of the overhead of profiling.

At a Glance

You can use wsgi_lineprof as a WSGI middleware of existing applications.

$ pip install wsgi_lineprof

Apply wsgi_lineprof to the existing WSGI web application:

from wsgi_lineprof.middleware import LineProfilerMiddleware
app = LineProfilerMiddleware(app)

Start the web application and access the application. wsgi_lineprof writes results to stdout every time an HTTP request is processed by default. You can see the output like this in your console:

... (snip) ...

File: ./app.py
Name: index
Total time: 1.00518 [sec]
  Line      Hits         Time  Code
===================================
     9                         @app.route('/')
    10                         def index():
    11         1      1005175      time.sleep(1)
    12         1            4      return "Hello world!!"

... (snip) ...

Also, you can check the result on your web browser by accessing the special endpoint /wsgi_lineprof/.

Please check the documentation for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wsgi_lineprof-0.13.0.tar.gz (61.3 kB view hashes)

Uploaded Source

Built Distributions

wsgi_lineprof-0.13.0-cp39-cp39-win_amd64.whl (47.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

wsgi_lineprof-0.13.0-cp39-cp39-win32.whl (42.7 kB view hashes)

Uploaded CPython 3.9 Windows x86

wsgi_lineprof-0.13.0-cp39-cp39-manylinux2010_x86_64.whl (222.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp39-cp39-manylinux1_x86_64.whl (144.3 kB view hashes)

Uploaded CPython 3.9

wsgi_lineprof-0.13.0-cp39-cp39-manylinux1_i686.whl (135.0 kB view hashes)

Uploaded CPython 3.9

wsgi_lineprof-0.13.0-cp39-cp39-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (45.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

wsgi_lineprof-0.13.0-cp38-cp38-win_amd64.whl (47.7 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

wsgi_lineprof-0.13.0-cp38-cp38-win32.whl (42.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

wsgi_lineprof-0.13.0-cp38-cp38-manylinux2010_x86_64.whl (225.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp38-cp38-manylinux1_x86_64.whl (148.9 kB view hashes)

Uploaded CPython 3.8

wsgi_lineprof-0.13.0-cp38-cp38-manylinux1_i686.whl (138.4 kB view hashes)

Uploaded CPython 3.8

wsgi_lineprof-0.13.0-cp38-cp38-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (45.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

wsgi_lineprof-0.13.0-cp37-cp37m-win_amd64.whl (46.9 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

wsgi_lineprof-0.13.0-cp37-cp37m-win32.whl (42.1 kB view hashes)

Uploaded CPython 3.7m Windows x86

wsgi_lineprof-0.13.0-cp37-cp37m-manylinux2010_x86_64.whl (195.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp37-cp37m-manylinux1_x86_64.whl (141.0 kB view hashes)

Uploaded CPython 3.7m

wsgi_lineprof-0.13.0-cp37-cp37m-manylinux1_i686.whl (132.1 kB view hashes)

Uploaded CPython 3.7m

wsgi_lineprof-0.13.0-cp37-cp37m-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (44.7 kB view hashes)

Uploaded CPython 3.7m macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

wsgi_lineprof-0.13.0-cp36-cp36m-win_amd64.whl (47.2 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

wsgi_lineprof-0.13.0-cp36-cp36m-win32.whl (42.2 kB view hashes)

Uploaded CPython 3.6m Windows x86

wsgi_lineprof-0.13.0-cp36-cp36m-manylinux2010_x86_64.whl (195.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp36-cp36m-manylinux1_x86_64.whl (141.2 kB view hashes)

Uploaded CPython 3.6m

wsgi_lineprof-0.13.0-cp36-cp36m-manylinux1_i686.whl (132.2 kB view hashes)

Uploaded CPython 3.6m

wsgi_lineprof-0.13.0-cp36-cp36m-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (44.8 kB view hashes)

Uploaded CPython 3.6m macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

wsgi_lineprof-0.13.0-cp35-cp35m-manylinux2010_x86_64.whl (194.6 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp35-cp35m-manylinux1_x86_64.whl (138.8 kB view hashes)

Uploaded CPython 3.5m

wsgi_lineprof-0.13.0-cp35-cp35m-manylinux1_i686.whl (129.5 kB view hashes)

Uploaded CPython 3.5m

wsgi_lineprof-0.13.0-cp35-cp35m-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (44.1 kB view hashes)

Uploaded CPython 3.5m macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

wsgi_lineprof-0.13.0-cp27-cp27mu-manylinux2010_x86_64.whl (176.4 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp27-cp27mu-manylinux1_x86_64.whl (127.3 kB view hashes)

Uploaded CPython 2.7mu

wsgi_lineprof-0.13.0-cp27-cp27mu-manylinux1_i686.whl (117.3 kB view hashes)

Uploaded CPython 2.7mu

wsgi_lineprof-0.13.0-cp27-cp27m-win_amd64.whl (43.7 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

wsgi_lineprof-0.13.0-cp27-cp27m-win32.whl (39.1 kB view hashes)

Uploaded CPython 2.7m Windows x86

wsgi_lineprof-0.13.0-cp27-cp27m-manylinux2010_x86_64.whl (176.4 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

wsgi_lineprof-0.13.0-cp27-cp27m-manylinux1_x86_64.whl (127.4 kB view hashes)

Uploaded CPython 2.7m

wsgi_lineprof-0.13.0-cp27-cp27m-manylinux1_i686.whl (117.3 kB view hashes)

Uploaded CPython 2.7m

wsgi_lineprof-0.13.0-cp27-cp27m-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_10_13_x86_64.macosx_10_12_x86_64.macosx_10_11_x86_64.macosx_10_10_x86_64.whl (43.9 kB view hashes)

Uploaded CPython 2.7m macOS 10.10+ x86-64 macOS 10.11+ x86-64 macOS 10.12+ x86-64 macOS 10.13+ x86-64 macOS 10.14+ x86-64 macOS 10.15+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page