pyramid-debugtoolbar-api-performance 0.3.1__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-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/MANIFEST.in +0 -1
- pyramid_debugtoolbar_api_performance-1.0.0/PKG-INFO +108 -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.1 → 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.1 → 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-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/src/pyramid_debugtoolbar_api_performance.egg-info/SOURCES.txt +2 -2
- 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-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/tests/test_config.py +28 -1
- pyramid_debugtoolbar_api_performance-0.3.1/CHANGES.txt +0 -28
- pyramid_debugtoolbar_api_performance-0.3.1/PKG-INFO +0 -91
- pyramid_debugtoolbar_api_performance-0.3.1/pyproject.toml +0 -3
- pyramid_debugtoolbar_api_performance-0.3.1/setup.cfg +0 -7
- pyramid_debugtoolbar_api_performance-0.3.1/setup.py +0 -61
- pyramid_debugtoolbar_api_performance-0.3.1/src/pyramid_debugtoolbar_api_performance.egg-info/PKG-INFO +0 -91
- pyramid_debugtoolbar_api_performance-0.3.1/src/pyramid_debugtoolbar_api_performance.egg-info/requires.txt +0 -6
- pyramid_debugtoolbar_api_performance-0.3.1/tox.ini +0 -12
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/LICENSE +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/README.rst +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/TODO.txt +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/src/pyramid_debugtoolbar_api_performance/panels.py +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/src/pyramid_debugtoolbar_api_performance/templates/performance_csv.dbtmako +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/src/pyramid_debugtoolbar_api_performance/utils.py +0 -0
- {pyramid_debugtoolbar_api_performance-0.3.1 → 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.1 → 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.1 → 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,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,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.1"
|
|
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
|
|
@@ -5,9 +5,8 @@ README.rst
|
|
|
5
5
|
TODO.txt
|
|
6
6
|
pyproject.toml
|
|
7
7
|
setup.cfg
|
|
8
|
-
setup.py
|
|
9
|
-
tox.ini
|
|
10
8
|
src/pyramid_debugtoolbar_api_performance/__init__.py
|
|
9
|
+
src/pyramid_debugtoolbar_api_performance/_version.py
|
|
11
10
|
src/pyramid_debugtoolbar_api_performance/panels.py
|
|
12
11
|
src/pyramid_debugtoolbar_api_performance/utils.py
|
|
13
12
|
src/pyramid_debugtoolbar_api_performance/views.py
|
|
@@ -18,4 +17,5 @@ src/pyramid_debugtoolbar_api_performance.egg-info/not-zip-safe
|
|
|
18
17
|
src/pyramid_debugtoolbar_api_performance.egg-info/requires.txt
|
|
19
18
|
src/pyramid_debugtoolbar_api_performance.egg-info/top_level.txt
|
|
20
19
|
src/pyramid_debugtoolbar_api_performance/templates/performance_csv.dbtmako
|
|
20
|
+
tests/__init__.py
|
|
21
21
|
tests/test_config.py
|
|
File without changes
|
|
@@ -7,7 +7,6 @@ import unittest
|
|
|
7
7
|
|
|
8
8
|
# pyramid testing requirements
|
|
9
9
|
from pyramid import testing
|
|
10
|
-
from pyramid.exceptions import ConfigurationError
|
|
11
10
|
from pyramid.response import Response
|
|
12
11
|
from pyramid.request import Request
|
|
13
12
|
|
|
@@ -41,6 +40,7 @@ class TestDebugtoolbarPanel(unittest.TestCase):
|
|
|
41
40
|
)
|
|
42
41
|
|
|
43
42
|
config.add_view(empty_view)
|
|
43
|
+
config.add_notfound_view(lambda request: Response(status=404))
|
|
44
44
|
|
|
45
45
|
def tearDown(self):
|
|
46
46
|
testing.tearDown()
|
|
@@ -132,6 +132,14 @@ class TestDebugtoolbarPanel(unittest.TestCase):
|
|
|
132
132
|
req3.remote_addr = "127.0.0.1"
|
|
133
133
|
resp3 = req3.get_response(app)
|
|
134
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)
|
|
135
143
|
self.assertTrue(resp3.text.startswith("User CPU time,"))
|
|
136
144
|
|
|
137
145
|
# function csv
|
|
@@ -142,6 +150,25 @@ class TestDebugtoolbarPanel(unittest.TestCase):
|
|
|
142
150
|
req4.remote_addr = "127.0.0.1"
|
|
143
151
|
resp4 = req4.get_response(app)
|
|
144
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)
|
|
145
161
|
self.assertTrue(
|
|
146
162
|
resp4.text.startswith("Calls,Total,Percall,Cumu,CumuPer,Func\r\n")
|
|
147
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,28 +0,0 @@
|
|
|
1
|
-
v0.3.1
|
|
2
|
-
* packaging
|
|
3
|
-
|
|
4
|
-
v0.3.0
|
|
5
|
-
* updated debugtoolbar includes
|
|
6
|
-
|
|
7
|
-
v0.2.2dev unreleased
|
|
8
|
-
black
|
|
9
|
-
* upgraded black; 20.8b1
|
|
10
|
-
* integrated with pre-commit
|
|
11
|
-
|
|
12
|
-
v0.2.1
|
|
13
|
-
bugfixes
|
|
14
|
-
includeme registers the panel via the api method `config.add_debugtoolbar_panel()`
|
|
15
|
-
|
|
16
|
-
v0.2.0
|
|
17
|
-
2019.04.29
|
|
18
|
-
* python3 support
|
|
19
|
-
|
|
20
|
-
v0.1.1
|
|
21
|
-
2017.12.06
|
|
22
|
-
* ported a functionality to current debugtoolbar api
|
|
23
|
-
* store version as __VERSION__ in /__init__.py
|
|
24
|
-
|
|
25
|
-
v0.1.0
|
|
26
|
-
2017.05.10
|
|
27
|
-
* initial
|
|
28
|
-
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyramid_debugtoolbar_api_performance
|
|
3
|
-
Version: 0.3.1
|
|
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
|
-
Description-Content-Type: text/markdown
|
|
91
|
-
Provides-Extra: testing
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""pyramid_debugtoolbar_api_performance installation script.
|
|
2
|
-
"""
|
|
3
|
-
import os
|
|
4
|
-
import re
|
|
5
|
-
from setuptools import setup
|
|
6
|
-
from setuptools import find_packages
|
|
7
|
-
|
|
8
|
-
# store version in the init.py
|
|
9
|
-
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
10
|
-
|
|
11
|
-
with open(
|
|
12
|
-
os.path.join(HERE, "src", "pyramid_debugtoolbar_api_performance", "__init__.py")
|
|
13
|
-
) as v_file:
|
|
14
|
-
VERSION = re.compile(r'.*__VERSION__ = "(.*?)"', re.S).match(v_file.read()).group(1)
|
|
15
|
-
|
|
16
|
-
long_description = description = "performance csv exporting for pyramid_debugtoolbar"
|
|
17
|
-
with open(os.path.join(HERE, "README.rst")) as fp:
|
|
18
|
-
long_description = fp.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=description,
|
|
37
|
-
long_description=long_description,
|
|
38
|
-
long_description_content_type="text/markdown",
|
|
39
|
-
keywords="web pyramid",
|
|
40
|
-
packages=find_packages(
|
|
41
|
-
where="src",
|
|
42
|
-
),
|
|
43
|
-
package_dir={"": "src"},
|
|
44
|
-
include_package_data=True,
|
|
45
|
-
license="MIT",
|
|
46
|
-
classifiers=[
|
|
47
|
-
"Intended Audience :: Developers",
|
|
48
|
-
"Framework :: Pyramid",
|
|
49
|
-
"Programming Language :: Python",
|
|
50
|
-
"Programming Language :: Python :: 2",
|
|
51
|
-
"Programming Language :: Python :: 3",
|
|
52
|
-
"License :: OSI Approved :: MIT License",
|
|
53
|
-
],
|
|
54
|
-
zip_safe=False,
|
|
55
|
-
install_requires=requires,
|
|
56
|
-
tests_require=tests_require,
|
|
57
|
-
extras_require={
|
|
58
|
-
"testing": testing_extras,
|
|
59
|
-
},
|
|
60
|
-
test_suite="tests",
|
|
61
|
-
)
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pyramid-debugtoolbar-api-performance
|
|
3
|
-
Version: 0.3.1
|
|
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
|
-
Description-Content-Type: text/markdown
|
|
91
|
-
Provides-Extra: testing
|
{pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/LICENSE
RENAMED
|
File without changes
|
{pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/README.rst
RENAMED
|
File without changes
|
{pyramid_debugtoolbar_api_performance-0.3.1 → pyramid_debugtoolbar_api_performance-1.0.0}/TODO.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|