pdf2mp3 2.0.2__tar.gz → 2.0.4__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.
Files changed (63) hide show
  1. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/CHANGELOG.md +19 -0
  2. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/CONTRIBUTING.md +2 -0
  3. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/PKG-INFO +32 -28
  4. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/README.md +20 -20
  5. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/README.md +1 -1
  6. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/api.md +1 -1
  7. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/cli.md +2 -2
  8. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/local-demo.md +1 -1
  9. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/openai.md +2 -2
  10. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/quality-gates.md +18 -2
  11. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/releasing.md +7 -10
  12. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/support.md +5 -5
  13. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/pdf2mp3.py +1 -1
  14. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/PKG-INFO +32 -28
  15. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/requires.txt +19 -7
  16. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pyproject.toml +13 -5
  17. pdf2mp3-2.0.4/scripts/approved-licenses.json +25 -0
  18. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/conftest.py +15 -1
  19. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_cli_contract.py +10 -4
  20. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_cli_v2.py +1 -1
  21. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_openai_realtime.py +14 -5
  22. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_providers.py +6 -2
  23. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_quality_checks.py +21 -5
  24. pdf2mp3-2.0.2/scripts/approved-licenses.json +0 -14
  25. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/CODE_OF_CONDUCT.md +0 -0
  26. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/LICENSE +0 -0
  27. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/MANIFEST.in +0 -0
  28. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/SECURITY.md +0 -0
  29. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/docs/contracts.md +0 -0
  30. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/__init__.py +0 -0
  31. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/__main__.py +0 -0
  32. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/cli.py +0 -0
  33. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/openai_tts.py +0 -0
  34. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3/text.py +0 -0
  35. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/SOURCES.txt +0 -0
  36. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/dependency_links.txt +0 -0
  37. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/entry_points.txt +0 -0
  38. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pdf2mp3.egg-info/top_level.txt +0 -0
  39. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/pytest.ini +0 -0
  40. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/requirements-dev.txt +0 -0
  41. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/requirements.txt +0 -0
  42. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/create_demo_pdf.py +0 -0
  43. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/documentation_check.py +0 -0
  44. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/mutation-triage.json +0 -0
  45. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/network_guard.py +0 -0
  46. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/openai_check.py +0 -0
  47. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/package_check.py +0 -0
  48. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/performance_check.py +0 -0
  49. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/quality.py +0 -0
  50. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/quality_checks.py +0 -0
  51. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/release_check.py +0 -0
  52. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/scripts/scan_secrets.py +0 -0
  53. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/setup.cfg +0 -0
  54. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_cli.py +0 -0
  55. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_demo.py +0 -0
  56. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_documentation.py +0 -0
  57. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_integration.py +0 -0
  58. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_lang.py +0 -0
  59. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_network_guard.py +0 -0
  60. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_release_source.py +0 -0
  61. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_text.py +0 -0
  62. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_text_contract.py +0 -0
  63. {pdf2mp3-2.0.2 → pdf2mp3-2.0.4}/tests/test_tts.py +0 -0
@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.4] - 2026-12-05
10
+ ### Changed
11
+ - Use ReportLab 5.1.3 on Python 3.11 and later. Keep ReportLab 5.1.0 on
12
+ Python 3.10, where Pillow 13 cannot be installed.
13
+ - Use Coverage.py 7.18.0 and Hypothesis 6.170.28 on Python 3.11 and later.
14
+ Keep their last compatible versions on Python 3.10.
15
+ - Update mutmut to 3.10.0 and use pip-licenses 6.0.1 on Python 3.12. Keep
16
+ pip-licenses 5.5.5 on other Python versions for development compatibility.
17
+
18
+ ## [2.0.3] - 2026-12-05
19
+ ### Changed
20
+ - Update the development pins for pytest-asyncio to 1.5.0 and Ruff to 0.17.6.
21
+ Track ReportLab separately while retaining the Python 3.10-compatible pin.
22
+
23
+ ### Fixed
24
+ - Account for codec-dependent MP3 padding in audio contract tests.
25
+ - Verify the exact CI artifact after upload in a separate job with one retry.
26
+ - Recognize the reviewed license expression for the separately installed Edge TTS package.
27
+
9
28
  ## [2.0.2] - 2026-11-16
10
29
  ### Fixed
11
30
  - Fix pyttsx3 conversion on macOS by decoding AIFF audio and processing all
@@ -88,6 +88,8 @@ environment requires the maintainer's manual approval; see [releasing](docs/rele
88
88
  Dependency bots propose changes through PRs and never merge or release them.
89
89
  Related development dependencies and workflow actions are grouped so compatibility
90
90
  changes can be reviewed together. Review major runtime dependency updates separately.
91
+ Review ReportLab separately because its Pillow requirement can affect Python 3.10.
92
+ Review pip-licenses separately because version 6 excludes some supported Python patch releases.
91
93
  When combining or replacing proposals, link the tested replacement before closing
92
94
  superseded PRs; an open proposal with a clear next step is normal maintenance.
93
95
  External fork workflows require maintainer approval before running. The
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdf2mp3
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Convert PDFs to MP3 audiobooks using Microsoft Edge neural voices.
5
5
  Author-email: Raphael Medeiros <pdf2mp3@byraphaelmedeiros.com>
6
6
  Maintainer-email: Raphael Medeiros <pdf2mp3@byraphaelmedeiros.com>
@@ -25,19 +25,23 @@ Requires-Dist: pyobjc<14,>=10.3.1; sys_platform == "darwin" and extra == "pyttsx
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pip==26.3; extra == "dev"
27
27
  Requires-Dist: pytest==9.2.0; extra == "dev"
28
- Requires-Dist: pytest-asyncio==1.4.1.post1; extra == "dev"
29
- Requires-Dist: reportlab==5.1.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio==1.5.0; extra == "dev"
29
+ Requires-Dist: reportlab==5.1.0; python_version < "3.11" and extra == "dev"
30
+ Requires-Dist: reportlab==5.1.3; python_version >= "3.11" and extra == "dev"
30
31
  Requires-Dist: pytest-socket==0.8.1; extra == "dev"
31
32
  Requires-Dist: pytest-timeout==2.4.0; extra == "dev"
32
- Requires-Dist: hypothesis==6.168.5; extra == "dev"
33
- Requires-Dist: coverage==7.16.2; extra == "dev"
34
- Requires-Dist: ruff==0.17.3; extra == "dev"
33
+ Requires-Dist: hypothesis==6.168.5; python_version < "3.11" and extra == "dev"
34
+ Requires-Dist: hypothesis==6.170.28; python_version >= "3.11" and extra == "dev"
35
+ Requires-Dist: coverage==7.16.2; python_version < "3.11" and extra == "dev"
36
+ Requires-Dist: coverage==7.18.0; python_version >= "3.11" and extra == "dev"
37
+ Requires-Dist: ruff==0.17.6; extra == "dev"
35
38
  Requires-Dist: mypy==2.4.1; extra == "dev"
36
39
  Requires-Dist: bandit==1.9.4; extra == "dev"
37
40
  Requires-Dist: detect-secrets==1.5.0; extra == "dev"
38
41
  Requires-Dist: pip-audit==2.10.1; extra == "dev"
