Skip to content

Commit 37414a2

Browse files
authored
Merge branch 'main' into copilot/add-markdown-export-results
2 parents d9bfc49 + 6fb17a1 commit 37414a2

4 files changed

Lines changed: 130 additions & 9 deletions

File tree

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e .[dev]
28+
29+
- name: Run tests
30+
run: |
31+
pytest

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Ankit
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.

README.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,67 @@ Compare performance results between two Locust runs and show changes relative to
1313

1414
- Python 3.8+ (no third-party dependencies).
1515

16-
## Quick Start
16+
## Installation
1717

18-
- Compare two run directories (each containing a `report.csv` and HTML files):
18+
### With uvx (recommended)
19+
20+
Run directly from GitHub without cloning:
21+
22+
```bash
23+
uvx --from git+https://github.com/dev-ankit/locust-compare.git locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
24+
```
25+
26+
Or from a local directory:
27+
28+
```bash
29+
uvx --from . locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
30+
```
31+
32+
Or from a cloned repository:
33+
34+
```bash
35+
git clone https://github.com/dev-ankit/locust-compare.git
36+
cd locust-compare
37+
uvx --from . locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
38+
```
39+
40+
Once published to PyPI, you can run without any prefix:
41+
42+
```bash
43+
uvx locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
44+
```
45+
46+
### With pip
1947

48+
```bash
49+
pip install .
50+
locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
2051
```
52+
53+
### Direct execution
54+
55+
```bash
2156
python3 compare_runs.py test_runs/HTML-Report-292 test_runs/HTML-Report-294
2257
```
2358

24-
- Compare two specific CSV files:
59+
## Quick Start
2560

61+
- Compare two run directories (each containing a `report.csv` and HTML files):
62+
63+
```bash
64+
locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294
2665
```
27-
python3 compare_runs.py test_runs/HTML-Report-292/report.csv test_runs/HTML-Report-294/report.csv
66+
67+
- Compare two specific CSV files:
68+
69+
```bash
70+
locust-compare test_runs/HTML-Report-292/report.csv test_runs/HTML-Report-294/report.csv
2871
```
2972

3073
- JSON output for scripting:
3174

32-
```
33-
python3 compare_runs.py test_runs/HTML-Report-292 test_runs/HTML-Report-294 -o json
75+
```bash
76+
locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294 -o json
3477
```
3578

3679
- Markdown output with emoji indicators (✅ better, ❌ worse, ➖ same):
@@ -41,8 +84,8 @@ python3 compare_runs.py test_runs/HTML-Report-292 test_runs/HTML-Report-294 -o m
4184

4285
- Colorize text output (green=better, red=worse):
4386

44-
```
45-
python3 compare_runs.py test_runs/HTML-Report-292 test_runs/HTML-Report-294 --color
87+
```bash
88+
locust-compare test_runs/HTML-Report-292 test_runs/HTML-Report-294 --color
4689
```
4790

4891
Exit code is `0` on success and `1` on error.
@@ -91,7 +134,7 @@ Verdict emojis:
91134

92135
## JSON Schema
93136

94-
The `--json` output is a single JSON object containing keys for each compared item.
137+
The `-o json` output is a single JSON object containing keys for each compared item.
95138

96139
- CSV items use their request name; the aggregated row is keyed as `Aggregated`.
97140
- HTML feature pages are keyed as `HTML:<feature_file_stem>`.

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
15
[project]
26
name = "locust-compare"
37
version = "0.1.0"
48
description = "Compare Locust performance metrics between runs"
9+
readme = "README.md"
510
requires-python = ">=3.8"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Ankit", email = "dev@ankit.dev"},
14+
]
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"Intended Audience :: Developers",
18+
"License :: OSI Approved :: MIT License",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.8",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
]
26+
27+
[project.scripts]
28+
locust-compare = "compare_runs:main"
629

730
[project.optional-dependencies]
831
dev = [
@@ -25,3 +48,6 @@ exclude_lines = [
2548
"pragma: no cover",
2649
"if __name__ == .__main__.:",
2750
]
51+
52+
[tool.hatch.build.targets.wheel]
53+
only-include = ["compare_runs.py"]

0 commit comments

Comments
 (0)