Skip to content

Commit 63eed03

Browse files
authored
Merge pull request #37 from frankovo/release/0.3.3
fix(cli,exporters,docs): make weasyprint optional and update pdf setup instructions
2 parents 56b8099 + fa6708e commit 63eed03

File tree

8 files changed

+334
-55
lines changed

8 files changed

+334
-55
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install install-dev uninstall mypy black isort flake8 cov test clean cli-test \
1+
.PHONY: install install-dev install-pdf uninstall mypy black isort flake8 cov test clean cli-test \
22
gpg-check release-patch release-minor release-major release-tag release-tag-dry \
33
release-check release-flow release-clean release-build release-info release-status cz-commit cz-changelog cz-bump
44

@@ -10,10 +10,14 @@ install:
1010
install-dev:
1111
pip install .[dev]
1212

13+
# 🔧 Install package with PDF extras (weasyprint)
14+
install-pdf:
15+
pip install .[pdf]
16+
1317
# 🔧 Uninstall package
1418
uninstall:
1519
pip uninstall -y dns-benchmark-tool \
16-
dnspython pandas aiohttp click pyfiglet colorama Jinja2 weasyprint openpyxl pyyaml tqdm matplotlib \
20+
dnspython pandas aiohttp click pyfiglet colorama Jinja2 openpyxl pyyaml tqdm matplotlib \
1721
mypy black flake8 autopep8 pytest coverage isort
1822

1923
mypy:

README-pypi.md

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Part of [BuildTools](https://buildtools.net) - Network Performance Suite
88

99
```bash
1010
pip install dns-benchmark-tool
11-
dns-benchmark benchmark --use-defaults
11+
dns-benchmark benchmark --use-defaults --formats csv,excel
1212
```
1313

1414
---
@@ -132,6 +132,85 @@ dns-benchmark --version
132132
dns-benchmark --help
133133
```
134134

135+
## 📄 Optional PDF Export
136+
137+
By default, the tool supports **CSV** and **Excel** exports.
138+
PDF export requires the extra dependency **weasyprint**, which is not installed automatically to avoid runtime issues on some platforms.
139+
140+
### Install with PDF support
141+
142+
```bash
143+
pip install dns-benchmark-tool[pdf]
144+
```
145+
146+
### Usage
147+
148+
Once installed, you can request PDF output via the CLI:
149+
150+
```bash
151+
dns-benchmark --use-defaults --formats pdf --output ./results
152+
```
153+
154+
If `weasyprint` is not installed and you request PDF output, the CLI will show:
155+
156+
```bash
157+
[-] Error during benchmark: PDF export requires 'weasyprint'. Install with: pip install dns-benchmark-tool[pdf]
158+
```
159+
160+
---
161+
162+
## ⚠️ WeasyPrint Setup (for PDF export)
163+
164+
The DNS Benchmark Tool uses **WeasyPrint** to generate PDF reports.
165+
If you want PDF export, you need extra system libraries in addition to the Python package.
166+
167+
### 🛠 Linux (Debian/Ubuntu)
168+
169+
```bash
170+
sudo apt install python3-pip libpango-1.0-0 libpangoft2-1.0-0 \
171+
libharfbuzz-subset0 libjpeg-dev libopenjp2-7-dev libffi-dev
172+
```
173+
174+
---
175+
176+
### 🛠 macOS (Homebrew)
177+
178+
```bash
179+
brew install pango cairo libffi gdk-pixbuf jpeg openjpeg harfbuzz
180+
```
181+
182+
---
183+
184+
### 🛠 Windows
185+
186+
Install GTK+ libraries using one of these methods:
187+
188+
- **MSYS2**: [Download MSYS2](https://www.msys2.org/), then run:
189+
190+
```bash
191+
pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libffi
192+
```
193+
194+
- **GTK+ 64‑bit Installer**: [Download GTK+ Runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) and run the installer.
195+
196+
Restart your terminal after installation.
197+
198+
---
199+
200+
### ✅ Verify Installation
201+
202+
After installing the system libraries, install the Python extra:
203+
204+
```bash
205+
pip install dns-benchmark-tool[pdf]
206+
```
207+
208+
Then run:
209+
210+
```bash
211+
dns-benchmark --use-defaults --formats pdf --output ./results
212+
```
213+
135214
## Quick usage
136215

137216
```bash
@@ -152,10 +231,10 @@ dns-benchmark benchmark --resolvers data/resolvers.json --domains data/domains.t
152231

153232
```bash
154233
# Basic test with progress bars
155-
dns-benchmark benchmark --use-defaults
234+
dns-benchmark benchmark --use-defaults --formats csv,excel
156235

157236
# Basic test without progress bars
158-
dns-benchmark benchmark --use-defaults --quiet
237+
dns-benchmark benchmark --use-defaults --formats csv,excel --quiet
159238

160239
# Test with custom resolvers and domains
161240
dns-benchmark benchmark --resolvers data/resolvers.json --domains data/domains.txt
@@ -171,7 +250,7 @@ dns-benchmark benchmark --use-defaults --formats csv
171250
dns-benchmark benchmark --use-defaults --json --output ./results
172251

173252
# Test specific record types
174-
dns-benchmark benchmark --use-defaults --record-types A,AAAA,MX
253+
dns-benchmark benchmark --use-defaults --formats csv,excel --record-types A,AAAA,MX
175254

176255
# Custom output location and formats
177256
dns-benchmark benchmark \

README.md

Lines changed: 101 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
```bash
1010
pip install dns-benchmark-tool
11-
dns-benchmark benchmark --use-defaults
11+
dns-benchmark benchmark --use-defaults --formats csv,excel
1212
```
1313

1414
---
@@ -40,7 +40,7 @@ dns-benchmark top
4040
dns-benchmark compare Cloudflare Google Quad9 --show-details
4141

4242
# Run monitoring for 1 hour with alerts
43-
dns-benchmark monitoring --use-defaults --interval 30 --duration 3600 \
43+
dns-benchmark monitoring --use-defaults --formats csv,excel --interval 30 --duration 3600 \
4444
--alert-latency 150 --alert-failure-rate 5 --output monitor.log
4545
```
4646

@@ -141,6 +141,14 @@ dns-benchmark monitoring --use-defaults --interval 30 --duration 3600 \
141141
- [CSV outputs](#csv-outputs)
142142
- [Excel report](#excel-report)
143143
- [PDF report](#pdf-report)
144+
- [📄 Optional PDF Export](#-optional-pdf-export)
145+
- [Install with PDF support](#install-with-pdf-support)
146+
- [Usage](#usage)
147+
- [⚠️ WeasyPrint Setup (for PDF export)](#️-weasyprint-setup-for-pdf-export)
148+
- [🛠 Linux (Debian/Ubuntu)](#-linux-debianubuntu)
149+
- [🛠 macOS (Homebrew)](#-macos-homebrew)
150+
- [🛠 Windows](#-windows)
151+
- [✅ Verify Installation](#-verify-installation)
144152
- [JSON export](#json-export)
145153
- [Generate Sample Config](#generate-sample-config)
146154
- [Performance optimization](#performance-optimization)
@@ -225,7 +233,7 @@ pip install dns-benchmark-tool
225233

226234
```bash
227235
# Test default resolvers against popular domains
228-
dns-benchmark benchmark --use-defaults
236+
dns-benchmark benchmark --use-defaults --formats csv,excel
229237
```
230238

231239
### View Results
@@ -388,6 +396,7 @@ dns-benchmark benchmark \
388396
# Detailed analysis
389397
dns-benchmark benchmark \
390398
--use-defaults \
399+
--formats csv,excel \
391400
--domain-stats \
392401
--record-type-stats \
393402
--error-breakdown \
@@ -450,7 +459,7 @@ dns-benchmark benchmark \
450459
--use-defaults \
451460
--dnssec-validate \ # coming soon
452461
--output migration-report/ \
453-
--formats pdf,excel
462+
--formats csv,excel
454463
```
455464

456465
**Result:** Verify performance and security before migration
@@ -478,7 +487,7 @@ dns-benchmark compare \
478487
0 0 1 * * dns-benchmark benchmark \
479488
--use-defaults \
480489
--output /var/reports/dns/ \
481-
--formats pdf,csv \
490+
--formats excel,csv \
482491
--domain-stats \
483492
--error-breakdown
484493
```
@@ -534,7 +543,7 @@ dns-benchmark --help
534543

535544
```bash
536545
# Test with defaults (recommended for first time)
537-
dns-benchmark benchmark --use-defaults
546+
dns-benchmark benchmark --use-defaults --formats csv,excel
538547
```
539548

540549
---
@@ -545,10 +554,10 @@ dns-benchmark benchmark --use-defaults
545554

546555
```bash
547556
# Basic test with progress bars
548-
dns-benchmark benchmark --use-defaults
557+
dns-benchmark benchmark --use-defaults --formats csv,excel
549558

550559
# Basic test without progress bars
551-
dns-benchmark benchmark --use-defaults --quiet
560+
dns-benchmark benchmark --use-defaults --formats csv,excel --quiet
552561

553562
# Test with custom resolvers and domains
554563
dns-benchmark benchmark --resolvers data/resolvers.json --domains data/domains.txt
@@ -564,23 +573,25 @@ dns-benchmark benchmark --use-defaults --formats csv
564573
dns-benchmark benchmark --use-defaults --json --output ./results
565574

566575
# Test specific record types
567-
dns-benchmark benchmark --use-defaults --record-types A,AAAA,MX
576+
dns-benchmark benchmark --use-defaults --formats csv,excel --record-types A,AAAA,MX
568577

569578
# Custom output location and formats
570579
dns-benchmark benchmark \
571580
--use-defaults \
572581
--output ./my-results \
573-
--formats csv,excel,pdf,json
582+
--formats csv,excel
574583

575584
# Include detailed statistics
576585
dns-benchmark benchmark \
577586
--use-defaults \
587+
--formats csv,excel \
578588
--record-type-stats \
579589
--error-breakdown
580590

581591
# High concurrency with retries
582592
dns-benchmark benchmark \
583593
--use-defaults \
594+
--formats csv,excel \
584595
--max-concurrent 200 \
585596
--timeout 3.0 \
586597
--retries 3
@@ -720,7 +731,7 @@ dns-benchmark compare Cloudflare Google --show-details
720731

721732
# New monitoring commands
722733
# Start monitoring with default resolvers and sample domains
723-
dns-benchmark monitoring --use-defaults
734+
dns-benchmark monitoring --use-defaults
724735
# ^ Runs indefinitely, checking every 60s, using built-in resolvers and 5 sample domains
725736

726737
# Monitor with a custom resolver list from JSON
@@ -1276,6 +1287,85 @@ aws.amazon.com
12761287
- Resolver rankings: ordered by average latency
12771288
- Detailed analysis: technical deep‑dive with percentiles
12781289

1290+
### 📄 Optional PDF Export
1291+
1292+
By default, the tool supports **CSV** and **Excel** exports.
1293+
PDF export requires the extra dependency **weasyprint**, which is not installed automatically to avoid runtime issues on some platforms.
1294+
1295+
#### Install with PDF support
1296+
1297+
```bash
1298+
pip install dns-benchmark-tool[pdf]
1299+
```
1300+
1301+
#### Usage
1302+
1303+
Once installed, you can request PDF output via the CLI:
1304+
1305+
```bash
1306+
dns-benchmark --use-defaults --formats pdf --output ./results
1307+
```
1308+
1309+
If `weasyprint` is not installed and you request PDF output, the CLI will show:
1310+
1311+
```bash
1312+
[-] Error during benchmark: PDF export requires 'weasyprint'. Install with: pip install dns-benchmark-tool[pdf]
1313+
```
1314+
1315+
---
1316+
1317+
### ⚠️ WeasyPrint Setup (for PDF export)
1318+
1319+
The DNS Benchmark Tool uses **WeasyPrint** to generate PDF reports.
1320+
If you want PDF export, you need extra system libraries in addition to the Python package.
1321+
1322+
#### 🛠 Linux (Debian/Ubuntu)
1323+
1324+
```bash
1325+
sudo apt install python3-pip libpango-1.0-0 libpangoft2-1.0-0 \
1326+
libharfbuzz-subset0 libjpeg-dev libopenjp2-7-dev libffi-dev
1327+
```
1328+
1329+
---
1330+
1331+
#### 🛠 macOS (Homebrew)
1332+
1333+
```bash
1334+
brew install pango cairo libffi gdk-pixbuf jpeg openjpeg harfbuzz
1335+
```
1336+
1337+
---
1338+
1339+
#### 🛠 Windows
1340+
1341+
Install GTK+ libraries using one of these methods:
1342+
1343+
- **MSYS2**: [Download MSYS2](https://www.msys2.org/), then run:
1344+
1345+
```bash
1346+
pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libffi
1347+
```
1348+
1349+
- **GTK+ 64‑bit Installer**: [Download GTK+ Runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) and run the installer.
1350+
1351+
Restart your terminal after installation.
1352+
1353+
---
1354+
1355+
#### ✅ Verify Installation
1356+
1357+
After installing the system libraries, install the Python extra:
1358+
1359+
```bash
1360+
pip install dns-benchmark-tool[pdf]
1361+
```
1362+
1363+
Then run:
1364+
1365+
```bash
1366+
dns-benchmark --use-defaults --formats pdf --output ./results
1367+
```
1368+
12791369
### JSON export
12801370

12811371
- Machine‑readable bundle including:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies = [
2222
"pyfiglet>=1.0,<2.0",
2323
"colorama>=0.4,<1.0",
2424
"Jinja2>=3.1,<4.0",
25-
"weasyprint>=66.0,<67.0",
2625
"openpyxl>=3.1,<4.0",
2726
"pyyaml>=6.0,<7.0",
2827
"tqdm>=4.66,<5.0",
@@ -55,6 +54,7 @@ Tracker = "https://github.com/frankovo/dns-benchmark-tool/issues"
5554
Changelog = "https://github.com/frankovo/dns-benchmark-tool/blob/main/CHANGELOG.md"
5655

5756
[project.optional-dependencies]
57+
pdf = ["weasyprint>=66.0,<67.0"]
5858
dev = [
5959
"mypy>=1.8,<2.0",
6060
"black>=24.0,<26.0",

0 commit comments

Comments
 (0)