39
- Requires-Dist: pip-licenses==5.5.5; extra == "dev"
40
- Requires-Dist: mutmut==3.8.1; sys_platform != "win32" and extra == "dev"
42
+ Requires-Dist: pip-licenses==5.5.5; python_version != "3.12" and extra == "dev"
43
+ Requires-Dist: pip-licenses==6.0.1; python_version == "3.12" and extra == "dev"
44
+ Requires-Dist: mutmut==3.10.0; sys_platform != "win32" and extra == "dev"
41
45
  Requires-Dist: build==1.6.1; extra == "dev"
42
46
  Requires-Dist: twine==7.0.0; extra == "dev"
43
47
  Dynamic: license-file
@@ -45,7 +49,7 @@ Dynamic: license-file
45
49
  # PDF2MP3 — Listen to text-based PDFs
46
50
 
47
51
  [![PyPI version](https://badge.fury.io/py/pdf2mp3.svg)](https://pypi.org/project/pdf2mp3/)
48
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
52
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
49
53
  [![CI](https://github.com/byraphaelmedeiros/pdf2mp3/actions/workflows/ci.yml/badge.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/actions)
50
54
 
51
55
  PDF2MP3 is a Python command-line tool that turns the readable text in a PDF into
@@ -66,13 +70,13 @@ service; complex layouts may need preparation before conversion.
66
70
  Version **2** introduces a redesigned CLI. The conversion and check examples
67
71
  below require version 2. Version 1.0.0 uses `pdf2mp3 sample.pdf`, without
68
72
  subcommands or JSON. See the
69
- [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/quality-gates.md).
73
+ [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/quality-gates.md).
70
74
 
71
75
  ## Requirements
72
76
 
73
77
  - **Python 3.10+.** The configured test matrix covers 3.10–3.14. Version 2
74
78
  includes a conditional audioop compatibility dependency for Python 3.13+.
75
- See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md), including version 1.0.0's limits.
79
+ See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md), including version 1.0.0's limits.
76
80
  - **FFmpeg**, including `ffprobe`, must be available on your `PATH` for audio
77
81
  decoding and MP3 export. Installing the Python package does not install FFmpeg.
78
82
  - **An internet connection** is required for the default Edge voice service.
@@ -131,7 +135,7 @@ With the environment activated:
131
135
 
132
136
  ```bash
133
137
  python -m pip install --upgrade pip
134
- python -m pip install pdf2mp3==2.0.2
138
+ python -m pip install pdf2mp3==2.0.4
135
139
  pdf2mp3 --version
136
140
  pdf2mp3 --help
137
141
  python -m pdf2mp3 --help
@@ -139,9 +143,9 @@ python -m pdf2mp3 --help
139
143
 
140
144
  Both commands invoke the same CLI. The console command is installed through
141
145
  `pyproject.toml`; module execution is provided by `pdf2mp3/__main__.py`.
142
- Confirm that `--version` reports `2.0.2` before using these examples. Upgrading
146
+ Confirm that `--version` reports `2.0.4` before using these examples. Upgrading
143
147
  from version 1 requires the new `convert`/`check` syntax. Follow the
144
- [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) when updating existing scripts.
148
+ [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) when updating existing scripts.
145
149
 
146
150
  If `pdf2mp3` is not found, activate the environment where you installed it or use
147
151
  `python -m pdf2mp3` with that environment's Python interpreter.
@@ -197,21 +201,21 @@ output names when trying several examples on the same sample.
197
201
  | `-h`, `--help` | Display help (`convert --help` for provider options) | — |
198
202
 
199
203
  Version 2 also provides optional gTTS, OpenAI, pyttsx3 and macOS `say` adapters. See
200
- [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md) before using them.
204
+ [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md) before using them.
201
205
  Remote adapters send text to their respective services; OpenAI requires an API
202
206
  key and may incur charges. Local adapters depend on installed system voices.
203
207
  Automated adapter tests use synthetic responses and do not certify live voice availability.
204
208
  The OpenAI adapter now uses Realtime with `gpt-realtime-2.1-mini`, receives PCM
205
209
  and encodes MP3 locally. It rejects incomplete responses or changed narration
206
- transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/openai.md);
210
+ transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/openai.md);
207
211
  this integration has offline evidence, not live API validation.
208
212
  The gTTS extra retains a Click version constraint and a
209
- [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md#known-development-dependency-finding).
213
+ [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md#known-development-dependency-finding).
210
214
  Current audits no longer report it; no dependency override or security exemption is used.
211
215
  Use `convert --help` to inspect provider options. `--voice` selects Edge,
212
216
  OpenAI or local voices; `--model` applies only to OpenAI. gTTS uses `--lang`.
213
217
  Irrelevant provider options are rejected before processing. See
214
- [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) for stable exit codes and migration details.
218
+ [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) for stable exit codes and migration details.
215
219
 
216
220
  ## Check before converting
217
221
 
@@ -225,7 +229,7 @@ does not synthesize speech, contact voice services or write files. It reports
225
229
  configuration, text/chunk counts and whether conversion would send text
226
230
  externally. Passing this check does not establish remote voice availability or
227
231
  valid credentials. `--json` works before or after either subcommand; progress
228
- and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md).
232
+ and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md).
229
233
 
230
234
  ## Limits and troubleshooting
231
235
 
@@ -251,7 +255,7 @@ To install the release source, create and activate a separate Python 3.12
251
255
  environment as above, then:
252
256
 
253
257
  ```bash
254
- git clone --branch v2.0.2 https://github.com/byraphaelmedeiros/pdf2mp3.git
258
+ git clone --branch v2.0.4 https://github.com/byraphaelmedeiros/pdf2mp3.git
255
259
  cd pdf2mp3
256
260
  python -m pip install .
257
261
  pdf2mp3 --help
@@ -261,7 +265,7 @@ python -m pdf2mp3 --help
261
265
  `python -m pip install .` installs the package and its declared base dependencies.
262
266
  The repository's requirement files now delegate to that same package metadata;
263
267
  `requirements-dev.txt` also installs the pinned QA tools.
264
- For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md).
268
+ For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md).
265
269
 
266
270
  ### Try the synthetic demo
267
271
 
@@ -277,17 +281,17 @@ pdf2mp3 convert local/inputs/demo.pdf --output local/outputs/demo-edge.mp3
277
281
  The first command creates `local/inputs/demo.pdf` with synthetic Brazilian Portuguese text;
278
282
  it refuses to replace an existing file. The conversion sends only this sample
279
283
  text to the external Edge service. For an English sample, macOS offline speech
280
- and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/local-demo.md).
284
+ and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/local-demo.md).
281
285
  Generated demo PDFs and MP3s stay local and are ignored by Git.
282
286
 
283
287
  ## Project information
284
288
 
285
- - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/README.md)
286
- - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/api.md)
287
- - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CHANGELOG.md)
288
- - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CODE_OF_CONDUCT.md)
289
- - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md): report vulnerabilities privately to
289
+ - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/README.md)
290
+ - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/api.md)
291
+ - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CHANGELOG.md)
292
+ - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CODE_OF_CONDUCT.md)
293
+ - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md): report vulnerabilities privately to
290
294
  **pdf2mp3@byraphaelmedeiros.com**.
291
- - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
295
+ - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
292
296
 
293
297
  Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
