Skip to main content

WSGI middleware for line-by-line profiling

Project description

PyPI version PyPI Supported Python Versions GitHub Actions (Tests) 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.19.1.tar.gz (114.5 kB view hashes)

Uploaded Source

Built Distributions

wsgi_lineprof-0.19.1-cp312-cp312-win_arm64.whl (133.3 kB view hashes)

Uploaded CPython 3.12 Windows ARM64

wsgi_lineprof-0.19.1-cp312-cp312-win_amd64.whl (139.9 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

wsgi_lineprof-0.19.1-cp312-cp312-win32.whl (135.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

wsgi_lineprof-0.19.1-cp312-cp312-musllinux_1_2_x86_64.whl (393.6 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

wsgi_lineprof-0.19.1-cp312-cp312-musllinux_1_2_i686.whl (382.6 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

wsgi_lineprof-0.19.1-cp312-cp312-musllinux_1_2_aarch64.whl (381.8 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ ARM64

wsgi_lineprof-0.19.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (397.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

wsgi_lineprof-0.19.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (382.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

wsgi_lineprof-0.19.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (392.0 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

wsgi_lineprof-0.19.1-cp312-cp312-macosx_11_0_arm64.whl (142.1 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

wsgi_lineprof-0.19.1-cp312-cp312-macosx_10_9_x86_64.whl (144.0 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

wsgi_lineprof-0.19.1-cp311-cp311-win_arm64.whl (133.2 kB view hashes)

Uploaded CPython 3.11 Windows ARM64

wsgi_lineprof-0.19.1-cp311-cp311-win_amd64.whl (139.7 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

wsgi_lineprof-0.19.1-cp311-cp311-win32.whl (134.8 kB view hashes)

Uploaded CPython 3.11 Windows x86

wsgi_lineprof-0.19.1-cp311-cp311-musllinux_1_2_x86_64.whl (393.4 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

wsgi_lineprof-0.19.1-cp311-cp311-musllinux_1_2_i686.whl (372.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

wsgi_lineprof-0.19.1-cp311-cp311-musllinux_1_2_aarch64.whl (382.6 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ ARM64

wsgi_lineprof-0.19.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (391.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

wsgi_lineprof-0.19.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (372.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

wsgi_lineprof-0.19.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (386.6 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

wsgi_lineprof-0.19.1-cp311-cp311-macosx_11_0_arm64.whl (141.9 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

wsgi_lineprof-0.19.1-cp311-cp311-macosx_10_9_x86_64.whl (143.7 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

wsgi_lineprof-0.19.1-cp310-cp310-win_arm64.whl (133.1 kB view hashes)

Uploaded CPython 3.10 Windows ARM64

wsgi_lineprof-0.19.1-cp310-cp310-win_amd64.whl (139.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

wsgi_lineprof-0.19.1-cp310-cp310-win32.whl (134.8 kB view hashes)

Uploaded CPython 3.10 Windows x86

wsgi_lineprof-0.19.1-cp310-cp310-musllinux_1_2_x86_64.whl (361.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

wsgi_lineprof-0.19.1-cp310-cp310-musllinux_1_2_i686.whl (351.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

wsgi_lineprof-0.19.1-cp310-cp310-musllinux_1_2_aarch64.whl (352.9 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ ARM64

wsgi_lineprof-0.19.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (361.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

wsgi_lineprof-0.19.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (346.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

wsgi_lineprof-0.19.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (356.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

wsgi_lineprof-0.19.1-cp310-cp310-macosx_11_0_arm64.whl (141.6 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

wsgi_lineprof-0.19.1-cp310-cp310-macosx_10_9_x86_64.whl (143.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

wsgi_lineprof-0.19.1-cp39-cp39-win_arm64.whl (133.7 kB view hashes)

Uploaded CPython 3.9 Windows ARM64

wsgi_lineprof-0.19.1-cp39-cp39-win_amd64.whl (140.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

wsgi_lineprof-0.19.1-cp39-cp39-win32.whl (135.4 kB view hashes)

Uploaded CPython 3.9 Windows x86

wsgi_lineprof-0.19.1-cp39-cp39-musllinux_1_2_x86_64.whl (364.5 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

wsgi_lineprof-0.19.1-cp39-cp39-musllinux_1_2_i686.whl (354.4 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

wsgi_lineprof-0.19.1-cp39-cp39-musllinux_1_2_aarch64.whl (356.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ ARM64

wsgi_lineprof-0.19.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (364.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

wsgi_lineprof-0.19.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (348.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

wsgi_lineprof-0.19.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (360.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

wsgi_lineprof-0.19.1-cp39-cp39-macosx_11_0_arm64.whl (142.4 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

wsgi_lineprof-0.19.1-cp39-cp39-macosx_10_9_x86_64.whl (144.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

wsgi_lineprof-0.19.1-cp38-cp38-win_amd64.whl (140.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

wsgi_lineprof-0.19.1-cp38-cp38-win32.whl (135.4 kB view hashes)

Uploaded CPython 3.8 Windows x86

wsgi_lineprof-0.19.1-cp38-cp38-musllinux_1_2_x86_64.whl (363.4 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

wsgi_lineprof-0.19.1-cp38-cp38-musllinux_1_2_i686.whl (353.1 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ i686

wsgi_lineprof-0.19.1-cp38-cp38-musllinux_1_2_aarch64.whl (353.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ ARM64

wsgi_lineprof-0.19.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (365.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

wsgi_lineprof-0.19.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (351.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

wsgi_lineprof-0.19.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (360.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

wsgi_lineprof-0.19.1-cp38-cp38-macosx_11_0_arm64.whl (142.5 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

wsgi_lineprof-0.19.1-cp38-cp38-macosx_10_9_x86_64.whl (144.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ 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