pdf2mp3 2.0.2__tar.gz → 2.0.3__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.
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/CHANGELOG.md +10 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/CONTRIBUTING.md +1 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/PKG-INFO +23 -23
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/README.md +20 -20
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/README.md +1 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/api.md +1 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/cli.md +2 -2
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/local-demo.md +1 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/openai.md +2 -2
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/quality-gates.md +10 -2
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/releasing.md +7 -10
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/support.md +5 -5
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/pdf2mp3.py +1 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/PKG-INFO +23 -23
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/requires.txt +2 -2
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pyproject.toml +3 -3
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/approved-licenses.json +3 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/conftest.py +15 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_cli_contract.py +10 -4
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_cli_v2.py +1 -1
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_openai_realtime.py +14 -5
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_providers.py +6 -2
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_quality_checks.py +15 -5
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/CODE_OF_CONDUCT.md +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/LICENSE +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/MANIFEST.in +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/SECURITY.md +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/docs/contracts.md +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/__init__.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/__main__.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/cli.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/openai_tts.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3/text.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/SOURCES.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/dependency_links.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/entry_points.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pdf2mp3.egg-info/top_level.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/pytest.ini +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/requirements-dev.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/requirements.txt +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/create_demo_pdf.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/documentation_check.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/mutation-triage.json +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/network_guard.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/openai_check.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/package_check.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/performance_check.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/quality.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/quality_checks.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/release_check.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/scripts/scan_secrets.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/setup.cfg +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_cli.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_demo.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_documentation.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_integration.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_lang.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_network_guard.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_release_source.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_text.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_text_contract.py +0 -0
- {pdf2mp3-2.0.2 → pdf2mp3-2.0.3}/tests/test_tts.py +0 -0
|
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.0.3] - 2026-12-05
|
|
10
|
+
### Changed
|
|
11
|
+
- Update the development pins for pytest-asyncio to 1.5.0 and Ruff to 0.17.6.
|
|
12
|
+
Track ReportLab separately while retaining the Python 3.10-compatible pin.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Account for codec-dependent MP3 padding in audio contract tests.
|
|
16
|
+
- Verify the exact CI artifact after upload in a separate job with one retry.
|
|
17
|
+
- Recognize the reviewed license expression for the separately installed Edge TTS package.
|
|
18
|
+
|
|
9
19
|
## [2.0.2] - 2026-11-16
|
|
10
20
|
### Fixed
|
|
11
21
|
- Fix pyttsx3 conversion on macOS by decoding AIFF audio and processing all
|
|
@@ -88,6 +88,7 @@ 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.
|
|
91
92
|
When combining or replacing proposals, link the tested replacement before closing
|
|
92
93
|
superseded PRs; an open proposal with a clear next step is normal maintenance.
|
|
93
94
|
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.
|
|
3
|
+
Version: 2.0.3
|
|
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,13 +25,13 @@ 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.
|
|
28
|
+
Requires-Dist: pytest-asyncio==1.5.0; extra == "dev"
|
|
29
29
|
Requires-Dist: reportlab==5.1.0; extra == "dev"
|
|
30
30
|
Requires-Dist: pytest-socket==0.8.1; extra == "dev"
|
|
31
31
|
Requires-Dist: pytest-timeout==2.4.0; extra == "dev"
|
|
32
32
|
Requires-Dist: hypothesis==6.168.5; extra == "dev"
|
|
33
33
|
Requires-Dist: coverage==7.16.2; extra == "dev"
|
|
34
|
-
Requires-Dist: ruff==0.17.
|
|
34
|
+
Requires-Dist: ruff==0.17.6; extra == "dev"
|
|
35
35
|
Requires-Dist: mypy==2.4.1; extra == "dev"
|
|
36
36
|
Requires-Dist: bandit==1.9.4; extra == "dev"
|
|
37
37
|
Requires-Dist: detect-secrets==1.5.0; extra == "dev"
|
|
@@ -45,7 +45,7 @@ Dynamic: license-file
|
|
|
45
45
|
# PDF2MP3 — Listen to text-based PDFs
|
|
46
46
|
|
|
47
47
|
[](https://pypi.org/project/pdf2mp3/)
|
|
48
|
-
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
48
|
+
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/LICENSE)
|
|
49
49
|
[](https://github.com/byraphaelmedeiros/pdf2mp3/actions)
|
|
50
50
|
|
|
51
51
|
PDF2MP3 is a Python command-line tool that turns the readable text in a PDF into
|
|
@@ -66,13 +66,13 @@ service; complex layouts may need preparation before conversion.
|
|
|
66
66
|
Version **2** introduces a redesigned CLI. The conversion and check examples
|
|
67
67
|
below require version 2. Version 1.0.0 uses `pdf2mp3 sample.pdf`, without
|
|
68
68
|
subcommands or JSON. See the
|
|
69
|
-
[CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
69
|
+
[CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/quality-gates.md).
|
|
70
70
|
|
|
71
71
|
## Requirements
|
|
72
72
|
|
|
73
73
|
- **Python 3.10+.** The configured test matrix covers 3.10–3.14. Version 2
|
|
74
74
|
includes a conditional audioop compatibility dependency for Python 3.13+.
|
|
75
|
-
See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
75
|
+
See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/support.md), including version 1.0.0's limits.
|
|
76
76
|
- **FFmpeg**, including `ffprobe`, must be available on your `PATH` for audio
|
|
77
77
|
decoding and MP3 export. Installing the Python package does not install FFmpeg.
|
|
78
78
|
- **An internet connection** is required for the default Edge voice service.
|
|
@@ -131,7 +131,7 @@ With the environment activated:
|
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
133
|
python -m pip install --upgrade pip
|
|
134
|
-
python -m pip install pdf2mp3==2.0.
|
|
134
|
+
python -m pip install pdf2mp3==2.0.3
|
|
135
135
|
pdf2mp3 --version
|
|
136
136
|
pdf2mp3 --help
|
|
137
137
|
python -m pdf2mp3 --help
|
|
@@ -139,9 +139,9 @@ python -m pdf2mp3 --help
|
|
|
139
139
|
|
|
140
140
|
Both commands invoke the same CLI. The console command is installed through
|
|
141
141
|
`pyproject.toml`; module execution is provided by `pdf2mp3/__main__.py`.
|
|
142
|
-
Confirm that `--version` reports `2.0.
|
|
142
|
+
Confirm that `--version` reports `2.0.3` before using these examples. Upgrading
|
|
143
143
|
from version 1 requires the new `convert`/`check` syntax. Follow the
|
|
144
|
-
[CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
144
|
+
[CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) when updating existing scripts.
|
|
145
145
|
|
|
146
146
|
If `pdf2mp3` is not found, activate the environment where you installed it or use
|
|
147
147
|
`python -m pdf2mp3` with that environment's Python interpreter.
|
|
@@ -197,21 +197,21 @@ output names when trying several examples on the same sample.
|
|
|
197
197
|
| `-h`, `--help` | Display help (`convert --help` for provider options) | — |
|
|
198
198
|
|
|
199
199
|
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.
|
|
200
|
+
[provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/support.md) before using them.
|
|
201
201
|
Remote adapters send text to their respective services; OpenAI requires an API
|
|
202
202
|
key and may incur charges. Local adapters depend on installed system voices.
|
|
203
203
|
Automated adapter tests use synthetic responses and do not certify live voice availability.
|
|
204
204
|
The OpenAI adapter now uses Realtime with `gpt-realtime-2.1-mini`, receives PCM
|
|
205
205
|
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.
|
|
206
|
+
transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/openai.md);
|
|
207
207
|
this integration has offline evidence, not live API validation.
|
|
208
208
|
The gTTS extra retains a Click version constraint and a
|
|
209
|
-
[historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
209
|
+
[historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/SECURITY.md#known-development-dependency-finding).
|
|
210
210
|
Current audits no longer report it; no dependency override or security exemption is used.
|
|
211
211
|
Use `convert --help` to inspect provider options. `--voice` selects Edge,
|
|
212
212
|
OpenAI or local voices; `--model` applies only to OpenAI. gTTS uses `--lang`.
|
|
213
213
|
Irrelevant provider options are rejected before processing. See
|
|
214
|
-
[the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
214
|
+
[the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) for stable exit codes and migration details.
|
|
215
215
|
|
|
216
216
|
## Check before converting
|
|
217
217
|
|
|
@@ -225,7 +225,7 @@ does not synthesize speech, contact voice services or write files. It reports
|
|
|
225
225
|
configuration, text/chunk counts and whether conversion would send text
|
|
226
226
|
externally. Passing this check does not establish remote voice availability or
|
|
227
227
|
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.
|
|
228
|
+
and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md).
|
|
229
229
|
|
|
230
230
|
## Limits and troubleshooting
|
|
231
231
|
|
|
@@ -251,7 +251,7 @@ To install the release source, create and activate a separate Python 3.12
|
|
|
251
251
|
environment as above, then:
|
|
252
252
|
|
|
253
253
|
```bash
|
|
254
|
-
git clone --branch v2.0.
|
|
254
|
+
git clone --branch v2.0.3 https://github.com/byraphaelmedeiros/pdf2mp3.git
|
|
255
255
|
cd pdf2mp3
|
|
256
256
|
python -m pip install .
|
|
257
257
|
pdf2mp3 --help
|
|
@@ -261,7 +261,7 @@ python -m pdf2mp3 --help
|
|
|
261
261
|
`python -m pip install .` installs the package and its declared base dependencies.
|
|
262
262
|
The repository's requirement files now delegate to that same package metadata;
|
|
263
263
|
`requirements-dev.txt` also installs the pinned QA tools.
|
|
264
|
-
For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
264
|
+
For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CONTRIBUTING.md).
|
|
265
265
|
|
|
266
266
|
### Try the synthetic demo
|
|
267
267
|
|
|
@@ -277,17 +277,17 @@ pdf2mp3 convert local/inputs/demo.pdf --output local/outputs/demo-edge.mp3
|
|
|
277
277
|
The first command creates `local/inputs/demo.pdf` with synthetic Brazilian Portuguese text;
|
|
278
278
|
it refuses to replace an existing file. The conversion sends only this sample
|
|
279
279
|
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.
|
|
280
|
+
and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/local-demo.md).
|
|
281
281
|
Generated demo PDFs and MP3s stay local and are ignored by Git.
|
|
282
282
|
|
|
283
283
|
## Project information
|
|
284
284
|
|
|
285
|
-
- [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
286
|
-
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
287
|
-
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
288
|
-
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
289
|
-
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
285
|
+
- [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/README.md)
|
|
286
|
+
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/api.md)
|
|
287
|
+
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CHANGELOG.md)
|
|
288
|
+
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CODE_OF_CONDUCT.md)
|
|
289
|
+
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/SECURITY.md): report vulnerabilities privately to
|
|
290
290
|
**pdf2mp3@byraphaelmedeiros.com**.
|
|
291
|
-
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
291
|
+
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/LICENSE)
|
|
292
292
|
|
|
293
293
|
Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PDF2MP3 — Listen to text-based PDFs
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/pdf2mp3/)
|
|
4
|
-
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
4
|
+
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/LICENSE)
|
|
5
5
|
[](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.
|
|
25
|
+
[CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
31
|
+
See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
90
|
+
python -m pip install pdf2mp3==2.0.3
|
|
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.
|
|
98
|
+
Confirm that `--version` reports `2.0.3` 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.
|
|
100
|
+
[CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
156
|
+
[provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
162
|
+
transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
165
|
+
[historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
170
|
+
[the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
184
|
+
and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
210
|
+
git clone --branch v2.0.3 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.
|
|
220
|
+
For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
236
|
+
and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
242
|
-
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
243
|
-
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
244
|
-
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
245
|
-
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
241
|
+
- [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/README.md)
|
|
242
|
+
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/api.md)
|
|
243
|
+
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CHANGELOG.md)
|
|
244
|
+
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CODE_OF_CONDUCT.md)
|
|
245
|
+
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/SECURITY.md): report vulnerabilities privately to
|
|
246
246
|
**pdf2mp3@byraphaelmedeiros.com**.
|
|
247
|
-
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
247
|
+
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/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.
|
|
15
|
+
Documentation describes version 2.0.3. 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.
|
|
4
|
+
`2.0.3` 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.
|
|
4
|
-
`python -m pip install pdf2mp3==2.0.
|
|
3
|
+
This interface belongs to version `2.0.3`. Install it with
|
|
4
|
+
`python -m pip install pdf2mp3==2.0.3`, 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.
|
|
3
|
+
This guide applies to a `2.0.3` 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.
|
|
6
|
+
engine. This adapter is part of the optional `2.0.3` 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.
|
|
14
|
+
python -m pip install 'pdf2mp3[openai]==2.0.3'
|
|
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
|
|
32
|
-
|
|
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,12 @@ 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
|
+
|
|
119
127
|
## Evidence and failures
|
|
120
128
|
|
|
121
129
|
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
|
|
26
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
47
|
-
|
|
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.
|
|
3
|
+
Version `2.0.3` 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.
|
|
19
|
-
| gTTS | `python -m pip install 'pdf2mp3[gtts]==2.0.
|
|
20
|
-
| OpenAI | `python -m pip install 'pdf2mp3[openai]==2.0.
|
|
21
|
-
| pyttsx3 | `python -m pip install 'pdf2mp3[pyttsx3]==2.0.
|
|
18
|
+
| Edge (default) | `python -m pip install pdf2mp3==2.0.3` | Network and available Microsoft voices |
|
|
19
|
+
| gTTS | `python -m pip install 'pdf2mp3[gtts]==2.0.3'` | Network; Google speech endpoint |
|
|
20
|
+
| OpenAI | `python -m pip install 'pdf2mp3[openai]==2.0.3'` | 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.3'` | 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.
|
|
81
|
+
__version__ = "2.0.3"
|
|
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.
|
|
3
|
+
Version: 2.0.3
|
|
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,13 +25,13 @@ 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.
|
|
28
|
+
Requires-Dist: pytest-asyncio==1.5.0; extra == "dev"
|
|
29
29
|
Requires-Dist: reportlab==5.1.0; extra == "dev"
|
|
30
30
|
Requires-Dist: pytest-socket==0.8.1; extra == "dev"
|
|
31
31
|
Requires-Dist: pytest-timeout==2.4.0; extra == "dev"
|
|
32
32
|
Requires-Dist: hypothesis==6.168.5; extra == "dev"
|
|
33
33
|
Requires-Dist: coverage==7.16.2; extra == "dev"
|
|
34
|
-
Requires-Dist: ruff==0.17.
|
|
34
|
+
Requires-Dist: ruff==0.17.6; extra == "dev"
|
|
35
35
|
Requires-Dist: mypy==2.4.1; extra == "dev"
|
|
36
36
|
Requires-Dist: bandit==1.9.4; extra == "dev"
|
|
37
37
|
Requires-Dist: detect-secrets==1.5.0; extra == "dev"
|
|
@@ -45,7 +45,7 @@ Dynamic: license-file
|
|
|
45
45
|
# PDF2MP3 — Listen to text-based PDFs
|
|
46
46
|
|
|
47
47
|
[](https://pypi.org/project/pdf2mp3/)
|
|
48
|
-
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
48
|
+
[](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/LICENSE)
|
|
49
49
|
[](https://github.com/byraphaelmedeiros/pdf2mp3/actions)
|
|
50
50
|
|
|
51
51
|
PDF2MP3 is a Python command-line tool that turns the readable text in a PDF into
|
|
@@ -66,13 +66,13 @@ service; complex layouts may need preparation before conversion.
|
|
|
66
66
|
Version **2** introduces a redesigned CLI. The conversion and check examples
|
|
67
67
|
below require version 2. Version 1.0.0 uses `pdf2mp3 sample.pdf`, without
|
|
68
68
|
subcommands or JSON. See the
|
|
69
|
-
[CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
69
|
+
[CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/quality-gates.md).
|
|
70
70
|
|
|
71
71
|
## Requirements
|
|
72
72
|
|
|
73
73
|
- **Python 3.10+.** The configured test matrix covers 3.10–3.14. Version 2
|
|
74
74
|
includes a conditional audioop compatibility dependency for Python 3.13+.
|
|
75
|
-
See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
75
|
+
See [support details](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/support.md), including version 1.0.0's limits.
|
|
76
76
|
- **FFmpeg**, including `ffprobe`, must be available on your `PATH` for audio
|
|
77
77
|
decoding and MP3 export. Installing the Python package does not install FFmpeg.
|
|
78
78
|
- **An internet connection** is required for the default Edge voice service.
|
|
@@ -131,7 +131,7 @@ With the environment activated:
|
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
133
|
python -m pip install --upgrade pip
|
|
134
|
-
python -m pip install pdf2mp3==2.0.
|
|
134
|
+
python -m pip install pdf2mp3==2.0.3
|
|
135
135
|
pdf2mp3 --version
|
|
136
136
|
pdf2mp3 --help
|
|
137
137
|
python -m pdf2mp3 --help
|
|
@@ -139,9 +139,9 @@ python -m pdf2mp3 --help
|
|
|
139
139
|
|
|
140
140
|
Both commands invoke the same CLI. The console command is installed through
|
|
141
141
|
`pyproject.toml`; module execution is provided by `pdf2mp3/__main__.py`.
|
|
142
|
-
Confirm that `--version` reports `2.0.
|
|
142
|
+
Confirm that `--version` reports `2.0.3` before using these examples. Upgrading
|
|
143
143
|
from version 1 requires the new `convert`/`check` syntax. Follow the
|
|
144
|
-
[CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
144
|
+
[CLI migration contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) when updating existing scripts.
|
|
145
145
|
|
|
146
146
|
If `pdf2mp3` is not found, activate the environment where you installed it or use
|
|
147
147
|
`python -m pdf2mp3` with that environment's Python interpreter.
|
|
@@ -197,21 +197,21 @@ output names when trying several examples on the same sample.
|
|
|
197
197
|
| `-h`, `--help` | Display help (`convert --help` for provider options) | — |
|
|
198
198
|
|
|
199
199
|
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.
|
|
200
|
+
[provider installation and requirements](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/support.md) before using them.
|
|
201
201
|
Remote adapters send text to their respective services; OpenAI requires an API
|
|
202
202
|
key and may incur charges. Local adapters depend on installed system voices.
|
|
203
203
|
Automated adapter tests use synthetic responses and do not certify live voice availability.
|
|
204
204
|
The OpenAI adapter now uses Realtime with `gpt-realtime-2.1-mini`, receives PCM
|
|
205
205
|
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.
|
|
206
|
+
transcripts. See [OpenAI setup, limitations and migration](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/openai.md);
|
|
207
207
|
this integration has offline evidence, not live API validation.
|
|
208
208
|
The gTTS extra retains a Click version constraint and a
|
|
209
|
-
[historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
209
|
+
[historical, now withdrawn security advisory](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/SECURITY.md#known-development-dependency-finding).
|
|
210
210
|
Current audits no longer report it; no dependency override or security exemption is used.
|
|
211
211
|
Use `convert --help` to inspect provider options. `--voice` selects Edge,
|
|
212
212
|
OpenAI or local voices; `--model` applies only to OpenAI. gTTS uses `--lang`.
|
|
213
213
|
Irrelevant provider options are rejected before processing. See
|
|
214
|
-
[the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
214
|
+
[the CLI contract](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md) for stable exit codes and migration details.
|
|
215
215
|
|
|
216
216
|
## Check before converting
|
|
217
217
|
|
|
@@ -225,7 +225,7 @@ does not synthesize speech, contact voice services or write files. It reports
|
|
|
225
225
|
configuration, text/chunk counts and whether conversion would send text
|
|
226
226
|
externally. Passing this check does not establish remote voice availability or
|
|
227
227
|
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.
|
|
228
|
+
and diagnostics go to stderr. See the [CLI guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/cli.md).
|
|
229
229
|
|
|
230
230
|
## Limits and troubleshooting
|
|
231
231
|
|
|
@@ -251,7 +251,7 @@ To install the release source, create and activate a separate Python 3.12
|
|
|
251
251
|
environment as above, then:
|
|
252
252
|
|
|
253
253
|
```bash
|
|
254
|
-
git clone --branch v2.0.
|
|
254
|
+
git clone --branch v2.0.3 https://github.com/byraphaelmedeiros/pdf2mp3.git
|
|
255
255
|
cd pdf2mp3
|
|
256
256
|
python -m pip install .
|
|
257
257
|
pdf2mp3 --help
|
|
@@ -261,7 +261,7 @@ python -m pdf2mp3 --help
|
|
|
261
261
|
`python -m pip install .` installs the package and its declared base dependencies.
|
|
262
262
|
The repository's requirement files now delegate to that same package metadata;
|
|
263
263
|
`requirements-dev.txt` also installs the pinned QA tools.
|
|
264
|
-
For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
264
|
+
For contributor setup, see [CONTRIBUTING.md](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CONTRIBUTING.md).
|
|
265
265
|
|
|
266
266
|
### Try the synthetic demo
|
|
267
267
|
|
|
@@ -277,17 +277,17 @@ pdf2mp3 convert local/inputs/demo.pdf --output local/outputs/demo-edge.mp3
|
|
|
277
277
|
The first command creates `local/inputs/demo.pdf` with synthetic Brazilian Portuguese text;
|
|
278
278
|
it refuses to replace an existing file. The conversion sends only this sample
|
|
279
279
|
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.
|
|
280
|
+
and Windows validation steps, see [the local demo guide](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/local-demo.md).
|
|
281
281
|
Generated demo PDFs and MP3s stay local and are ignored by Git.
|
|
282
282
|
|
|
283
283
|
## Project information
|
|
284
284
|
|
|
285
|
-
- [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
286
|
-
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
287
|
-
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
288
|
-
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
289
|
-
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
285
|
+
- [Documentation](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/README.md)
|
|
286
|
+
- [Python API reference](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/docs/api.md)
|
|
287
|
+
- [Changelog](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CHANGELOG.md)
|
|
288
|
+
- [Contributing](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CONTRIBUTING.md) and [Code of Conduct](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/CODE_OF_CONDUCT.md)
|
|
289
|
+
- [Security policy](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/SECURITY.md): report vulnerabilities privately to
|
|
290
290
|
**pdf2mp3@byraphaelmedeiros.com**.
|
|
291
|
-
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.
|
|
291
|
+
- [MIT license](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.3/LICENSE)
|
|
292
292
|
|
|
293
293
|
Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
|
|
@@ -9,13 +9,13 @@ 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.
|
|
12
|
+
pytest-asyncio==1.5.0
|
|
13
13
|
reportlab==5.1.0
|
|
14
14
|
pytest-socket==0.8.1
|
|
15
15
|
pytest-timeout==2.4.0
|
|
16
16
|
hypothesis==6.168.5
|
|
17
17
|
coverage==7.16.2
|
|
18
|
-
ruff==0.17.
|
|
18
|
+
ruff==0.17.6
|
|
19
19
|
mypy==2.4.1
|
|
20
20
|
bandit==1.9.4
|
|
21
21
|
detect-secrets==1.5.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pdf2mp3"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.3"
|
|
8
8
|
description = "Convert PDFs to MP3 audiobooks using Microsoft Edge neural voices."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -28,9 +28,9 @@ 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.
|
|
31
|
+
"pip==26.3", "pytest==9.2.0", "pytest-asyncio==1.5.0", "reportlab==5.1.0",
|
|
32
32
|
"pytest-socket==0.8.1", "pytest-timeout==2.4.0", "hypothesis==6.168.5",
|
|
33
|
-
"coverage==7.16.2", "ruff==0.17.
|
|
33
|
+
"coverage==7.16.2", "ruff==0.17.6", "mypy==2.4.1",
|
|
34
34
|
"bandit==1.9.4", "detect-secrets==1.5.0", "pip-audit==2.10.1",
|
|
35
35
|
"pip-licenses==5.5.5", "mutmut==3.8.1; sys_platform != 'win32'",
|
|
36
36
|
"build==1.6.1", "twine==7.0.0"
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
],
|
|
8
8
|
"packages": {
|
|
9
9
|
"certifi": ["Mozilla Public License 2.0 (MPL 2.0)", "MPL-2.0"],
|
|
10
|
-
"edge-tts": [
|
|
10
|
+
"edge-tts": [
|
|
11
|
+
"GNU Lesser General Public License v3 (LGPLv3)", "LGPL-3.0-only", "LGPL-3.0-only AND MIT"
|
|
12
|
+
],
|
|
11
13
|
"pyttsx3": ["MPL-2.0"],
|
|
12
14
|
"tqdm": ["MPL-2.0 AND MIT"]
|
|
13
15
|
}
|
|
@@ -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
|
|
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(
|
|
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
|
-
|
|
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.
|
|
160
|
+
assert captured.out.startswith("pdf2mp3 2.0.3" 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,18 @@ 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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
@pytest.mark.parametrize(
|
|
159
|
+
"expression",
|
|
160
|
+
["GNU Lesser General Public License v3 (LGPLv3)", "LGPL-3.0-only", "LGPL-3.0-only AND MIT"],
|
|
161
|
+
)
|
|
162
|
+
def test_copyleft_license_acceptance_is_package_scoped(expression):
|
|
163
|
+
policy_path = Path(__file__).resolve().parents[1] / "scripts" / "approved-licenses.json"
|
|
164
|
+
policy = json.loads(policy_path.read_text(encoding="utf-8"))
|
|
165
|
+
report = [{"Name": "edge-tts", "License": expression}]
|
|
166
|
+
assert check_licenses(report, policy["licenses"], policy["packages"]) == 1
|
|
167
|
+
report[0]["Name"] = "other"
|
|
168
|
+
with pytest.raises(ValueError, match="license needs review: other"):
|
|
169
|
+
check_licenses(report, policy["licenses"], policy["packages"])
|
|
160
170
|
|
|
161
171
|
|
|
162
172
|
def test_command_stdout_is_separate_from_warnings(tmp_path, monkeypatch):
|
|
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
|
|
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
|