@@ -1,7 +1,7 @@
1
1
  # PDF2MP3 — Listen to text-based PDFs
2
2
 
3
3
  [![PyPI version](https://badge.fury.io/py/pdf2mp3.svg)](https://pypi.org/project/pdf2mp3/)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
5
5
  [![CI](https://github.com/byraphaelmedeiros/pdf2mp3/actions/workflows/ci.yml/badge.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/actions)
6
6
 
7
7
  PDF2MP3 is a Python command-line tool that turns the readable text in a PDF into
@@ -22,13 +22,13 @@ service; complex layouts may need preparation before conversion.
22
22
  Version **2** introduces a redesigned CLI. The conversion and check examples
23
23
  below require version 2. Version 1.0.0 uses `pdf2mp3 sample.pdf`, without
24
24
  subcommands or JSON. See the
25
- [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/quality-gates.md).
25
+ [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/quality-gates.md).
26
26
 
27
27
  ## Requirements
28
28
 
29
29
  - **Python 3.10+.** The configured test matrix covers 3.10–3.14. Version 2
30
30
  includes a conditional audioop compatibility dependency for Python 3.13+.
31
- See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md), including version 1.0.0's limits.
31
+ See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md), including version 1.0.0's limits.
32
32
  - **FFmpeg**, including `ffprobe`, must be available on your `PATH` for audio
33
33
  decoding and MP3 export. Installing the Python package does not install FFmpeg.
34
34
  - **An internet connection** is required for the default Edge voice service.
@@ -87,7 +87,7 @@ With the environment activated:
87
87
 
88
88
  ```bash
89
89
  python -m pip install --upgrade pip
90
- python -m pip install pdf2mp3==2.0.2
90
+ python -m pip install pdf2mp3==2.0.4
91
91
  pdf2mp3 --version
92
92
  pdf2mp3 --help
93
93
  python -m pdf2mp3 --help
@@ -95,9 +95,9 @@ python -m pdf2mp3 --help
95
95
 
96
96
  Both commands invoke the same CLI. The console command is installed through
97
97
  `pyproject.toml`; module execution is provided by `pdf2mp3/__main__.py`.
98
- Confirm that `--version` reports `2.0.2` before using these examples. Upgrading
98
+ Confirm that `--version` reports `2.0.4` before using these examples. Upgrading
99
99
  from version 1 requires the new `convert`/`check` syntax. Follow the
100
- [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) when updating existing scripts.
100
+ [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) when updating existing scripts.
101
101
 
102
102
  If `pdf2mp3` is not found, activate the environment where you installed it or use
103
103
  `python -m pdf2mp3` with that environment's Python interpreter.
@@ -153,21 +153,21 @@ output names when trying several examples on the same sample.
153
153
  | `-h`, `--help` | Display help (`convert --help` for provider options) | — |
154
154
 
155
155
  Version 2 also provides optional gTTS, OpenAI, pyttsx3 and macOS `say` adapters. See
156
- [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md) before using them.
156
+ [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md) before using them.
157
157
  Remote adapters send text to their respective services; OpenAI requires an API
158
158
  key and may incur charges. Local adapters depend on installed system voices.
159
159
  Automated adapter tests use synthetic responses and do not certify live voice availability.
160
160
  The OpenAI adapter now uses Realtime with `gpt-realtime-2.1-mini`, receives PCM
161
161
  and encodes MP3 locally. It rejects incomplete responses or changed narration
162
- transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/openai.md);
162
+ transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/openai.md);
163
163
  this integration has offline evidence, not live API validation.
164
164
  The gTTS extra retains a Click version constraint and a
165
- [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md#known-development-dependency-finding).
165
+ [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md#known-development-dependency-finding).
166
166
  Current audits no longer report it; no dependency override or security exemption is used.
167
167
  Use `convert --help` to inspect provider options. `--voice` selects Edge,
168
168
  OpenAI or local voices; `--model` applies only to OpenAI. gTTS uses `--lang`.
169
169
  Irrelevant provider options are rejected before processing. See
170
- [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) for stable exit codes and migration details.
170
+ [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) for stable exit codes and migration details.
171
171
 
172
172
  ## Check before converting
173
173
 
@@ -181,7 +181,7 @@ does not synthesize speech, contact voice services or write files. It reports
181
181
  configuration, text/chunk counts and whether conversion would send text
182
182
  externally. Passing this check does not establish remote voice availability or
183
183
  valid credentials. `--json` works before or after either subcommand; progress
184
- and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md).
184
+ and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md).
185
185
 
186
186
  ## Limits and troubleshooting
187
187
 
@@ -207,7 +207,7 @@ To install the release source, create and activate a separate Python 3.12
207
207
  environment as above, then:
208
208
 
209
209
  ```bash
210
- git clone --branch v2.0.2 https://github.com/byraphaelmedeiros/pdf2mp3.git
210
+ git clone --branch v2.0.4 https://github.com/byraphaelmedeiros/pdf2mp3.git
211
211
  cd pdf2mp3
212
212
  python -m pip install .
213
213
  pdf2mp3 --help
@@ -217,7 +217,7 @@ python -m pdf2mp3 --help
217
217
  `python -m pip install .` installs the package and its declared base dependencies.
218
218
  The repository's requirement files now delegate to that same package metadata;
219
219
  `requirements-dev.txt` also installs the pinned QA tools.
220
- For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md).
220
+ For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md).
221
221
 
222
222
  ### Try the synthetic demo
223
223
 
@@ -233,17 +233,17 @@ pdf2mp3 convert local/inputs/demo.pdf --output local/outputs/demo-edge.mp3
233
233
  The first command creates `local/inputs/demo.pdf` with synthetic Brazilian Portuguese text;
234
234
  it refuses to replace an existing file. The conversion sends only this sample
235
235
  text to the external Edge service. For an English sample, macOS offline speech
236
- and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/local-demo.md).
236
+ and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/local-demo.md).
237
237
  Generated demo PDFs and MP3s stay local and are ignored by Git.
238
238
 
239
239
  ## Project information
240
240
 
241
- - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/README.md)
242
- - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/api.md)
243
- - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CHANGELOG.md)
244
- - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CODE_OF_CONDUCT.md)
245
- - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md): report vulnerabilities privately to
241
+ - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/README.md)
242
+ - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/api.md)
243
+ - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CHANGELOG.md)
244
+ - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CODE_OF_CONDUCT.md)
245
+ - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md): report vulnerabilities privately to
246
246
  **pdf2mp3@byraphaelmedeiros.com**.
247
- - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
247
+ - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
248
248
 
249
249
  Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
@@ -12,7 +12,7 @@
12
12
  - [Contribution guidelines](../CONTRIBUTING.md)
13
13
  - [Changelog](../CHANGELOG.md) and [security policy](../SECURITY.md)
14
14
 
15
- Documentation describes version 2.0.2. Check GitHub Actions and the package
15
+ Documentation describes version 2.0.4. Check GitHub Actions and the package
16
16
  index for CI and publication evidence. The synthetic demo guide separates local
17
17
  speech validation from CI and platform claims.
