pytest-park 0.1.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.
@@ -0,0 +1,172 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+ _build/
141
+
142
+ # mypy
143
+ .mypy_cache/
144
+ .dmypy.json
145
+ dmypy.json
146
+
147
+ # Pyre type checker
148
+ .pyre/
149
+
150
+ # pytype static type analyzer
151
+ .pytype/
152
+
153
+ # Cython debug symbols
154
+ cython_debug/
155
+
156
+ # ruff
157
+ .ruff_cache/
158
+
159
+ # pytest-benchmark
160
+ .benchmarks/
161
+
162
+ # PyCharm
163
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
164
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
166
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
167
+ #.idea/
168
+
169
+ # default folders for storing artifacts excluded, but present for structure
170
+ /data/
171
+ /logs/
172
+ /models/
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 twsl
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,146 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-park
3
+ Version: 0.1.0
4
+ Summary: Organise and analyse your pytest benchmarks
5
+ Project-URL: homepage, https://twsl.github.io/pytest-park/
6
+ Project-URL: repository, https://github.com/twsl/pytest-park
7
+ Project-URL: documentation, https://twsl.github.io/pytest-park/
8
+ Author-email: twsl <45483159+twsl@users.noreply.github.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: pytest-park
12
+ Requires-Python: >=3.12
13
+ Requires-Dist: nicegui>=2.12.1
14
+ Provides-Extra: extra
15
+ Description-Content-Type: text/markdown
16
+
17
+ # pytest-park
18
+
19
+
20
+ [![Build](https://github.com/twsl/pytest-park/actions/workflows/build.yaml/badge.svg)](https://github.com/twsl/pytest-park/actions/workflows/build.yaml)
21
+ [![Documentation](https://github.com/twsl/pytest-park/actions/workflows/docs.yaml/badge.svg)](https://github.com/twsl/pytest-park/actions/workflows/docs.yaml)
22
+ [![Docs with MkDocs](https://img.shields.io/badge/MkDocs-docs?style=flat&logo=materialformkdocs&logoColor=white&color=%23526CFE)](https://squidfunk.github.io/mkdocs-material/)
23
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
24
+ [![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
25
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
26
+ [![prek](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json)](https://github.com/j178/prek)
27
+ [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
28
+ [![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/pytest-park/releases)
29
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier)
30
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
31
+
32
+
33
+ Organise and analyse your pytest benchmarks
34
+
35
+
36
+ ## Features
37
+
38
+ - Load pytest-benchmark JSON artifact folders and normalize runs, groups, marks, params, and custom grouping metadata.
39
+ - Compare reference runs against candidate runs over time with per-case and per-group delta summaries.
40
+ - Build custom grouping views with precedence across custom groups, benchmark groups, marks, and params.
41
+ - Associate optional profiler artifacts with benchmark runs for code-level analysis context.
42
+ - Serve an interactive local NiceGUI dashboard for exploratory benchmark comparison.
43
+
44
+
45
+ ## Installation
46
+
47
+ With `pip`:
48
+ ```bash
49
+ python -m pip install pytest-park
50
+ ```
51
+
52
+ With [`uv`](https://docs.astral.sh/uv/):
53
+ ```bash
54
+ uv add --group test pytest-park
55
+ ```
56
+
57
+
58
+ ## How to use it
59
+
60
+ ```bash
61
+ # Print version
62
+ pytest-park version
63
+
64
+ # Start interactive mode (no arguments)
65
+ pytest-park
66
+
67
+ # Inspect a benchmark folder
68
+ pytest-park load ./benchmarks
69
+
70
+ # Analyze grouping distribution
71
+ pytest-park analyze ./benchmarks --group-by group --group-by param:device
72
+
73
+ # Compare a candidate run against a named reference tag/run id
74
+ pytest-park compare ./benchmarks --reference reference --candidate candidate-v2 --group-by custom:scenario
75
+
76
+ # Compare latest run against second-latest run when --reference/--candidate are omitted
77
+ pytest-park compare ./benchmarks
78
+
79
+ # Normalize method names by removing configured postfixes
80
+ pytest-park analyze ./benchmarks --original-postfix _orig --reference-postfix _ref
81
+
82
+ # Launch interactive dashboard
83
+ pytest-park serve ./benchmarks --reference reference --original-postfix _orig --reference-postfix _ref --host 127.0.0.1 --port 8080
84
+ ```
85
+
86
+ ### Benchmark folder expectations
87
+
88
+ - Input artifacts are pytest-benchmark JSON files (`--benchmark-save` output) stored anywhere under a folder.
89
+ - Reference selection uses explicit run id or tag metadata (`metadata.run_id`, `metadata.tag`, or fallback identifiers).
90
+ - Default comparison baseline is latest vs second-latest run when `--reference` and `--candidate` are omitted.
91
+ - Grouping defaults to: custom groups > benchmark group > marks > params.
92
+ - Custom grouping tokens include `custom:<key>`, `group`, `marks`, `params`, and `param:<name>`.
93
+ - Method normalization supports optional `--original-postfix` and `--reference-postfix` to align benchmark names across implementations.
94
+
95
+ ### pytest-benchmark group stats override
96
+
97
+ If your benchmark method names encode postfixes and parameter segments, you can override
98
+ `pytest_benchmark_group_stats` using the helper from this package:
99
+
100
+ ```python
101
+ # tests/conftest.py
102
+ from pytest_park.pytest_benchmark import default_pytest_benchmark_group_stats
103
+
104
+
105
+ def pytest_benchmark_group_stats(config, benchmarks, group_by):
106
+ return default_pytest_benchmark_group_stats(
107
+ config,
108
+ benchmarks,
109
+ group_by,
110
+ original_postfix="_orig",
111
+ reference_postfix="_ref",
112
+ group_values_by_postfix={
113
+ "_orig": "original",
114
+ "_ref": "reference",
115
+ "none": "unlabeled",
116
+ },
117
+ )
118
+ ```
119
+
120
+ This stores parsed parts in `extra_info["pytest_park_name_parts"]` with `base_name`, `parameters`, and `postfix`.
121
+
122
+ If you use postfixes in benchmark names, expose matching pytest-benchmark options in the same `conftest.py`:
123
+
124
+ ```python
125
+ def pytest_addoption(parser):
126
+ parser.addoption("--benchmark-original-postfix", action="store", default="")
127
+ parser.addoption("--benchmark-reference-postfix", action="store", default="")
128
+ ```
129
+
130
+
131
+ ## Docs
132
+
133
+ ```bash
134
+ uv run mkdocs build -f ./mkdocs.yml -d ./_build/
135
+ ```
136
+
137
+
138
+ ## Update template
139
+
140
+ ```bash
141
+ copier update --trust -A --vcs-ref=HEAD
142
+ ```
143
+
144
+ ## Credits
145
+
146
+ This project was generated with [![🚀 python project template.](https://img.shields.io/badge/python--project--template-%F0%9F%9A%80-brightgreen)](https://github.com/twsl/python-project-template)
@@ -0,0 +1,130 @@
1
+ # pytest-park
2
+
3
+
4
+ [![Build](https://github.com/twsl/pytest-park/actions/workflows/build.yaml/badge.svg)](https://github.com/twsl/pytest-park/actions/workflows/build.yaml)
5
+ [![Documentation](https://github.com/twsl/pytest-park/actions/workflows/docs.yaml/badge.svg)](https://github.com/twsl/pytest-park/actions/workflows/docs.yaml)
6
+ [![Docs with MkDocs](https://img.shields.io/badge/MkDocs-docs?style=flat&logo=materialformkdocs&logoColor=white&color=%23526CFE)](https://squidfunk.github.io/mkdocs-material/)
7
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
8
+ [![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
9
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
10
+ [![prek](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json)](https://github.com/j178/prek)
11
+ [![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
12
+ [![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/pytest-park/releases)
13
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier)
14
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
15
+
16
+
17
+ Organise and analyse your pytest benchmarks
18
+
19
+
20
+ ## Features
21
+
22
+ - Load pytest-benchmark JSON artifact folders and normalize runs, groups, marks, params, and custom grouping metadata.
23
+ - Compare reference runs against candidate runs over time with per-case and per-group delta summaries.
24
+ - Build custom grouping views with precedence across custom groups, benchmark groups, marks, and params.
25
+ - Associate optional profiler artifacts with benchmark runs for code-level analysis context.
26
+ - Serve an interactive local NiceGUI dashboard for exploratory benchmark comparison.
27
+
28
+
29
+ ## Installation
30
+
31
+ With `pip`:
32
+ ```bash
33
+ python -m pip install pytest-park
34
+ ```
35
+
36
+ With [`uv`](https://docs.astral.sh/uv/):
37
+ ```bash
38
+ uv add --group test pytest-park
39
+ ```
40
+
41
+
42
+ ## How to use it
43
+
44
+ ```bash
45
+ # Print version
46
+ pytest-park version
47
+
48
+ # Start interactive mode (no arguments)
49
+ pytest-park
50
+
51
+ # Inspect a benchmark folder
52
+ pytest-park load ./benchmarks
53
+
54
+ # Analyze grouping distribution
55
+ pytest-park analyze ./benchmarks --group-by group --group-by param:device
56
+
57
+ # Compare a candidate run against a named reference tag/run id
58
+ pytest-park compare ./benchmarks --reference reference --candidate candidate-v2 --group-by custom:scenario
59
+
60
+ # Compare latest run against second-latest run when --reference/--candidate are omitted
61
+ pytest-park compare ./benchmarks
62
+
63
+ # Normalize method names by removing configured postfixes
64
+ pytest-park analyze ./benchmarks --original-postfix _orig --reference-postfix _ref
65
+
66
+ # Launch interactive dashboard
67
+ pytest-park serve ./benchmarks --reference reference --original-postfix _orig --reference-postfix _ref --host 127.0.0.1 --port 8080
68
+ ```
69
+
70
+ ### Benchmark folder expectations
71
+
72
+ - Input artifacts are pytest-benchmark JSON files (`--benchmark-save` output) stored anywhere under a folder.
73
+ - Reference selection uses explicit run id or tag metadata (`metadata.run_id`, `metadata.tag`, or fallback identifiers).
74
+ - Default comparison baseline is latest vs second-latest run when `--reference` and `--candidate` are omitted.
75
+ - Grouping defaults to: custom groups > benchmark group > marks > params.
76
+ - Custom grouping tokens include `custom:<key>`, `group`, `marks`, `params`, and `param:<name>`.
77
+ - Method normalization supports optional `--original-postfix` and `--reference-postfix` to align benchmark names across implementations.
78
+
79
+ ### pytest-benchmark group stats override
80
+
81
+ If your benchmark method names encode postfixes and parameter segments, you can override
82
+ `pytest_benchmark_group_stats` using the helper from this package:
83
+
84
+ ```python
85
+ # tests/conftest.py
86
+ from pytest_park.pytest_benchmark import default_pytest_benchmark_group_stats
87
+
88
+
89
+ def pytest_benchmark_group_stats(config, benchmarks, group_by):
90
+ return default_pytest_benchmark_group_stats(
91
+ config,
92
+ benchmarks,
93
+ group_by,
94
+ original_postfix="_orig",
95
+ reference_postfix="_ref",
96
+ group_values_by_postfix={
97
+ "_orig": "original",
98
+ "_ref": "reference",
99
+ "none": "unlabeled",
100
+ },
101
+ )
102
+ ```
103
+
104
+ This stores parsed parts in `extra_info["pytest_park_name_parts"]` with `base_name`, `parameters`, and `postfix`.
105
+
106
+ If you use postfixes in benchmark names, expose matching pytest-benchmark options in the same `conftest.py`:
107
+
108
+ ```python
109
+ def pytest_addoption(parser):
110
+ parser.addoption("--benchmark-original-postfix", action="store", default="")
111
+ parser.addoption("--benchmark-reference-postfix", action="store", default="")
112
+ ```
113
+
114
+
115
+ ## Docs
116
+
117
+ ```bash
118
+ uv run mkdocs build -f ./mkdocs.yml -d ./_build/
119
+ ```
120
+
121
+
122
+ ## Update template
123
+
124
+ ```bash
125
+ copier update --trust -A --vcs-ref=HEAD
126
+ ```
127
+
128
+ ## Credits
129
+
130
+ This project was generated with [![🚀 python project template.](https://img.shields.io/badge/python--project--template-%F0%9F%9A%80-brightgreen)](https://github.com/twsl/python-project-template)