Metadata-Version: 2.1
Name: wsgi_lineprof
Version: 0.19.0
Summary: WSGI middleware for line-by-line profiling
Author-email: Yusuke Miyazaki <miyazaki.dev@gmail.com>
License: MIT License
        
        Copyright (c) 2016 Yusuke Miyazaki
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        -----
        
        wsgi_lineprof uses code from line_profiler:
        
        This software is OSI Certified Open Source Software.
        OSI Certified is a certification mark of the Open Source Initiative.
        
        Copyright (c) 2008, Enthought, Inc.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
         * Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
         * Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
         * Neither the name of Enthought, Inc. nor the names of its contributors may
           be used to endorse or promote products derived from this software without
           specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
        WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
        ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
        (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
        ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Documentation, https://wsgi-lineprof.readthedocs.io
Project-URL: Source, https://github.com/ymyzk/wsgi_lineprof
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: C
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Classifier: Topic :: Software Development
Classifier: Topic :: System :: Benchmark
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: colorama>=0.4.1
Requires-Dist: Jinja2
Requires-Dist: pytz
Requires-Dist: typing-extensions
Provides-Extra: benchmark
Requires-Dist: asv<0.5,>=0.4; extra == "benchmark"
Requires-Dist: virtualenv; extra == "benchmark"
Provides-Extra: benchmark-deps
Requires-Dist: Jinja2==2.10; extra == "benchmark-deps"
Requires-Dist: WebTest==2.0.32; extra == "benchmark-deps"
Provides-Extra: docs
Requires-Dist: Sphinx<7,>=6; extra == "docs"
Requires-Dist: sphinx_rtd_theme<2,>=1; extra == "docs"
Provides-Extra: test
Requires-Dist: mypy<2,>=1; extra == "test"
Requires-Dist: pytest<8,>=7; extra == "test"
Requires-Dist: pytest-cov<5,>=4; extra == "test"
Requires-Dist: pytest-mock>=1.11; extra == "test"
Requires-Dist: pytest-randomly; extra == "test"
Requires-Dist: types-colorama; extra == "test"
Requires-Dist: types-pytz; extra == "test"

wsgi_lineprof
=============
.. image:: https://badge.fury.io/py/wsgi-lineprof.svg
   :target: https://pypi.python.org/pypi/wsgi-lineprof/
   :alt: PyPI version
.. image:: https://img.shields.io/pypi/pyversions/wsgi_lineprof.svg
   :target: https://pypi.python.org/pypi/wsgi-lineprof/
   :alt: PyPI Supported Python Versions
.. image:: https://github.com/ymyzk/wsgi_lineprof/workflows/Tests/badge.svg
   :target: https://github.com/ymyzk/wsgi_lineprof/actions?workflow=Tests
   :alt: GitHub Actions (Tests)
.. image:: https://readthedocs.org/projects/wsgi_lineprof/badge/?version=latest
   :target: https://wsgi-lineprof.readthedocs.io/
   :alt: 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:

.. code-block:: python

   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 <https://wsgi-lineprof.readthedocs.io/en/latest/index.html>`_ for more details.