18
18
  The [gTTS/Click security note](../SECURITY.md#known-development-dependency-finding)
@@ -1,7 +1,7 @@
1
1
  # Python API reference
2
2
 
3
3
  This reference covers the seven callables exported by `pdf2mp3.__all__` in the
4
- `2.0.2` package. Import them directly from `pdf2mp3`. Provider adapters
4
+ `2.0.4` package. Import them directly from `pdf2mp3`. Provider adapters
5
5
  and `pdf2mp3.cli` are implementation modules, outside that exported contract.
6
6
  The CLI intentionally changed in v2; these Python callable contracts remain.
7
7
 
@@ -1,7 +1,7 @@
1
1
  # CLI v2 contract
2
2
 
3
- This interface belongs to version `2.0.2`. Install it with
4
- `python -m pip install pdf2mp3==2.0.2`, or install a source checkout with
3
+ This interface belongs to version `2.0.4`. Install it with
4
+ `python -m pip install pdf2mp3==2.0.4`, or install a source checkout with
5
5
  `python -m pip install .`. Version 1.0.0 uses the previous flat CLI.
6
6
  Both `pdf2mp3` and `python -m pdf2mp3` identify themselves as `pdf2mp3` and expose
7
7
  identical help. No arguments prints help and exits 0. `--version` prints the
@@ -1,6 +1,6 @@
1
1
  # Synthetic local demo
2
2
 
3
- This guide applies to a `2.0.2` source checkout with development dependencies.
3
+ This guide applies to a `2.0.4` source checkout with development dependencies.
4
4
  Use only the generated synthetic samples. Existing personal PDFs in a checkout
5
5
  are not test fixtures. The commands below create local samples and run checks.
6
6
 
@@ -3,7 +3,7 @@
3
3
  The optional OpenAI adapter uses the **Realtime API over WebSocket** with
4
4
  `gpt-realtime-2.1-mini` by default. It preserves the `alloy` voice default and
5
5
  produces a single MP3 through local FFmpeg processing. Edge remains the default
6
- engine. This adapter is part of the optional `2.0.2` package integration,
6
+ engine. This adapter is part of the optional `2.0.4` package integration,
7
7
  not the published 1.0.0 workflow.
8
8
 
9
9
  ## Installation and use
@@ -11,7 +11,7 @@ not the published 1.0.0 workflow.
11
11
  Install the provider extra:
12
12
 
13
13
  ```bash
14
- python -m pip install 'pdf2mp3[openai]==2.0.2'
14
+ python -m pip install 'pdf2mp3[openai]==2.0.4'
15
15
  pdf2mp3 convert --help
16
16
  pdf2mp3 check --engine openai --json
17
17
  ```
@@ -28,8 +28,10 @@ prove that remote matrix or live voice services passed. Stable publication has a
28
28
  separate final-tag check and consumes the gate's exact checksummed artifacts.
29
29
  The required `ci-required` job aggregates the full reusable quality workflow,
30
30
  including its OS/Python matrix. It succeeds only when that workflow succeeds.
31
- The gate also downloads its uploaded artifact and verifies the source commit
32
- and both distribution hashes before a PR can be integrated.
31
+ The readback job downloads the gate's upload by artifact ID and retries once if
32
+ the download fails. It verifies the source commit and both distribution hashes
33
+ before a PR can be integrated. Each attempt retains its own evidence artifact,
34
+ and the release workflow uses the verified artifact ID to select distributions.
33
35
 
34
36
  ## Tests and thresholds
35
37
 
@@ -116,6 +118,20 @@ outside the permissive set or new expressions fail for review. This covers Pytho
116
118
  must be considered separately when redistributing binaries. The package does
117
119
  not bundle them.
118
120
 
121
+ Edge TTS 7.4.2 declares `LGPL-3.0-only AND MIT`. Its notice assigns MIT to
122
+ `srt.py` and LGPLv3 to the remaining code. The wheel ships the license notice
123
+ and the accompanying GPLv3 text. The gate allows this exact expression for
124
+ Edge TTS under the separate-installation policy.
125
+ [Edge TTS package metadata](https://pypi.org/project/edge-tts/7.4.2/)
126
+
127
+ The Python 3.12 QA environment uses pip-licenses 6. Development installations
128
+ on other Python versions use pip-licenses 5 because version 6 excludes some
129
+ supported patch releases. Version 6 can report metadata and classifier labels
130
+ together. The policy lists the reviewed combinations for their specific packages.
131
+
132
+ Development installations on Python 3.10 use the last compatible Coverage.py
133
+ and Hypothesis pins. Python 3.11 and later use the current pins in `pyproject.toml`.
134
+
119
135
  ## Evidence and failures
120
136
 
121
137
  Each invocation writes `.quality/runs/<UTC timestamp>/summary.json`, command logs,
@@ -22,8 +22,9 @@ versions cannot pass the final tag check. Local gates never publish.
22
22
  successful jobs and artifact evidence. Only `byraphaelmedeiros` is a required
23
23
  reviewer. Self-review is allowed because there is one maintainer; administrator
24
24
  bypass is disabled. Deployment policy accepts only tags matching `v*`.
25
- The publish job uses PyPI Trusted Publishing, with `id-token: write` scoped
26
- to that job, and uploads the tested artifacts without a permanent API token.
25
+ The publish job uses PyPI Trusted Publishing to exchange a GitHub Actions
26
+ OpenID Connect (OIDC) identity for a short-lived PyPI credential. The workflow
27
+ grants `id-token: write` only to the publish job, which uploads the tested artifacts.
27
28
  5. Verify the resulting PyPI metadata/files against the retained artifact hashes
28
29
  and install/help checks from a new environment. A passed upload alone is not
29
30
  runtime verification. Never claim publication without registry readback.
@@ -32,8 +33,8 @@ versions cannot pass the final tag check. Local gates never publish.
32
33
 
33
34
  ## Trusted Publishing configuration
34
35
 
35
- Before using the OIDC workflow, the PyPI project owner must register and verify
36
- this publisher in the project's Publishing settings:
36
+ The PyPI project owner manages the trusted publisher in the project's
37
+ Publishing settings. The registration matches the GitHub Actions workflow.
37
38
 
38
39
  | Field | Value |
39
40
  | --- | --- |
@@ -43,12 +44,8 @@ this publisher in the project's Publishing settings:
43
44
  | Workflow filename | `release.yml` |
44
45
  | Environment | `pypi` |
45
46
 
46
- The registration is external configuration, not created by merging workflow
47
- files. Confirm it on PyPI before integrating the OIDC migration. Keep the legacy
48
- `PYPI_API_TOKEN` secret until the first explicitly authorized OIDC release has
49
- been verified, then revoke the corresponding PyPI token and delete the GitHub
50
- secret with maintainer authorization. The new workflow never reads that secret.
51
- Do not publish a throwaway version to test the migration.
47
+ If any of these settings change, update and verify the publisher registration
48
+ on PyPI before the next release.
52
49
 
53
50
  The maintainer controls release tags and publication. Contributors can propose
54
51
  release changes through PRs, but cannot merge them, create repository tags or
@@ -1,6 +1,6 @@
1
1
  # Python and platform support
2
2
 
3
- Version `2.0.2` requires Python **3.10 or later**. The configured
3
+ Version `2.0.4` requires Python **3.10 or later**. The configured
4
4
  matrix covers 3.10–3.14 on Linux, and 3.10/3.14 on macOS and Windows. Versions
5
5
  beyond that matrix are not yet verified. Canonical quality tooling runs on 3.12.
6
6
 
@@ -15,10 +15,10 @@ English and Brazilian Portuguese are the language presets, not translation.
15
15
 
16
16
  | Engine | Installation | External requirements |
17
17
  | --- | --- | --- |
18
- | Edge (default) | `python -m pip install pdf2mp3==2.0.2` | Network and available Microsoft voices |
19
- | gTTS | `python -m pip install 'pdf2mp3[gtts]==2.0.2'` | Network; Google speech endpoint |
20
- | OpenAI | `python -m pip install 'pdf2mp3[openai]==2.0.2'` | SDK 3.26.1+ with WebSockets, Realtime model access, `OPENAI_API_KEY`, possible charges; see [OpenAI narration](openai.md) |
21
- | pyttsx3 | `python -m pip install 'pdf2mp3[pyttsx3]==2.0.2'` | Working system speech engine/voices; PyObjC on macOS, eSpeak on Linux |
18
+ | Edge (default) | `python -m pip install pdf2mp3==2.0.4` | Network and available Microsoft voices |
19
+ | gTTS | `python -m pip install 'pdf2mp3[gtts]==2.0.4'` | Network; Google speech endpoint |
20
+ | OpenAI | `python -m pip install 'pdf2mp3[openai]==2.0.4'` | SDK 3.26.1+ with WebSockets, Realtime model access, `OPENAI_API_KEY`, possible charges; see [OpenAI narration](openai.md) |
21
+ | pyttsx3 | `python -m pip install 'pdf2mp3[pyttsx3]==2.0.4'` | Working system speech engine/voices; PyObjC on macOS, eSpeak on Linux |
22
22
  | macOS say | Base package | macOS `say` and installed voices |
23
23
 
24
24
  On macOS, the pyttsx3 extra permits PyObjC 13 on compatible Python versions.
@@ -78,7 +78,7 @@ from .text import preview as preview
78
78
  from .text import sanitize_for_tts as sanitize_for_tts
79
79
  from .text import split_into_chunks as split_into_chunks
80
80
 
81
- __version__ = "2.0.2"
81
+ __version__ = "2.0.4"
82
82
 
83
83
  # ---- Recommended female voices (unchanged logic/values) ----
84
84
  VOICE_BY_LANG = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdf2mp3
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Convert PDFs to MP3 audiobooks using Microsoft Edge neural voices.
5
5
  Author-email: Raphael Medeiros <pdf2mp3@byraphaelmedeiros.com>
6
6
  Maintainer-email: Raphael Medeiros <pdf2mp3@byraphaelmedeiros.com>
@@ -25,19 +25,23 @@ Requires-Dist: pyobjc<14,>=10.3.1; sys_platform == "darwin" and extra == "pyttsx
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: pip==26.3; extra == "dev"
27
27
  Requires-Dist: pytest==9.2.0; extra == "dev"
28
- Requires-Dist: pytest-asyncio==1.4.1.post1; extra == "dev"
29
- Requires-Dist: reportlab==5.1.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio==1.5.0; extra == "dev"
29
+ Requires-Dist: reportlab==5.1.0; python_version < "3.11" and extra == "dev"
30
+ Requires-Dist: reportlab==5.1.3; python_version >= "3.11" and extra == "dev"
30
31
  Requires-Dist: pytest-socket==0.8.1; extra == "dev"
31
32
  Requires-Dist: pytest-timeout==2.4.0; extra == "dev"
32
- Requires-Dist: hypothesis==6.168.5; extra == "dev"
33
- Requires-Dist: coverage==7.16.2; extra == "dev"
34
- Requires-Dist: ruff==0.17.3; extra == "dev"
33
+ Requires-Dist: hypothesis==6.168.5; python_version < "3.11" and extra == "dev"
34
+ Requires-Dist: hypothesis==6.170.28; python_version >= "3.11" and extra == "dev"
35
+ Requires-Dist: coverage==7.16.2; python_version < "3.11" and extra == "dev"
36
+ Requires-Dist: coverage==7.18.0; python_version >= "3.11" and extra == "dev"
37
+ Requires-Dist: ruff==0.17.6; extra == "dev"
35
38
  Requires-Dist: mypy==2.4.1; extra == "dev"
36
39
  Requires-Dist: bandit==1.9.4; extra == "dev"
37
40
  Requires-Dist: detect-secrets==1.5.0; extra == "dev"
38
41
  Requires-Dist: pip-audit==2.10.1; extra == "dev"
39
- Requires-Dist: pip-licenses==5.5.5; extra == "dev"
40
- Requires-Dist: mutmut==3.8.1; sys_platform != "win32" and extra == "dev"
42
+ Requires-Dist: pip-licenses==5.5.5; python_version != "3.12" and extra == "dev"
43
+ Requires-Dist: pip-licenses==6.0.1; python_version == "3.12" and extra == "dev"
44
+ Requires-Dist: mutmut==3.10.0; sys_platform != "win32" and extra == "dev"
41
45
  Requires-Dist: build==1.6.1; extra == "dev"
42
46
  Requires-Dist: twine==7.0.0; extra == "dev"
43
47
  Dynamic: license-file
@@ -45,7 +49,7 @@ Dynamic: license-file
45
49
  # PDF2MP3 — Listen to text-based PDFs
46
50
 
47
51
  [![PyPI version](https://badge.fury.io/py/pdf2mp3.svg)](https://pypi.org/project/pdf2mp3/)
48
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
52
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
49
53
  [![CI](https://github.com/byraphaelmedeiros/pdf2mp3/actions/workflows/ci.yml/badge.svg)](https://github.com/byraphaelmedeiros/pdf2mp3/actions)
50
54
 
51
55
  PDF2MP3 is a Python command-line tool that turns the readable text in a PDF into
@@ -66,13 +70,13 @@ service; complex layouts may need preparation before conversion.
66
70
  Version **2** introduces a redesigned CLI. The conversion and check examples
67
71
  below require version 2. Version 1.0.0 uses `pdf2mp3 sample.pdf`, without
68
72
  subcommands or JSON. See the
69
- [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/quality-gates.md).
73
+ [CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/quality-gates.md).
70
74
 
71
75
  ## Requirements
72
76
 
73
77
  - **Python 3.10+.** The configured test matrix covers 3.10–3.14. Version 2
74
78
  includes a conditional audioop compatibility dependency for Python 3.13+.
75
- See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md), including version 1.0.0's limits.
79
+ See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md), including version 1.0.0's limits.
76
80
  - **FFmpeg**, including `ffprobe`, must be available on your `PATH` for audio
77
81
  decoding and MP3 export. Installing the Python package does not install FFmpeg.
78
82
  - **An internet connection** is required for the default Edge voice service.
@@ -131,7 +135,7 @@ With the environment activated:
131
135
 
132
136
  ```bash
133
137
  python -m pip install --upgrade pip
134
- python -m pip install pdf2mp3==2.0.2
138
+ python -m pip install pdf2mp3==2.0.4
135
139
  pdf2mp3 --version
136
140
  pdf2mp3 --help
137
141
  python -m pdf2mp3 --help
@@ -139,9 +143,9 @@ python -m pdf2mp3 --help
139
143
 
140
144
  Both commands invoke the same CLI. The console command is installed through
141
145
  `pyproject.toml`; module execution is provided by `pdf2mp3/__main__.py`.
142
- Confirm that `--version` reports `2.0.2` before using these examples. Upgrading
146
+ Confirm that `--version` reports `2.0.4` before using these examples. Upgrading
143
147
  from version 1 requires the new `convert`/`check` syntax. Follow the
144
- [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) when updating existing scripts.
148
+ [CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) when updating existing scripts.
145
149
 
146
150
  If `pdf2mp3` is not found, activate the environment where you installed it or use
147
151
  `python -m pdf2mp3` with that environment's Python interpreter.
@@ -197,21 +201,21 @@ output names when trying several examples on the same sample.
197
201
  | `-h`, `--help` | Display help (`convert --help` for provider options) | — |
198
202
 
199
203
  Version 2 also provides optional gTTS, OpenAI, pyttsx3 and macOS `say` adapters. See
200
- [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/support.md) before using them.
204
+ [provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/support.md) before using them.
201
205
  Remote adapters send text to their respective services; OpenAI requires an API
202
206
  key and may incur charges. Local adapters depend on installed system voices.
203
207
  Automated adapter tests use synthetic responses and do not certify live voice availability.
204
208
  The OpenAI adapter now uses Realtime with `gpt-realtime-2.1-mini`, receives PCM
205
209
  and encodes MP3 locally. It rejects incomplete responses or changed narration
206
- transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/openai.md);
210
+ transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/openai.md);
207
211
  this integration has offline evidence, not live API validation.
208
212
  The gTTS extra retains a Click version constraint and a
209
- [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md#known-development-dependency-finding).
213
+ [historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md#known-development-dependency-finding).
210
214
  Current audits no longer report it; no dependency override or security exemption is used.
211
215
  Use `convert --help` to inspect provider options. `--voice` selects Edge,
212
216
  OpenAI or local voices; `--model` applies only to OpenAI. gTTS uses `--lang`.
213
217
  Irrelevant provider options are rejected before processing. See
214
- [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md) for stable exit codes and migration details.
218
+ [the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md) for stable exit codes and migration details.
215
219
 
216
220
  ## Check before converting
217
221
 
@@ -225,7 +229,7 @@ does not synthesize speech, contact voice services or write files. It reports
225
229
  configuration, text/chunk counts and whether conversion would send text
226
230
  externally. Passing this check does not establish remote voice availability or
227
231
  valid credentials. `--json` works before or after either subcommand; progress
228
- and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/cli.md).
232
+ and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/cli.md).
229
233
 
230
234
  ## Limits and troubleshooting
231
235
 
@@ -251,7 +255,7 @@ To install the release source, create and activate a separate Python 3.12
251
255
  environment as above, then:
252
256
 
253
257
  ```bash
254
- git clone --branch v2.0.2 https://github.com/byraphaelmedeiros/pdf2mp3.git
258
+ git clone --branch v2.0.4 https://github.com/byraphaelmedeiros/pdf2mp3.git
255
259
  cd pdf2mp3
256
260
  python -m pip install .
257
261
  pdf2mp3 --help
@@ -261,7 +265,7 @@ python -m pdf2mp3 --help
261
265
  `python -m pip install .` installs the package and its declared base dependencies.
262
266
  The repository's requirement files now delegate to that same package metadata;
263
267
  `requirements-dev.txt` also installs the pinned QA tools.
264
- For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md).
268
+ For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md).
265
269
 
266
270
  ### Try the synthetic demo
267
271
 
@@ -277,17 +281,17 @@ pdf2mp3 convert local/inputs/demo.pdf --output local/outputs/demo-edge.mp3
277
281
  The first command creates `local/inputs/demo.pdf` with synthetic Brazilian Portuguese text;
278
282
  it refuses to replace an existing file. The conversion sends only this sample
279
283
  text to the external Edge service. For an English sample, macOS offline speech
280
- and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/local-demo.md).
284
+ and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/local-demo.md).
281
285
  Generated demo PDFs and MP3s stay local and are ignored by Git.
