pyramid-debugtoolbar-api-performance 0.3.0__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyramid_debugtoolbar_api_performance-1.0.0/CHANGES.txt +32 -0
- pyramid_debugtoolbar_api_performance-1.0.0/LICENSE +22 -0
- pyramid_debugtoolbar_api_performance-1.0.0/MANIFEST.in +10 -0
- pyramid_debugtoolbar_api_performance-1.0.0/PKG-INFO +108 -0
- pyramid_debugtoolbar_api_performance-1.0.0/TODO.txt +0 -0
- pyramid_debugtoolbar_api_performance-1.0.0/pyproject.toml +7 -0
- pyramid_debugtoolbar_api_performance-1.0.0/setup.cfg +67 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance/__init__.py +7 -5
- pyramid_debugtoolbar_api_performance-1.0.0/src/pyramid_debugtoolbar_api_performance/_version.py +3 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance/views.py +30 -35
- pyramid_debugtoolbar_api_performance-1.0.0/src/pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO +108 -0
- pyramid_debugtoolbar_api_performance-1.0.0/src/pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt +21 -0
- pyramid_debugtoolbar_api_performance-1.0.0/src/pyramid_debugtoolbar_api_performance.egg-info/requires.txt +10 -0
- pyramid_debugtoolbar_api_performance-1.0.0/tests/__init__.py +0 -0
- pyramid_debugtoolbar_api_performance-1.0.0/tests/test_config.py +174 -0
- pyramid_debugtoolbar_api_performance-0.3.0/MANIFEST.in +0 -2
- pyramid_debugtoolbar_api_performance-0.3.0/PKG-INFO +0 -90
- pyramid_debugtoolbar_api_performance-0.3.0/pyproject.toml +0 -3
- pyramid_debugtoolbar_api_performance-0.3.0/pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO +0 -90
- pyramid_debugtoolbar_api_performance-0.3.0/pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt +0 -16
- pyramid_debugtoolbar_api_performance-0.3.0/pyramid_debugtoolbar_api_performance.egg-info/requires.txt +0 -6
- pyramid_debugtoolbar_api_performance-0.3.0/setup.cfg +0 -7
- pyramid_debugtoolbar_api_performance-0.3.0/setup.py +0 -57
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0}/README.rst +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance/panels.py +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance/templates/performance_csv.dbtmako +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance/utils.py +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance.egg-info/dependency_links.txt +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance.egg-info/not-zip-safe +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0/src}/pyramid_debugtoolbar_api_performance.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
v1.0.0
|
|
2
|
+
* Explicitly package the CSV template as data to avoid setuptools package discovery warnings.
|
|
3
|
+
* Keep runtime dependencies out of version discovery on legacy setuptools.
|
|
4
|
+
* Consolidate package and tox configuration and extend CI through Python 3.15.
|
|
5
|
+
* Harden CSV download headers and disable caching for profiling exports.
|
|
6
|
+
* Return 404 when a request or its performance data is unavailable.
|
|
7
|
+
* added tests/__init__.py
|
|
8
|
+
|
|
9
|
+
v0.3.1
|
|
10
|
+
* packaging
|
|
11
|
+
|
|
12
|
+
v0.3.0
|
|
13
|
+
* updated debugtoolbar includes
|
|
14
|
+
|
|
15
|
+
v0.2.2dev unreleased
|
|
16
|
+
* black
|
|
17
|
+
* upgraded black; 20.8b1
|
|
18
|
+
* integrated with pre-commit
|
|
19
|
+
|
|
20
|
+
v0.2.1
|
|
21
|
+
* bugfixes
|
|
22
|
+
* includeme registers the panel via the api method `config.add_debugtoolbar_panel()`
|
|
23
|
+
|
|
24
|
+
v0.2.0 | 2019.04.29
|
|
25
|
+
* python3 support
|
|
26
|
+
|
|
27
|
+
v0.1.1 | 2017.12.06
|
|
28
|
+
* ported a functionality to current debugtoolbar api
|
|
29
|
+
* store version as __VERSION__ in /__init__.py
|
|
30
|
+
|
|
31
|
+
v0.1.0 | 2017.05.10
|
|
32
|
+
* initial
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 jvanasco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyramid_debugtoolbar_api_performance
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: performance csv exporting for pyramid_debugtoolbar
|
|
5
|
+
Home-page: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance
|
|
6
|
+
Author: Jonathan Vanasco
|
|
7
|
+
Author-email: jvanasco@2xlp.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: web,pyramid
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Framework :: Pyramid
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
25
|
+
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
|
|
26
|
+
Description-Content-Type: text/x-rst
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pyramid
|
|
29
|
+
Requires-Dist: pyramid_debugtoolbar>=4.0
|
|
30
|
+
Requires-Dist: six
|
|
31
|
+
Requires-Dist: setuptools<82; python_version >= "3.7" and python_version < "3.10"
|
|
32
|
+
Provides-Extra: testing
|
|
33
|
+
Requires-Dist: coverage; extra == "testing"
|
|
34
|
+
Requires-Dist: pytest; extra == "testing"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
pyramid_debugtoolbar_api_performance
|
|
38
|
+
====================================
|
|
39
|
+
|
|
40
|
+
.. image:: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance/workflows/Python%20package/badge.svg
|
|
41
|
+
:alt: Build Status
|
|
42
|
+
|
|
43
|
+
`pyramid_debugtoolbar_api_performance` extends the existing `pyramid_debugtoolbar`
|
|
44
|
+
Performance Panel to support downloadable CSV files of profiling data.
|
|
45
|
+
|
|
46
|
+
This package does not replace the default panel, and requires it to be active.
|
|
47
|
+
|
|
48
|
+
This package is designed for application profile and to be a useful part of test
|
|
49
|
+
suites, allowing developers to run a series of tests and log the Performance
|
|
50
|
+
performance.
|
|
51
|
+
|
|
52
|
+
The package exposes two routes for CSV data:
|
|
53
|
+
|
|
54
|
+
* timing
|
|
55
|
+
* function_calls
|
|
56
|
+
|
|
57
|
+
Both correlate to the official Performance panel data.
|
|
58
|
+
|
|
59
|
+
The urls are generated in a machine-friendly format, so you can regex the
|
|
60
|
+
`request_id` off a page and pull it from the API. This is explained below...
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
NOTES:
|
|
64
|
+
======
|
|
65
|
+
|
|
66
|
+
This packages requires pyramid_debugtoolbar 4.0 or newer
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
How to use this package
|
|
70
|
+
=======================
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
Update your ENVIRONMENT.ini file
|
|
74
|
+
|
|
75
|
+
.. code-block:: python
|
|
76
|
+
|
|
77
|
+
debugtoolbar.includes = pyramid_debugtoolbar_api_performance
|
|
78
|
+
|
|
79
|
+
You MUST be using `pyramid_debugtoolbar` with the Performance panel enabled.
|
|
80
|
+
This package simply piggybacks on the existing module's work to log queries.
|
|
81
|
+
|
|
82
|
+
You MUST use `debugtoolbar.includes`. This will not work properly via `pyramid.includes`
|
|
83
|
+
|
|
84
|
+
You can access a csv of the Profiling report via the following url hack:
|
|
85
|
+
|
|
86
|
+
.. code-block:: python
|
|
87
|
+
|
|
88
|
+
url_html = '/_debug_toolbar/{request_id}'
|
|
89
|
+
url_api = '/_debug_toolbar/api-performance/timing-{request_id}.csv'
|
|
90
|
+
url_api = '/_debug_toolbar/api-performance/function_calls-{request_id}.csv'
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
The file will be downloaded and offer a content-disposition as:
|
|
94
|
+
|
|
95
|
+
.. code-block:: shell
|
|
96
|
+
|
|
97
|
+
performance-{request_id}.csv
|
|
98
|
+
|
|
99
|
+
Configuration
|
|
100
|
+
=======================
|
|
101
|
+
|
|
102
|
+
By default, this package writes CSV files using "UTF-8" encoding.
|
|
103
|
+
|
|
104
|
+
To change this, use the environment variable `pyramid_debugtoolbar_api_performance_encoding`
|
|
105
|
+
|
|
106
|
+
.. code-block:: shell
|
|
107
|
+
|
|
108
|
+
export pyramid_debugtoolbar_api_performance_encoding=ascii
|
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = pyramid_debugtoolbar_api_performance
|
|
3
|
+
version = attr: pyramid_debugtoolbar_api_performance._version.__VERSION__
|
|
4
|
+
description = performance csv exporting for pyramid_debugtoolbar
|
|
5
|
+
long_description = file: README.rst
|
|
6
|
+
long_description_content_type = text/x-rst
|
|
7
|
+
author = Jonathan Vanasco
|
|
8
|
+
author_email = jvanasco@2xlp.com
|
|
9
|
+
url = https://github.com/jvanasco/pyramid_debugtoolbar_api_performance
|
|
10
|
+
keywords = web, pyramid
|
|
11
|
+
license = MIT
|
|
12
|
+
license_file = LICENSE
|
|
13
|
+
classifiers =
|
|
14
|
+
Intended Audience :: Developers
|
|
15
|
+
Framework :: Pyramid
|
|
16
|
+
Programming Language :: Python
|
|
17
|
+
Programming Language :: Python :: 2.7
|
|
18
|
+
Programming Language :: Python :: 3.5
|
|
19
|
+
Programming Language :: Python :: 3.6
|
|
20
|
+
Programming Language :: Python :: 3.7
|
|
21
|
+
Programming Language :: Python :: 3.8
|
|
22
|
+
Programming Language :: Python :: 3.9
|
|
23
|
+
Programming Language :: Python :: 3.10
|
|
24
|
+
Programming Language :: Python :: 3.11
|
|
25
|
+
Programming Language :: Python :: 3.12
|
|
26
|
+
Programming Language :: Python :: 3.13
|
|
27
|
+
Programming Language :: Python :: 3.14
|
|
28
|
+
Programming Language :: Python :: 3.15
|
|
29
|
+
|
|
30
|
+
[options]
|
|
31
|
+
packages = find:
|
|
32
|
+
package_dir =
|
|
33
|
+
= src
|
|
34
|
+
include_package_data = False
|
|
35
|
+
zip_safe = False
|
|
36
|
+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
|
|
37
|
+
install_requires =
|
|
38
|
+
pyramid
|
|
39
|
+
pyramid_debugtoolbar>=4.0
|
|
40
|
+
six
|
|
41
|
+
setuptools<82; python_version >= "3.7" and python_version < "3.10"
|
|
42
|
+
|
|
43
|
+
[options.packages.find]
|
|
44
|
+
where = src
|
|
45
|
+
|
|
46
|
+
[options.package_data]
|
|
47
|
+
pyramid_debugtoolbar_api_performance = templates/*.dbtmako
|
|
48
|
+
|
|
49
|
+
[options.extras_require]
|
|
50
|
+
testing =
|
|
51
|
+
coverage
|
|
52
|
+
pytest
|
|
53
|
+
|
|
54
|
+
[tox:tox]
|
|
55
|
+
envlist = py27, py35, py36, py37, py38, py39, py310, py311, py312, py313, py314, py315
|
|
56
|
+
|
|
57
|
+
[testenv]
|
|
58
|
+
extras = testing
|
|
59
|
+
commands =
|
|
60
|
+
python --version
|
|
61
|
+
python -m coverage run --source=pyramid_debugtoolbar_api_performance -m pytest {posargs:}
|
|
62
|
+
python -m coverage html -d {envtmpdir}/coverage
|
|
63
|
+
|
|
64
|
+
[egg_info]
|
|
65
|
+
tag_build =
|
|
66
|
+
tag_date = 0
|
|
67
|
+
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
from .
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
__VERSION__ = "0.3.0"
|
|
1
|
+
# type: from pyramid.config import Configurator
|
|
2
|
+
from ._version import __VERSION__
|
|
6
3
|
|
|
7
4
|
|
|
8
5
|
# ==============================================================================
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
def includeme(config):
|
|
9
|
+
# type: (Configurator) -> None
|
|
10
|
+
"""Register the CSV panel and routes with the debug toolbar."""
|
|
11
|
+
# Older setuptools imports this package to read its version at build time.
|
|
12
|
+
from .panels import PerformanceCsvDebugPanel
|
|
13
|
+
|
|
12
14
|
config.add_debugtoolbar_panel(PerformanceCsvDebugPanel)
|
|
13
15
|
config.add_route(
|
|
14
16
|
"debugtoolbar.api_performance_csv.function_calls",
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# stdlib
|
|
2
2
|
import csv
|
|
3
3
|
import os
|
|
4
|
+
import re
|
|
4
5
|
|
|
5
6
|
# pyramid
|
|
6
7
|
from pyramid.response import Response
|
|
8
|
+
|
|
9
|
+
from pyramid.request import Request
|
|
10
|
+
from pyramid_debugtoolbar.panels.performance import PerformanceDebugPanel
|
|
7
11
|
from pyramid.view import view_config
|
|
8
12
|
from pyramid.exceptions import NotFound
|
|
9
13
|
|
|
10
|
-
#
|
|
11
|
-
import six
|
|
12
|
-
|
|
13
|
-
# from six import BytesIO
|
|
14
|
+
# Python 2's csv module requires a byte buffer.
|
|
14
15
|
from six import StringIO
|
|
15
16
|
|
|
16
17
|
# local
|
|
@@ -25,31 +26,37 @@ ENCODING = os.environ.get("pyramid_debugtoolbar_api_sqlalchemy_encoding", "utf-8
|
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def _standardized_setup(request):
|
|
28
|
-
|
|
29
|
-
history
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
last_request_pair = None
|
|
34
|
-
last_request_id = None
|
|
35
|
-
else:
|
|
36
|
-
last_request_id = last_request_pair[0]
|
|
37
|
-
|
|
38
|
-
request_id = request.matchdict.get("request_id", last_request_id)
|
|
39
|
-
toolbar = history.get(request_id, None)
|
|
40
|
-
|
|
41
|
-
if not toolbar:
|
|
29
|
+
# type: (Request) -> tuple[str, PerformanceDebugPanel]
|
|
30
|
+
"""Resolve the performance panel for the requested history entry."""
|
|
31
|
+
request_id = request.matchdict["request_id"]
|
|
32
|
+
toolbar = request.pdtb_history.get(request_id, None)
|
|
33
|
+
if toolbar is None:
|
|
42
34
|
raise NotFound
|
|
43
35
|
|
|
44
36
|
panel = get_performance_panel(toolbar.panels)
|
|
45
|
-
if not panel:
|
|
37
|
+
if panel is None or not panel.data:
|
|
46
38
|
raise NotFound
|
|
47
39
|
|
|
48
40
|
return request_id, panel
|
|
49
41
|
|
|
50
42
|
|
|
43
|
+
def _csv_response(csvfile, report, request_id):
|
|
44
|
+
# type: (StringIO, str, str) -> Response
|
|
45
|
+
"""Return a CSV attachment with a header-safe filename."""
|
|
46
|
+
safe_id = re.sub(r"[^a-zA-Z0-9_-]", "_", request_id)
|
|
47
|
+
filename = "performance-%s-%s.csv" % (report, safe_id)
|
|
48
|
+
response = Response(
|
|
49
|
+
content_type="text/csv", body=csvfile.getvalue(), charset=ENCODING
|
|
50
|
+
)
|
|
51
|
+
response.headers["Content-Disposition"] = str('attachment; filename="%s"' % filename)
|
|
52
|
+
response.cache_control.no_store = True
|
|
53
|
+
return response
|
|
54
|
+
|
|
55
|
+
|
|
51
56
|
@view_config(route_name="debugtoolbar.api_performance_csv.timing")
|
|
52
57
|
def csv_timing(request):
|
|
58
|
+
# type: (Request) -> Response
|
|
59
|
+
"""Export timing rows for a recorded request."""
|
|
53
60
|
(request_id, panel) = _standardized_setup(request)
|
|
54
61
|
|
|
55
62
|
csvfile = StringIO()
|
|
@@ -64,18 +71,13 @@ def csv_timing(request):
|
|
|
64
71
|
# ('Context switches', '19 voluntary, 1233 involuntary')
|
|
65
72
|
# )
|
|
66
73
|
csvwriter.writerow(row)
|
|
67
|
-
csvfile
|
|
68
|
-
as_csv = Response(
|
|
69
|
-
content_type="text/csv", body=csvfile.read(), status=200, charset=ENCODING
|
|
70
|
-
)
|
|
71
|
-
as_csv.headers["Content-Disposition"] = str(
|
|
72
|
-
"attachment; filename= performance-timing-%s.csv" % request_id
|
|
73
|
-
)
|
|
74
|
-
return as_csv
|
|
74
|
+
return _csv_response(csvfile, "timing", request_id)
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
@view_config(route_name="debugtoolbar.api_performance_csv.function_calls")
|
|
78
78
|
def csv_function_calls(request):
|
|
79
|
+
# type: (Request) -> Response
|
|
80
|
+
"""Export profiler rows for a recorded request."""
|
|
79
81
|
(request_id, panel) = _standardized_setup(request)
|
|
80
82
|
|
|
81
83
|
csvfile = StringIO()
|
|
@@ -93,11 +95,4 @@ def csv_function_calls(request):
|
|
|
93
95
|
row["filename_long"],
|
|
94
96
|
)
|
|
95
97
|
)
|
|
96
|
-
csvfile
|
|
97
|
-
as_csv = Response(
|
|
98
|
-
content_type="text/csv", body=csvfile.read(), status=200, charset=ENCODING
|
|
99
|
-
)
|
|
100
|
-
as_csv.headers["Content-Disposition"] = str(
|
|
101
|
-
"attachment; filename= performance-function_calls-%s.csv" % request_id
|
|
102
|
-
)
|
|
103
|
-
return as_csv
|
|
98
|
+
return _csv_response(csvfile, "function_calls", request_id)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyramid_debugtoolbar_api_performance
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: performance csv exporting for pyramid_debugtoolbar
|
|
5
|
+
Home-page: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance
|
|
6
|
+
Author: Jonathan Vanasco
|
|
7
|
+
Author-email: jvanasco@2xlp.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: web,pyramid
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Framework :: Pyramid
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
25
|
+
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
|
|
26
|
+
Description-Content-Type: text/x-rst
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pyramid
|
|
29
|
+
Requires-Dist: pyramid_debugtoolbar>=4.0
|
|
30
|
+
Requires-Dist: six
|
|
31
|
+
Requires-Dist: setuptools<82; python_version >= "3.7" and python_version < "3.10"
|
|
32
|
+
Provides-Extra: testing
|
|
33
|
+
Requires-Dist: coverage; extra == "testing"
|
|
34
|
+
Requires-Dist: pytest; extra == "testing"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
pyramid_debugtoolbar_api_performance
|
|
38
|
+
====================================
|
|
39
|
+
|
|
40
|
+
.. image:: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance/workflows/Python%20package/badge.svg
|
|
41
|
+
:alt: Build Status
|
|
42
|
+
|
|
43
|
+
`pyramid_debugtoolbar_api_performance` extends the existing `pyramid_debugtoolbar`
|
|
44
|
+
Performance Panel to support downloadable CSV files of profiling data.
|
|
45
|
+
|
|
46
|
+
This package does not replace the default panel, and requires it to be active.
|
|
47
|
+
|
|
48
|
+
This package is designed for application profile and to be a useful part of test
|
|
49
|
+
suites, allowing developers to run a series of tests and log the Performance
|
|
50
|
+
performance.
|
|
51
|
+
|
|
52
|
+
The package exposes two routes for CSV data:
|
|
53
|
+
|
|
54
|
+
* timing
|
|
55
|
+
* function_calls
|
|
56
|
+
|
|
57
|
+
Both correlate to the official Performance panel data.
|
|
58
|
+
|
|
59
|
+
The urls are generated in a machine-friendly format, so you can regex the
|
|
60
|
+
`request_id` off a page and pull it from the API. This is explained below...
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
NOTES:
|
|
64
|
+
======
|
|
65
|
+
|
|
66
|
+
This packages requires pyramid_debugtoolbar 4.0 or newer
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
How to use this package
|
|
70
|
+
=======================
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
Update your ENVIRONMENT.ini file
|
|
74
|
+
|
|
75
|
+
.. code-block:: python
|
|
76
|
+
|
|
77
|
+
debugtoolbar.includes = pyramid_debugtoolbar_api_performance
|
|
78
|
+
|
|
79
|
+
You MUST be using `pyramid_debugtoolbar` with the Performance panel enabled.
|
|
80
|
+
This package simply piggybacks on the existing module's work to log queries.
|
|
81
|
+
|
|
82
|
+
You MUST use `debugtoolbar.includes`. This will not work properly via `pyramid.includes`
|
|
83
|
+
|
|
84
|
+
You can access a csv of the Profiling report via the following url hack:
|
|
85
|
+
|
|
86
|
+
.. code-block:: python
|
|
87
|
+
|
|
88
|
+
url_html = '/_debug_toolbar/{request_id}'
|
|
89
|
+
url_api = '/_debug_toolbar/api-performance/timing-{request_id}.csv'
|
|
90
|
+
url_api = '/_debug_toolbar/api-performance/function_calls-{request_id}.csv'
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
The file will be downloaded and offer a content-disposition as:
|
|
94
|
+
|
|
95
|
+
.. code-block:: shell
|
|
96
|
+
|
|
97
|
+
performance-{request_id}.csv
|
|
98
|
+
|
|
99
|
+
Configuration
|
|
100
|
+
=======================
|
|
101
|
+
|
|
102
|
+
By default, this package writes CSV files using "UTF-8" encoding.
|
|
103
|
+
|
|
104
|
+
To change this, use the environment variable `pyramid_debugtoolbar_api_performance_encoding`
|
|
105
|
+
|
|
106
|
+
.. code-block:: shell
|
|
107
|
+
|
|
108
|
+
export pyramid_debugtoolbar_api_performance_encoding=ascii
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
CHANGES.txt
|
|
2
|
+
LICENSE
|
|
3
|
+
MANIFEST.in
|
|
4
|
+
README.rst
|
|
5
|
+
TODO.txt
|
|
6
|
+
pyproject.toml
|
|
7
|
+
setup.cfg
|
|
8
|
+
src/pyramid_debugtoolbar_api_performance/__init__.py
|
|
9
|
+
src/pyramid_debugtoolbar_api_performance/_version.py
|
|
10
|
+
src/pyramid_debugtoolbar_api_performance/panels.py
|
|
11
|
+
src/pyramid_debugtoolbar_api_performance/utils.py
|
|
12
|
+
src/pyramid_debugtoolbar_api_performance/views.py
|
|
13
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO
|
|
14
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt
|
|
15
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/dependency_links.txt
|
|
16
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/not-zip-safe
|
|
17
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/requires.txt
|
|
18
|
+
src/pyramid_debugtoolbar_api_performance.egg-info/top_level.txt
|
|
19
|
+
src/pyramid_debugtoolbar_api_performance/templates/performance_csv.dbtmako
|
|
20
|
+
tests/__init__.py
|
|
21
|
+
tests/test_config.py
|
|
File without changes
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
from __future__ import print_function
|
|
2
|
+
from __future__ import unicode_literals
|
|
3
|
+
|
|
4
|
+
# stdlib
|
|
5
|
+
import re
|
|
6
|
+
import unittest
|
|
7
|
+
|
|
8
|
+
# pyramid testing requirements
|
|
9
|
+
from pyramid import testing
|
|
10
|
+
from pyramid.response import Response
|
|
11
|
+
from pyramid.request import Request
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# ------------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# used to ensure the toolbar link is injected into requests
|
|
18
|
+
re_toolbar_link = re.compile(r'(?:href="http://localhost)(/_debug_toolbar/[\d]+)"')
|
|
19
|
+
re_csv_timing_link = re.compile(
|
|
20
|
+
r'href="(/_debug_toolbar/api-performance/timing-([\d]+).csv)"'
|
|
21
|
+
)
|
|
22
|
+
re_csv_function_link = re.compile(
|
|
23
|
+
r'href="(/_debug_toolbar/api-performance/function_calls-([\d]+).csv)"'
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TestDebugtoolbarPanel(unittest.TestCase):
|
|
28
|
+
def setUp(self):
|
|
29
|
+
self.config = config = testing.setUp()
|
|
30
|
+
config.add_settings(
|
|
31
|
+
{"debugtoolbar.includes": ["pyramid_debugtoolbar_api_performance"]}
|
|
32
|
+
)
|
|
33
|
+
config.include("pyramid_debugtoolbar")
|
|
34
|
+
self.settings = config.registry.settings
|
|
35
|
+
|
|
36
|
+
# create a view
|
|
37
|
+
def empty_view(request):
|
|
38
|
+
return Response(
|
|
39
|
+
"<html><head></head><body>OK</body></html>", content_type="text/html"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
config.add_view(empty_view)
|
|
43
|
+
config.add_notfound_view(lambda request: Response(status=404))
|
|
44
|
+
|
|
45
|
+
def tearDown(self):
|
|
46
|
+
testing.tearDown()
|
|
47
|
+
|
|
48
|
+
def test_panel_injected(self):
|
|
49
|
+
|
|
50
|
+
# make the app
|
|
51
|
+
app = self.config.make_wsgi_app()
|
|
52
|
+
# make a request
|
|
53
|
+
req1 = Request.blank("/")
|
|
54
|
+
req1.remote_addr = "127.0.0.1"
|
|
55
|
+
resp1 = req1.get_response(app)
|
|
56
|
+
self.assertEqual(resp1.status_code, 200)
|
|
57
|
+
self.assertIn("http://localhost/_debug_toolbar/", resp1.text)
|
|
58
|
+
|
|
59
|
+
# check the toolbar
|
|
60
|
+
links = re_toolbar_link.findall(resp1.text)
|
|
61
|
+
self.assertIsNotNone(links)
|
|
62
|
+
self.assertIsInstance(links, list)
|
|
63
|
+
self.assertEqual(len(links), 1)
|
|
64
|
+
toolbar_link = links[0]
|
|
65
|
+
|
|
66
|
+
req2 = Request.blank(toolbar_link)
|
|
67
|
+
req2.remote_addr = "127.0.0.1"
|
|
68
|
+
resp2 = req2.get_response(app)
|
|
69
|
+
self.assertEqual(resp2.status_code, 200)
|
|
70
|
+
|
|
71
|
+
self.assertIn('<li class="" id="pDebugPanel-performance-csv">', resp2.text)
|
|
72
|
+
self.assertIn(
|
|
73
|
+
'<div id="pDebugPanel-performance-csv-content" class="panelContent" style="display: none;">',
|
|
74
|
+
resp2.text,
|
|
75
|
+
)
|
|
76
|
+
self.assertIn(
|
|
77
|
+
"""<div class="pDebugPanelTitle">
|
|
78
|
+
<h3>Performance CSV</h3>
|
|
79
|
+
</div>""",
|
|
80
|
+
resp2.text,
|
|
81
|
+
)
|
|
82
|
+
self.assertIn(
|
|
83
|
+
"The profiler was not activated for this request. Activate the checkbox in the toolbar to use it.",
|
|
84
|
+
resp2.text,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def test_panel_works(self):
|
|
88
|
+
# make the app
|
|
89
|
+
app = self.config.make_wsgi_app()
|
|
90
|
+
# make a request
|
|
91
|
+
req1 = Request.blank("/")
|
|
92
|
+
req1.remote_addr = "127.0.0.1"
|
|
93
|
+
# ENABLE THE PERfORMANCE CONTROL PANEL
|
|
94
|
+
req1.cookies = {"pdtb_active": "performance"}
|
|
95
|
+
resp1 = req1.get_response(app)
|
|
96
|
+
self.assertEqual(resp1.status_code, 200)
|
|
97
|
+
self.assertIn("http://localhost/_debug_toolbar/", resp1.text)
|
|
98
|
+
|
|
99
|
+
# check the toolbar
|
|
100
|
+
links = re_toolbar_link.findall(resp1.text)
|
|
101
|
+
self.assertIsNotNone(links)
|
|
102
|
+
self.assertIsInstance(links, list)
|
|
103
|
+
self.assertEqual(len(links), 1)
|
|
104
|
+
toolbar_link = links[0]
|
|
105
|
+
|
|
106
|
+
req2 = Request.blank(toolbar_link)
|
|
107
|
+
req2.remote_addr = "127.0.0.1"
|
|
108
|
+
resp2 = req2.get_response(app)
|
|
109
|
+
self.assertEqual(resp2.status_code, 200)
|
|
110
|
+
|
|
111
|
+
self.assertIn('<li class="" id="pDebugPanel-performance-csv">', resp2.text)
|
|
112
|
+
self.assertIn(
|
|
113
|
+
'<div id="pDebugPanel-performance-csv-content" class="panelContent" style="display: none;">',
|
|
114
|
+
resp2.text,
|
|
115
|
+
)
|
|
116
|
+
self.assertIn(
|
|
117
|
+
"""<div class="pDebugPanelTitle">
|
|
118
|
+
<h3>Performance CSV</h3>
|
|
119
|
+
</div>""",
|
|
120
|
+
resp2.text,
|
|
121
|
+
)
|
|
122
|
+
self.assertIn(
|
|
123
|
+
"performance logging is available for this request as a CSV via the link below:",
|
|
124
|
+
resp2.text,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# timing csv
|
|
128
|
+
match = re_csv_timing_link.search(resp2.text)
|
|
129
|
+
self.assertTrue(match)
|
|
130
|
+
(_timing_link, _id) = match.groups()
|
|
131
|
+
req3 = Request.blank(_timing_link)
|
|
132
|
+
req3.remote_addr = "127.0.0.1"
|
|
133
|
+
resp3 = req3.get_response(app)
|
|
134
|
+
self.assertEqual(resp3.status_code, 200)
|
|
135
|
+
self.assertEqual(
|
|
136
|
+
resp3.headers["Content-Disposition"],
|
|
137
|
+
'attachment; filename="performance-timing-%s.csv"' % _id,
|
|
138
|
+
)
|
|
139
|
+
self.assertTrue(resp3.cache_control.no_store)
|
|
140
|
+
denied = Request.blank(_timing_link)
|
|
141
|
+
denied.remote_addr = "192.0.2.1"
|
|
142
|
+
self.assertEqual(denied.get_response(app).status_code, 404)
|
|
143
|
+
self.assertTrue(resp3.text.startswith("User CPU time,"))
|
|
144
|
+
|
|
145
|
+
# function csv
|
|
146
|
+
match = re_csv_function_link.search(resp2.text)
|
|
147
|
+
self.assertTrue(match)
|
|
148
|
+
(_function_link, _id) = match.groups()
|
|
149
|
+
req4 = Request.blank(_function_link)
|
|
150
|
+
req4.remote_addr = "127.0.0.1"
|
|
151
|
+
resp4 = req4.get_response(app)
|
|
152
|
+
self.assertEqual(resp4.status_code, 200)
|
|
153
|
+
self.assertEqual(
|
|
154
|
+
resp4.headers["Content-Disposition"],
|
|
155
|
+
'attachment; filename="performance-function_calls-%s.csv"' % _id,
|
|
156
|
+
)
|
|
157
|
+
self.assertTrue(resp4.cache_control.no_store)
|
|
158
|
+
denied = Request.blank(_function_link)
|
|
159
|
+
denied.remote_addr = "192.0.2.1"
|
|
160
|
+
self.assertEqual(denied.get_response(app).status_code, 404)
|
|
161
|
+
self.assertTrue(
|
|
162
|
+
resp4.text.startswith("Calls,Total,Percall,Cumu,CumuPer,Func\r\n")
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def test_csv_missing_history(self):
|
|
166
|
+
# type: () -> None
|
|
167
|
+
"""Both CSV routes return 404 when the request is absent from history."""
|
|
168
|
+
app = self.config.make_wsgi_app()
|
|
169
|
+
for report in ("timing", "function_calls"):
|
|
170
|
+
request = Request.blank(
|
|
171
|
+
"/_debug_toolbar/api-performance/%s-missing.csv" % report
|
|
172
|
+
)
|
|
173
|
+
request.remote_addr = "127.0.0.1"
|
|
174
|
+
self.assertEqual(request.get_response(app).status_code, 404)
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyramid_debugtoolbar_api_performance
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: performance csv exporting for pyramid_debugtoolbar
|
|
5
|
-
Home-page: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance
|
|
6
|
-
Author: Jonathan Vanasco
|
|
7
|
-
Author-email: jonathan@findmeon.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: pyramid_debugtoolbar_api_performance
|
|
10
|
-
====================================
|
|
11
|
-
|
|
12
|
-
.. image:: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance/workflows/Python%20package/badge.svg
|
|
13
|
-
:alt: Build Status
|
|
14
|
-
|
|
15
|
-
`pyramid_debugtoolbar_api_performance` extends the existing `pyramid_debugtoolbar`
|
|
16
|
-
Performance Panel to support downloadable CSV files of profiling data.
|
|
17
|
-
|
|
18
|
-
This package does not replace the default panel, and requires it to be active.
|
|
19
|
-
|
|
20
|
-
This package is designed for application profile and to be a useful part of test
|
|
21
|
-
suites, allowing developers to run a series of tests and log the Performance
|
|
22
|
-
performance.
|
|
23
|
-
|
|
24
|
-
The package exposes two routes for CSV data:
|
|
25
|
-
|
|
26
|
-
* timing
|
|
27
|
-
* function_calls
|
|
28
|
-
|
|
29
|
-
Both correlate to the official Performance panel data.
|
|
30
|
-
|
|
31
|
-
The urls are generated in a machine-friendly format, so you can regex the
|
|
32
|
-
`request_id` off a page and pull it from the API. This is explained below...
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
NOTES:
|
|
36
|
-
======
|
|
37
|
-
|
|
38
|
-
This packages requires pyramid_debugtoolbar 4.0 or newer
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
How to use this package
|
|
42
|
-
=======================
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Update your ENVIRONMENT.ini file
|
|
46
|
-
|
|
47
|
-
.. code-block:: python
|
|
48
|
-
|
|
49
|
-
debugtoolbar.includes = pyramid_debugtoolbar_api_performance
|
|
50
|
-
|
|
51
|
-
You MUST be using `pyramid_debugtoolbar` with the Performance panel enabled.
|
|
52
|
-
This package simply piggybacks on the existing module's work to log queries.
|
|
53
|
-
|
|
54
|
-
You MUST use `debugtoolbar.includes`. This will not work properly via `pyramid.includes`
|
|
55
|
-
|
|
56
|
-
You can access a csv of the Profiling report via the following url hack:
|
|
57
|
-
|
|
58
|
-
.. code-block:: python
|
|
59
|
-
|
|
60
|
-
url_html = '/_debug_toolbar/{request_id}'
|
|
61
|
-
url_api = '/_debug_toolbar/api-performance/timing-{request_id}.csv'
|
|
62
|
-
url_api = '/_debug_toolbar/api-performance/function_calls-{request_id}.csv'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
The file will be downloaded and offer a content-disposition as:
|
|
66
|
-
|
|
67
|
-
.. code-block:: shell
|
|
68
|
-
|
|
69
|
-
performance-{request_id}.csv
|
|
70
|
-
|
|
71
|
-
Configuration
|
|
72
|
-
=======================
|
|
73
|
-
|
|
74
|
-
By default, this package writes CSV files using "UTF-8" encoding.
|
|
75
|
-
|
|
76
|
-
To change this, use the environment variable `pyramid_debugtoolbar_api_performance_encoding`
|
|
77
|
-
|
|
78
|
-
.. code-block:: shell
|
|
79
|
-
|
|
80
|
-
export pyramid_debugtoolbar_api_performance_encoding=ascii
|
|
81
|
-
|
|
82
|
-
Keywords: web pyramid
|
|
83
|
-
Platform: UNKNOWN
|
|
84
|
-
Classifier: Intended Audience :: Developers
|
|
85
|
-
Classifier: Framework :: Pyramid
|
|
86
|
-
Classifier: Programming Language :: Python
|
|
87
|
-
Classifier: Programming Language :: Python :: 2
|
|
88
|
-
Classifier: Programming Language :: Python :: 3
|
|
89
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
90
|
-
Provides-Extra: testing
|
pyramid_debugtoolbar_api_performance-0.3.0/pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyramid-debugtoolbar-api-performance
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: performance csv exporting for pyramid_debugtoolbar
|
|
5
|
-
Home-page: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance
|
|
6
|
-
Author: Jonathan Vanasco
|
|
7
|
-
Author-email: jonathan@findmeon.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: pyramid_debugtoolbar_api_performance
|
|
10
|
-
====================================
|
|
11
|
-
|
|
12
|
-
.. image:: https://github.com/jvanasco/pyramid_debugtoolbar_api_performance/workflows/Python%20package/badge.svg
|
|
13
|
-
:alt: Build Status
|
|
14
|
-
|
|
15
|
-
`pyramid_debugtoolbar_api_performance` extends the existing `pyramid_debugtoolbar`
|
|
16
|
-
Performance Panel to support downloadable CSV files of profiling data.
|
|
17
|
-
|
|
18
|
-
This package does not replace the default panel, and requires it to be active.
|
|
19
|
-
|
|
20
|
-
This package is designed for application profile and to be a useful part of test
|
|
21
|
-
suites, allowing developers to run a series of tests and log the Performance
|
|
22
|
-
performance.
|
|
23
|
-
|
|
24
|
-
The package exposes two routes for CSV data:
|
|
25
|
-
|
|
26
|
-
* timing
|
|
27
|
-
* function_calls
|
|
28
|
-
|
|
29
|
-
Both correlate to the official Performance panel data.
|
|
30
|
-
|
|
31
|
-
The urls are generated in a machine-friendly format, so you can regex the
|
|
32
|
-
`request_id` off a page and pull it from the API. This is explained below...
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
NOTES:
|
|
36
|
-
======
|
|
37
|
-
|
|
38
|
-
This packages requires pyramid_debugtoolbar 4.0 or newer
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
How to use this package
|
|
42
|
-
=======================
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Update your ENVIRONMENT.ini file
|
|
46
|
-
|
|
47
|
-
.. code-block:: python
|
|
48
|
-
|
|
49
|
-
debugtoolbar.includes = pyramid_debugtoolbar_api_performance
|
|
50
|
-
|
|
51
|
-
You MUST be using `pyramid_debugtoolbar` with the Performance panel enabled.
|
|
52
|
-
This package simply piggybacks on the existing module's work to log queries.
|
|
53
|
-
|
|
54
|
-
You MUST use `debugtoolbar.includes`. This will not work properly via `pyramid.includes`
|
|
55
|
-
|
|
56
|
-
You can access a csv of the Profiling report via the following url hack:
|
|
57
|
-
|
|
58
|
-
.. code-block:: python
|
|
59
|
-
|
|
60
|
-
url_html = '/_debug_toolbar/{request_id}'
|
|
61
|
-
url_api = '/_debug_toolbar/api-performance/timing-{request_id}.csv'
|
|
62
|
-
url_api = '/_debug_toolbar/api-performance/function_calls-{request_id}.csv'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
The file will be downloaded and offer a content-disposition as:
|
|
66
|
-
|
|
67
|
-
.. code-block:: shell
|
|
68
|
-
|
|
69
|
-
performance-{request_id}.csv
|
|
70
|
-
|
|
71
|
-
Configuration
|
|
72
|
-
=======================
|
|
73
|
-
|
|
74
|
-
By default, this package writes CSV files using "UTF-8" encoding.
|
|
75
|
-
|
|
76
|
-
To change this, use the environment variable `pyramid_debugtoolbar_api_performance_encoding`
|
|
77
|
-
|
|
78
|
-
.. code-block:: shell
|
|
79
|
-
|
|
80
|
-
export pyramid_debugtoolbar_api_performance_encoding=ascii
|
|
81
|
-
|
|
82
|
-
Keywords: web pyramid
|
|
83
|
-
Platform: UNKNOWN
|
|
84
|
-
Classifier: Intended Audience :: Developers
|
|
85
|
-
Classifier: Framework :: Pyramid
|
|
86
|
-
Classifier: Programming Language :: Python
|
|
87
|
-
Classifier: Programming Language :: Python :: 2
|
|
88
|
-
Classifier: Programming Language :: Python :: 3
|
|
89
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
90
|
-
Provides-Extra: testing
|
pyramid_debugtoolbar_api_performance-0.3.0/pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
MANIFEST.in
|
|
2
|
-
README.rst
|
|
3
|
-
pyproject.toml
|
|
4
|
-
setup.cfg
|
|
5
|
-
setup.py
|
|
6
|
-
pyramid_debugtoolbar_api_performance/__init__.py
|
|
7
|
-
pyramid_debugtoolbar_api_performance/panels.py
|
|
8
|
-
pyramid_debugtoolbar_api_performance/utils.py
|
|
9
|
-
pyramid_debugtoolbar_api_performance/views.py
|
|
10
|
-
pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO
|
|
11
|
-
pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt
|
|
12
|
-
pyramid_debugtoolbar_api_performance.egg-info/dependency_links.txt
|
|
13
|
-
pyramid_debugtoolbar_api_performance.egg-info/not-zip-safe
|
|
14
|
-
pyramid_debugtoolbar_api_performance.egg-info/requires.txt
|
|
15
|
-
pyramid_debugtoolbar_api_performance.egg-info/top_level.txt
|
|
16
|
-
pyramid_debugtoolbar_api_performance/templates/performance_csv.dbtmako
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"""pyramid_debugtoolbar_api_performance installation script.
|
|
2
|
-
"""
|
|
3
|
-
import os
|
|
4
|
-
from setuptools import setup
|
|
5
|
-
from setuptools import find_packages
|
|
6
|
-
|
|
7
|
-
# store version in the init.py
|
|
8
|
-
import re
|
|
9
|
-
|
|
10
|
-
with open(
|
|
11
|
-
os.path.join(
|
|
12
|
-
os.path.dirname(__file__), "pyramid_debugtoolbar_api_performance", "__init__.py"
|
|
13
|
-
)
|
|
14
|
-
) as v_file:
|
|
15
|
-
VERSION = re.compile(r'.*__VERSION__ = "(.*?)"', re.S).match(v_file.read()).group(1)
|
|
16
|
-
|
|
17
|
-
here = os.path.abspath(os.path.dirname(__file__))
|
|
18
|
-
README = open(os.path.join(here, "README.rst")).read()
|
|
19
|
-
|
|
20
|
-
requires = [
|
|
21
|
-
"pyramid",
|
|
22
|
-
"pyramid_debugtoolbar>=4.0",
|
|
23
|
-
"six",
|
|
24
|
-
]
|
|
25
|
-
tests_require = [
|
|
26
|
-
"pytest",
|
|
27
|
-
]
|
|
28
|
-
testing_extras = tests_require + []
|
|
29
|
-
|
|
30
|
-
setup(
|
|
31
|
-
name="pyramid_debugtoolbar_api_performance",
|
|
32
|
-
author="Jonathan Vanasco",
|
|
33
|
-
author_email="jonathan@findmeon.com",
|
|
34
|
-
url="https://github.com/jvanasco/pyramid_debugtoolbar_api_performance",
|
|
35
|
-
version=VERSION,
|
|
36
|
-
description="performance csv exporting for pyramid_debugtoolbar",
|
|
37
|
-
keywords="web pyramid",
|
|
38
|
-
license="MIT",
|
|
39
|
-
classifiers=[
|
|
40
|
-
"Intended Audience :: Developers",
|
|
41
|
-
"Framework :: Pyramid",
|
|
42
|
-
"Programming Language :: Python",
|
|
43
|
-
"Programming Language :: Python :: 2",
|
|
44
|
-
"Programming Language :: Python :: 3",
|
|
45
|
-
"License :: OSI Approved :: MIT License",
|
|
46
|
-
],
|
|
47
|
-
long_description=README,
|
|
48
|
-
packages=find_packages(),
|
|
49
|
-
include_package_data=True,
|
|
50
|
-
zip_safe=False,
|
|
51
|
-
install_requires=requires,
|
|
52
|
-
tests_require=tests_require,
|
|
53
|
-
extras_require={
|
|
54
|
-
"testing": testing_extras,
|
|
55
|
-
},
|
|
56
|
-
test_suite="tests",
|
|
57
|
-
)
|
{pyramid_debugtoolbar_api_performance-0.3.0 → pyramid_debugtoolbar_api_performance-1.0.0}/README.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|