282
286
 
283
287
  ## Project information
284
288
 
285
- - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/README.md)
286
- - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/docs/api.md)
287
- - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CHANGELOG.md)
288
- - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/CODE_OF_CONDUCT.md)
289
- - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/SECURITY.md): report vulnerabilities privately to
289
+ - [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/README.md)
290
+ - [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/docs/api.md)
291
+ - [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CHANGELOG.md)
292
+ - [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/CODE_OF_CONDUCT.md)
293
+ - [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/SECURITY.md): report vulnerabilities privately to
290
294
  **pdf2mp3@byraphaelmedeiros.com**.
291
- - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/LICENSE)
295
+ - [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.4/LICENSE)
292
296
 
293
297
  Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
@@ -9,23 +9,35 @@ audioop-lts<0.3,>=0.2.2
9
9
  [dev]
10
10
  pip==26.3
11
11
  pytest==9.2.0
12
- pytest-asyncio==1.4.1.post1
13
- reportlab==5.1.0
12
+ pytest-asyncio==1.5.0
14
13
  pytest-socket==0.8.1
15
14
  pytest-timeout==2.4.0
16
- hypothesis==6.168.5
17
- coverage==7.16.2
18
- ruff==0.17.3
15
+ ruff==0.17.6
19
16
  mypy==2.4.1
20
17
  bandit==1.9.4
21
18
  detect-secrets==1.5.0
22
19
  pip-audit==2.10.1
23
- pip-licenses==5.5.5
24
20
  build==1.6.1
25
21
  twine==7.0.0
26
22
 
23
+ [dev:python_version != "3.12"]
24
+ pip-licenses==5.5.5
25
+
26
+ [dev:python_version < "3.11"]
27
+ reportlab==5.1.0
28
+ hypothesis==6.168.5
29
+ coverage==7.16.2
30
+
31
+ [dev:python_version == "3.12"]
32
+ pip-licenses==6.0.1
33
+
34
+ [dev:python_version >= "3.11"]
35
+ reportlab==5.1.3
36
+ hypothesis==6.170.28
37
+ coverage==7.18.0
38
+
27
39
  [dev:sys_platform != "win32"]
28
- mutmut==3.8.1
40
+ mutmut==3.10.0
29
41
 
30
42
  [gtts]
31
43
  gTTS<3,>=2.5.3
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pdf2mp3"
7
- version = "2.0.2"
7
+ version = "2.0.4"
8
8
  description = "Convert PDFs to MP3 audiobooks using Microsoft Edge neural voices."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -28,11 +28,19 @@ pyttsx3 = [
28
28
  "pyobjc>=10.3.1,<14; sys_platform == 'darwin'"
29
29
  ]
30
30
  dev = [
31
- "pip==26.3", "pytest==9.2.0", "pytest-asyncio==1.4.1.post1", "reportlab==5.1.0",
32
- "pytest-socket==0.8.1", "pytest-timeout==2.4.0", "hypothesis==6.168.5",
33
- "coverage==7.16.2", "ruff==0.17.3", "mypy==2.4.1",
31
+ "pip==26.3", "pytest==9.2.0", "pytest-asyncio==1.5.0",
32
+ "reportlab==5.1.0; python_version < '3.11'",
33
+ "reportlab==5.1.3; python_version >= '3.11'",
34
+ "pytest-socket==0.8.1", "pytest-timeout==2.4.0",
35
+ "hypothesis==6.168.5; python_version < '3.11'",
36
+ "hypothesis==6.170.28; python_version >= '3.11'",
37
+ "coverage==7.16.2; python_version < '3.11'",
38
+ "coverage==7.18.0; python_version >= '3.11'",
39
+ "ruff==0.17.6", "mypy==2.4.1",
34
40
  "bandit==1.9.4", "detect-secrets==1.5.0", "pip-audit==2.10.1",
35
- "pip-licenses==5.5.5", "mutmut==3.8.1; sys_platform != 'win32'",
41
+ "pip-licenses==5.5.5; python_version != '3.12'",
42
+ "pip-licenses==6.0.1; python_version == '3.12'",
43
+ "mutmut==3.10.0; sys_platform != 'win32'",
36
44
  "build==1.6.1", "twine==7.0.0"
37
45
  ]
38
46
 
@@ -0,0 +1,25 @@
1
+ {
2
+ "licenses": [
3
+ "MIT", "MIT License", "MIT-0", "Apache-2.0", "Apache Software License",
4
+ "Apache License 2.0", "Apache-2.0 AND MIT", "Apache Software License; MIT License",
5
+ "Apache-2.0 OR BSD-3-Clause", "BSD License", "BSD-3-Clause", "BSD-2-Clause",
6
+ "ISC", "ISC License (ISCL)", "Python Software Foundation License", "PSF-2.0"
7
+ ],
8
+ "packages": {
9
+ "aiohappyeyeballs": ["PSF-2.0; Python Software Foundation License"],
10
+ "aiosignal": ["Apache 2.0; Apache Software License"],
11
+ "certifi": [
12
+ "Mozilla Public License 2.0 (MPL 2.0)", "MPL-2.0", "MPL-2.0; Mozilla Public License 2.0 (MPL 2.0)"
13
+ ],
14
+ "edge-tts": [
15
+ "GNU Lesser General Public License v3 (LGPLv3)", "LGPL-3.0-only", "LGPL-3.0-only AND MIT"
16
+ ],
17
+ "gtts": ["MIT; MIT License"],
18
+ "h11": ["MIT; MIT License"],
19
+ "pydub": ["MIT; MIT License"],
20
+ "pyttsx3": ["MPL-2.0"],
21
+ "requests": ["Apache Software License; Apache-2.0"],
22
+ "sniffio": ["Apache Software License; MIT License; MIT OR Apache-2.0"],
23
+ "tqdm": ["MPL-2.0 AND MIT"]
24
+ }
25
+ }
@@ -35,10 +35,24 @@ def invoke(monkeypatch):
35
35
 
36
36
  @pytest.fixture
37
37
  def synthetic_speech(monkeypatch):
38
+ segment = AudioSegment.silent(duration=100)
39
+
38
40
  async def speak(*args, **kwargs):
39
- return AudioSegment.silent(duration=100)
41
+ return segment
40
42
 
41
43
  monkeypatch.setattr(app, "synthesize_chunks", speak)
44
+ return segment
45
+
46
+
47
+ @pytest.fixture
48
+ def reference_mp3(tmp_path):
49
+ def encode(segment):
50
+ # The installed codec may expose MP3 encoder delay and padding on decode.
51
+ path = tmp_path / "reference.mp3"
52
+ segment.export(path, format="mp3").close()
53
+ return path
54
+
55
+ return encode
42
56
 
43
57
 
44
58
  # pytest-socket must still deny all ordinary network sockets. Windows asyncio's
@@ -76,11 +76,13 @@ def test_encrypted_pdf_has_controlled_error(tmp_path, invoke):
76
76
  assert invoke("convert", path) == 6
77
77
 
78
78
 
79
- def test_default_conversion_preserves_input(synthetic_pdf, synthetic_speech, invoke):
79
+ def test_default_conversion_preserves_input(synthetic_pdf, synthetic_speech, invoke, reference_mp3):
80
80
  before = synthetic_pdf.read_bytes()
81
81
  assert invoke("convert", synthetic_pdf) == 0
82
- assert len(AudioSegment.from_mp3(synthetic_pdf.with_suffix(".mp3"))) == 100
83
82
  assert synthetic_pdf.read_bytes() == before
83
+ audio = AudioSegment.from_mp3(synthetic_pdf.with_suffix(".mp3"))
84
+ expected = AudioSegment.from_mp3(reference_mp3(synthetic_speech))
85
+ assert len(audio) == pytest.approx(len(expected), abs=1)
84
86
 
85
87
 
86
88
  def test_existing_error_codes_and_empty_pdf(tmp_path, synthetic_pdf, invoke, monkeypatch):
@@ -95,7 +97,9 @@ def test_existing_error_codes_and_empty_pdf(tmp_path, synthetic_pdf, invoke, mon
95
97
 
96
98
  @pytest.mark.parametrize("engine", ["edge", "gtts", "openai", "pyttsx3", "say"])
97
99
  @pytest.mark.parametrize("custom", [False, True])
98
- def test_engine_dispatch(engine, custom, synthetic_pdf, invoke, monkeypatch, tmp_path):
100
+ def test_engine_dispatch(
101
+ engine, custom, synthetic_pdf, invoke, monkeypatch, tmp_path, reference_mp3
102
+ ):
99
103
  calls = []
100
104
  segment = AudioSegment.silent(duration=80)
101
105
 
@@ -137,7 +141,9 @@ def test_engine_dispatch(engine, custom, synthetic_pdf, invoke, monkeypatch, tmp
137
141
  elif engine == "openai":
138
142
  args += ["--model", "gpt-realtime-2.1"]
139
143
  assert invoke(*args) == 0
140
- assert len(AudioSegment.from_mp3(output)) == 80
144
+ audio = AudioSegment.from_mp3(output)
145
+ expected = AudioSegment.from_mp3(reference_mp3(segment))
146
+ assert len(audio) == pytest.approx(len(expected), abs=1)
141
147
  assert len(calls) == 1
142
148
  content, kwargs = calls[0]
143
149
  assert "Synthetic first sentence." in (content if isinstance(content, str) else content[0])
@@ -157,7 +157,7 @@ def test_debug_does_not_expose_exception_values(synthetic_pdf, invoke, monkeypat
157
157
  def test_informational_commands(args, invoke, capsys):
158
158
  assert invoke(*args) == 0
159
159
  captured = capsys.readouterr()
160
- assert captured.out.startswith("pdf2mp3 2.0.2" if args == ["--version"] else "usage: pdf2mp3")
160
+ assert captured.out.startswith("pdf2mp3 2.0.4" if args == ["--version"] else "usage: pdf2mp3")
161
161
  assert not captured.err
162
162
 
163
163
 
@@ -58,7 +58,8 @@ def realtime(monkeypatch):
58
58
  state["closed"].append("connection")
59
59
 
60
60
  monkeypatch.setitem(sys.modules, "openai", SimpleNamespace(AsyncOpenAI=Client))
61
- pcm = Sine(440, sample_rate=24000).to_audio_segment(duration=100).raw_data
61
+ state["tone"] = Sine(440, sample_rate=24000).to_audio_segment(duration=100)
62
+ pcm = state["tone"].raw_data
62
63
  state["pcm"] = pcm
63
64
  state["events"] = [
64
65
  SimpleNamespace(type="session.created"),
@@ -76,10 +77,12 @@ def realtime(monkeypatch):
76
77
  return state
77
78
 
78
79
 
79
- def test_realtime_request_produces_real_mp3_and_closes_resources(realtime):
80
+ def test_realtime_request_produces_real_mp3_and_closes_resources(realtime, reference_mp3):
80
81
  data = app.tts_chunk_openai("Synthetic narration.", "gpt-realtime-2.1-mini", "alloy")
81
82
  audio = AudioSegment.from_mp3(BytesIO(data))
82
- assert 95 <= len(audio) <= 105 and audio.rms > 0
83
+ reference = reference_mp3(realtime["tone"])
84
+ expected = AudioSegment.from_mp3(BytesIO(reference.read_bytes()))
85
+ assert len(audio) == pytest.approx(len(expected), abs=1) and audio.rms > 0
83
86
  assert audio.channels == 1 and audio.frame_rate == 24000
84
87
  assert realtime["connect"] == {"model": "gpt-realtime-2.1-mini"}
85
88
  request = realtime["sent"][0]["response"]
@@ -148,7 +151,7 @@ def test_narration_comparison_ignores_case_punctuation_and_spacing(realtime):
148
151
 
149
152
 
150
153
  def test_cli_realtime_conversion_keeps_json_and_audio_contract(
151
- realtime, synthetic_pdf, invoke, monkeypatch, capsys
154
+ realtime, synthetic_pdf, invoke, monkeypatch, capsys, reference_mp3
152
155
  ):
153
156
  original = synthetic_pdf.read_bytes()
154
157
  realtime["events"][3].transcript = "Synthetic first sentence. Synthetic second sentence."
@@ -157,8 +160,14 @@ def test_cli_realtime_conversion_keeps_json_and_audio_contract(
157
160
  captured = capsys.readouterr()
158
161
  result = json.loads(captured.out)
159
162
  assert result["ok"] and result["data"]["model"] == "gpt-realtime-2.1-mini"
163
+ chunk = reference_mp3(realtime["tone"])
164
+ assembled = AudioSegment.from_mp3(BytesIO(chunk.read_bytes())) + AudioSegment.silent(
165
+ duration=120
166
+ )
167
+ assert result["data"]["duration_seconds"] == pytest.approx(len(assembled) / 1000, abs=0.001)
160
168
  audio = AudioSegment.from_mp3(synthetic_pdf.with_suffix(".mp3"))
161
- assert 215 <= len(audio) <= 225 and audio.rms > 0
169
+ expected = AudioSegment.from_mp3(reference_mp3(assembled))
170
+ assert len(audio) == pytest.approx(len(expected), abs=1) and audio.rms > 0
162
171
  assert synthetic_pdf.read_bytes() == original
163
172
  assert "Synthetic first" not in captured.out + captured.err
164
173
 
@@ -3,6 +3,7 @@
3
3
  import builtins
4
4
  import sys
5
5
  from importlib.machinery import ModuleSpec
6
+ from io import BytesIO
6
7
  from pathlib import Path
7
8
  from types import SimpleNamespace
8
9
 
@@ -47,13 +48,16 @@ def test_gtts_request_and_bytes(monkeypatch):
47
48
 
48
49
  def test_synchronous_audio_join():
49
50
  calls = []
50
- data = AudioSegment.silent(duration=100).export(format="mp3").read()
51
+ with AudioSegment.silent(duration=100).export(format="mp3") as encoded:
52
+ data = encoded.read()
53
+ decoded_duration = len(AudioSegment.from_mp3(BytesIO(data)))
51
54
 
52
55
  def speech(text):
53
56
  calls.append(text)
54
57
  return data
55
58
 
56
- assert len(app.synthesize_chunks_sync(["one", "two"], speech)) == 440
59
+ audio = app.synthesize_chunks_sync(["one", "two"], speech)
60
+ assert len(audio) == pytest.approx(2 * (decoded_duration + 120), abs=1)
57
61
  assert calls == ["one", "two"]
58
62
  assert len(app.synthesize_chunks_sync([], speech)) == 0
59
63
 
@@ -1,5 +1,8 @@
1
1
  """The gate must reject missing evidence, threshold misses and invalid tool results."""
2
2
 
3
+ import json
4
+ from pathlib import Path
5
+
3
6
  import pytest
4
7
 
5
8
  from scripts.quality_checks import (
@@ -152,11 +155,24 @@ def test_triaged_timeout_stays_in_denominator_and_never_counts_as_killed(status)
152
155
  check_mutation(records, triaged_timeouts={known})
153
156
 
154
157
 
155
- def test_copyleft_license_acceptance_is_package_scoped():
156
- package = {"edge-tts": ["LGPL-3.0-only"]}
157
- assert check_licenses([{"Name": "edge-tts", "License": "LGPL-3.0-only"}], ["MIT"], package) == 1
158
- with pytest.raises(ValueError):
159
- check_licenses([{"Name": "other", "License": "LGPL-3.0-only"}], ["MIT"], package)
158
+ @pytest.mark.parametrize(
159
+ ("package", "expression"),
160
+ [
161
+ ("edge-tts", "GNU Lesser General Public License v3 (LGPLv3)"),
162
+ ("edge-tts", "LGPL-3.0-only"),
163
+ ("edge-tts", "LGPL-3.0-only AND MIT"),
164
+ ("certifi", "MPL-2.0; Mozilla Public License 2.0 (MPL 2.0)"),
165
+ ("sniffio", "Apache Software License; MIT License; MIT OR Apache-2.0"),
166
+ ],
167
+ )
168
+ def test_reviewed_license_labels_are_package_scoped(package, expression):
169
+ policy_path = Path(__file__).resolve().parents[1] / "scripts" / "approved-licenses.json"
170
+ policy = json.loads(policy_path.read_text(encoding="utf-8"))
171
+ report = [{"Name": package, "License": expression}]
172
+ assert check_licenses(report, policy["licenses"], policy["packages"]) == 1
173
+ report[0]["Name"] = "other"
174
+ with pytest.raises(ValueError, match="license needs review: other"):
175
+ check_licenses(report, policy["licenses"], policy["packages"])
160
176
 
161
177
 
162
178
  def test_command_stdout_is_separate_from_warnings(tmp_path, monkeypatch):
@@ -1,14 +0,0 @@
1
- {
2
- "licenses": [
3
- "MIT", "MIT License", "MIT-0", "Apache-2.0", "Apache Software License",
4
- "Apache License 2.0", "Apache-2.0 AND MIT", "Apache Software License; MIT License",
5
- "Apache-2.0 OR BSD-3-Clause", "BSD License", "BSD-3-Clause", "BSD-2-Clause",
6
- "ISC", "ISC License (ISCL)", "Python Software Foundation License", "PSF-2.0"
7
- ],
8
- "packages": {
9
- "certifi": ["Mozilla Public License 2.0 (MPL 2.0)", "MPL-2.0"],
10
- "edge-tts": ["GNU Lesser General Public License v3 (LGPLv3)", "LGPL-3.0-only"],
11
- "pyttsx3": ["MPL-2.0"],
12
- "tqdm": ["MPL-2.0 AND MIT"]
13
- }
14
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes