pdf2mp3 2.0.1__tar.gz → 2.0.2__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.1 → pdf2mp3-2.0.2}/CHANGELOG.md +15 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/PKG-INFO +29 -29
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/README.md +20 -20
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/README.md +1 -1
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/api.md +1 -1
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/cli.md +2 -2
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/local-demo.md +1 -1
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/openai.md +2 -2
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/support.md +8 -5
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/pdf2mp3.py +37 -28
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/PKG-INFO +29 -29
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/requires.txt +8 -8
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pyproject.toml +5 -5
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_cli_v2.py +1 -1
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_providers.py +58 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/CODE_OF_CONDUCT.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/CONTRIBUTING.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/LICENSE +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/MANIFEST.in +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/SECURITY.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/contracts.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/quality-gates.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/docs/releasing.md +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/__init__.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/__main__.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/cli.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/openai_tts.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3/text.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/SOURCES.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/dependency_links.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/entry_points.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pdf2mp3.egg-info/top_level.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/pytest.ini +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/requirements-dev.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/requirements.txt +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/approved-licenses.json +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/create_demo_pdf.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/documentation_check.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/mutation-triage.json +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/network_guard.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/openai_check.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/package_check.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/performance_check.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/quality.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/quality_checks.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/release_check.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/scripts/scan_secrets.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/setup.cfg +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/conftest.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_cli.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_cli_contract.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_demo.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_documentation.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_integration.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_lang.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_network_guard.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_openai_realtime.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_quality_checks.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_release_source.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_text.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_text_contract.py +0 -0
- {pdf2mp3-2.0.1 → pdf2mp3-2.0.2}/tests/test_tts.py +0 -0
|
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [2.0.2] - 2026-11-16
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix pyttsx3 conversion on macOS by decoding AIFF audio and processing all
|
|
12
|
+
chunks in one speech loop.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Allow PyObjC 13 for the optional pyttsx3 engine on macOS. Python 3.10
|
|
16
|
+
continues to resolve a compatible earlier version of PyObjC.
|
|
17
|
+
- Update the development-only tools to pip 26.3, pytest 9.2.0, pytest-asyncio
|
|
18
|
+
1.4.1.post1, ReportLab 5.1.0, Ruff 0.17.3, mypy 2.4.1, and mutmut 3.8.1.
|
|
19
|
+
- Update the Python setup action to 7.1.0 and refresh the pinned PyPI publishing
|
|
20
|
+
action.
|
|
21
|
+
|
|
7
22
|
## [2.0.1] - 2026-10-10
|
|
8
23
|
### Fixed
|
|
9
24
|
- Update the optional developer environment to pytest 9.1.1 and pytest-asyncio
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdf2mp3
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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>
|
|
@@ -21,23 +21,23 @@ Provides-Extra: openai
|
|
|
21
21
|
Requires-Dist: openai[realtime]<4,>=3.26.1; extra == "openai"
|
|
22
22
|
Provides-Extra: pyttsx3
|
|
23
23
|
Requires-Dist: pyttsx3<3,>=2.90; extra == "pyttsx3"
|
|
24
|
-
Requires-Dist: pyobjc<
|
|
24
|
+
Requires-Dist: pyobjc<14,>=10.3.1; sys_platform == "darwin" and extra == "pyttsx3"
|
|
25
25
|
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pip==26.
|
|
27
|
-
Requires-Dist: pytest==9.
|
|
28
|
-
Requires-Dist: pytest-asyncio==1.4.
|
|
29
|
-
Requires-Dist: reportlab==
|
|
26
|
+
Requires-Dist: pip==26.3; extra == "dev"
|
|
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"
|
|
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.
|
|
35
|
-
Requires-Dist: mypy==2.4.
|
|
34
|
+
Requires-Dist: ruff==0.17.3; extra == "dev"
|
|
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"
|
|
38
38
|
Requires-Dist: pip-audit==2.10.1; extra == "dev"
|
|
39
39
|
Requires-Dist: pip-licenses==5.5.5; extra == "dev"
|
|
40
|
-
Requires-Dist: mutmut==3.8.
|
|
40
|
+
Requires-Dist: mutmut==3.8.1; sys_platform != "win32" and extra == "dev"
|
|
41
41
|
Requires-Dist: build==1.6.1; extra == "dev"
|
|
42
42
|
Requires-Dist: twine==7.0.0; extra == "dev"
|
|
43
43
|
Dynamic: license-file
|
|
@@ -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.2/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.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/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.2/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.2
|
|
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.2` 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.2/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.2/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.2/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.2/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.2/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.2/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.2 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.2/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.2/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.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
|
|
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.2/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.2/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.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/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.2/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.2
|
|
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.2` 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.2/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.2/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.2/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.2/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.2/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.2/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.2 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.2/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.2/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.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
|
|
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.2/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.2. 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.2` 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.2`. Install it with
|
|
4
|
+
`python -m pip install pdf2mp3==2.0.2`, 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.2` 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.2` 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.2'
|
|
15
15
|
pdf2mp3 convert --help
|
|
16
16
|
pdf2mp3 check --engine openai --json
|
|
17
17
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Python and platform support
|
|
2
2
|
|
|
3
|
-
Version `2.0.
|
|
3
|
+
Version `2.0.2` 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,12 +15,15 @@ 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.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 |
|
|
22
22
|
| macOS say | Base package | macOS `say` and installed voices |
|
|
23
23
|
|
|
24
|
+
On macOS, the pyttsx3 extra permits PyObjC 13 on compatible Python versions.
|
|
25
|
+
With Python 3.10, pip resolves a compatible earlier version of PyObjC.
|
|
26
|
+
|
|
24
27
|
Base wheel/sdist installation, command help and synthetic conversions are checked
|
|
25
28
|
separately from optional-extra resolution and adapter contracts. Real provider
|
|
26
29
|
and system voice smoke tests are opt-in, require explicit authorization and must
|
|
@@ -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.2"
|
|
82
82
|
|
|
83
83
|
# ---- Recommended female voices (unchanged logic/values) ----
|
|
84
84
|
VOICE_BY_LANG = {
|
|
@@ -243,8 +243,9 @@ def synthesize_chunks_pyttsx3(
|
|
|
243
243
|
except ImportError as exc:
|
|
244
244
|
raise RuntimeError("pyttsx3 is not installed. Run: pip install pyttsx3") from exc
|
|
245
245
|
|
|
246
|
+
is_macos = sys.platform == "darwin"
|
|
246
247
|
builtins_objc = None
|
|
247
|
-
if
|
|
248
|
+
if is_macos:
|
|
248
249
|
try:
|
|
249
250
|
import builtins
|
|
250
251
|
|
|
@@ -258,7 +259,7 @@ def synthesize_chunks_pyttsx3(
|
|
|
258
259
|
try:
|
|
259
260
|
engine = pyttsx3.init()
|
|
260
261
|
finally:
|
|
261
|
-
if
|
|
262
|
+
if is_macos and "builtins" in locals():
|
|
262
263
|
if builtins_objc is None:
|
|
263
264
|
try:
|
|
264
265
|
delattr(builtins, "objc")
|
|
@@ -275,32 +276,40 @@ def synthesize_chunks_pyttsx3(
|
|
|
275
276
|
raise RuntimeError("Requested pyttsx3 voice is not installed.")
|
|
276
277
|
|
|
277
278
|
full_audio = AudioSegment.empty()
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if not seg.raw_data:
|
|
289
|
-
raise RuntimeError("pyttsx3 returned empty audio; check the system voice engine")
|
|
290
|
-
except NameError as exc:
|
|
291
|
-
msg = str(exc)
|
|
292
|
-
if "objc" in msg.lower():
|
|
293
|
-
raise RuntimeError(
|
|
294
|
-
"pyttsx3 on macOS requires pyobjc. Run: pip install pyobjc"
|
|
295
|
-
) from exc
|
|
296
|
-
raise
|
|
297
|
-
finally:
|
|
279
|
+
if not chunks:
|
|
280
|
+
return full_audio
|
|
281
|
+
# The macOS driver writes AIFF and can return empty audio when restarted per chunk.
|
|
282
|
+
indexed_chunks = enumerate(chunks, start=1)
|
|
283
|
+
batches = (indexed_chunks,) if is_macos else ((chunk,) for chunk in indexed_chunks)
|
|
284
|
+
suffix = ".aiff" if is_macos else ".wav"
|
|
285
|
+
audio_format = None if is_macos else "wav"
|
|
286
|
+
for batch in batches:
|
|
287
|
+
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as directory:
|
|
288
|
+
paths = []
|
|
298
289
|
try:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
290
|
+
for idx, chunk in batch:
|
|
291
|
+
logging.getLogger("pdf2mp3").info(
|
|
292
|
+
"TTS chunk %d/%d (%d characters)", idx, len(chunks), len(chunk)
|
|
293
|
+
)
|
|
294
|
+
path = Path(directory) / f"{idx}{suffix}"
|
|
295
|
+
path.touch()
|
|
296
|
+
paths.append(path)
|
|
297
|
+
engine.save_to_file(chunk, str(path))
|
|
298
|
+
engine.runAndWait()
|
|
299
|
+
for path in paths:
|
|
300
|
+
segment = AudioSegment.from_file(path, format=audio_format)
|
|
301
|
+
if not segment.raw_data:
|
|
302
|
+
raise RuntimeError(
|
|
303
|
+
"pyttsx3 returned empty audio; check the system voice engine"
|
|
304
|
+
)
|
|
305
|
+
full_audio += segment
|
|
306
|
+
full_audio += AudioSegment.silent(duration=pause_ms)
|
|
307
|
+
except NameError as exc:
|
|
308
|
+
if "objc" in str(exc).lower():
|
|
309
|
+
raise RuntimeError(
|
|
310
|
+
"pyttsx3 on macOS requires pyobjc. Run: pip install pyobjc"
|
|
311
|
+
) from exc
|
|
312
|
+
raise
|
|
304
313
|
return full_audio
|
|
305
314
|
|
|
306
315
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdf2mp3
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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>
|
|
@@ -21,23 +21,23 @@ Provides-Extra: openai
|
|
|
21
21
|
Requires-Dist: openai[realtime]<4,>=3.26.1; extra == "openai"
|
|
22
22
|
Provides-Extra: pyttsx3
|
|
23
23
|
Requires-Dist: pyttsx3<3,>=2.90; extra == "pyttsx3"
|
|
24
|
-
Requires-Dist: pyobjc<
|
|
24
|
+
Requires-Dist: pyobjc<14,>=10.3.1; sys_platform == "darwin" and extra == "pyttsx3"
|
|
25
25
|
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: pip==26.
|
|
27
|
-
Requires-Dist: pytest==9.
|
|
28
|
-
Requires-Dist: pytest-asyncio==1.4.
|
|
29
|
-
Requires-Dist: reportlab==
|
|
26
|
+
Requires-Dist: pip==26.3; extra == "dev"
|
|
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"
|
|
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.
|
|
35
|
-
Requires-Dist: mypy==2.4.
|
|
34
|
+
Requires-Dist: ruff==0.17.3; extra == "dev"
|
|
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"
|
|
38
38
|
Requires-Dist: pip-audit==2.10.1; extra == "dev"
|
|
39
39
|
Requires-Dist: pip-licenses==5.5.5; extra == "dev"
|
|
40
|
-
Requires-Dist: mutmut==3.8.
|
|
40
|
+
Requires-Dist: mutmut==3.8.1; sys_platform != "win32" and extra == "dev"
|
|
41
41
|
Requires-Dist: build==1.6.1; extra == "dev"
|
|
42
42
|
Requires-Dist: twine==7.0.0; extra == "dev"
|
|
43
43
|
Dynamic: license-file
|
|
@@ -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.2/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.2/docs/cli.md) and [quality gates](https://github.com/byraphaelmedeiros/pdf2mp3/blob/v2.0.2/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.2/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.2
|
|
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.2` 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.2/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.2/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.2/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.2/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.2/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.2/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.2 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.2/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.2/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.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
|
|
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.2/LICENSE)
|
|
292
292
|
|
|
293
293
|
Maintained by [Raphael Medeiros](https://github.com/byraphaelmedeiros).
|
|
@@ -7,16 +7,16 @@ tqdm<5.0.0,>=4.67.1
|
|
|
7
7
|
audioop-lts<0.3,>=0.2.2
|
|
8
8
|
|
|
9
9
|
[dev]
|
|
10
|
-
pip==26.
|
|
11
|
-
pytest==9.
|
|
12
|
-
pytest-asyncio==1.4.
|
|
13
|
-
reportlab==
|
|
10
|
+
pip==26.3
|
|
11
|
+
pytest==9.2.0
|
|
12
|
+
pytest-asyncio==1.4.1.post1
|
|
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.
|
|
19
|
-
mypy==2.4.
|
|
18
|
+
ruff==0.17.3
|
|
19
|
+
mypy==2.4.1
|
|
20
20
|
bandit==1.9.4
|
|
21
21
|
detect-secrets==1.5.0
|
|
22
22
|
pip-audit==2.10.1
|
|
@@ -25,7 +25,7 @@ build==1.6.1
|
|
|
25
25
|
twine==7.0.0
|
|
26
26
|
|
|
27
27
|
[dev:sys_platform != "win32"]
|
|
28
|
-
mutmut==3.8.
|
|
28
|
+
mutmut==3.8.1
|
|
29
29
|
|
|
30
30
|
[gtts]
|
|
31
31
|
gTTS<3,>=2.5.3
|
|
@@ -37,4 +37,4 @@ openai[realtime]<4,>=3.26.1
|
|
|
37
37
|
pyttsx3<3,>=2.90
|
|
38
38
|
|
|
39
39
|
[pyttsx3:sys_platform == "darwin"]
|
|
40
|
-
pyobjc<
|
|
40
|
+
pyobjc<14,>=10.3.1
|
|
@@ -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.2"
|
|
8
8
|
description = "Convert PDFs to MP3 audiobooks using Microsoft Edge neural voices."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -25,14 +25,14 @@ gtts = ["gTTS>=2.5.3,<3"]
|
|
|
25
25
|
openai = ["openai[realtime]>=3.26.1,<4"]
|
|
26
26
|
pyttsx3 = [
|
|
27
27
|
"pyttsx3>=2.90,<3",
|
|
28
|
-
"pyobjc>=10.3.1,<
|
|
28
|
+
"pyobjc>=10.3.1,<14; sys_platform == 'darwin'"
|
|
29
29
|
]
|
|
30
30
|
dev = [
|
|
31
|
-
"pip==26.
|
|
31
|
+
"pip==26.3", "pytest==9.2.0", "pytest-asyncio==1.4.1.post1", "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.
|
|
33
|
+
"coverage==7.16.2", "ruff==0.17.3", "mypy==2.4.1",
|
|
34
34
|
"bandit==1.9.4", "detect-secrets==1.5.0", "pip-audit==2.10.1",
|
|
35
|
-
"pip-licenses==5.5.5", "mutmut==3.8.
|
|
35
|
+
"pip-licenses==5.5.5", "mutmut==3.8.1; sys_platform != 'win32'",
|
|
36
36
|
"build==1.6.1", "twine==7.0.0"
|
|
37
37
|
]
|
|
38
38
|
|
|
@@ -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.2" if args == ["--version"] else "usage: pdf2mp3")
|
|
161
161
|
assert not captured.err
|
|
162
162
|
|
|
163
163
|
|
|
@@ -8,6 +8,7 @@ from types import SimpleNamespace
|
|
|
8
8
|
|
|
9
9
|
import pytest
|
|
10
10
|
from pydub import AudioSegment
|
|
11
|
+
from pydub.generators import Sine
|
|
11
12
|
|
|
12
13
|
import pdf2mp3.pdf2mp3 as app
|
|
13
14
|
from pdf2mp3 import cli
|
|
@@ -113,6 +114,7 @@ def test_local_engine_voice_selection_audio_and_cleanup(monkeypatch, platform, v
|
|
|
113
114
|
assert builtins.objc is original_objc
|
|
114
115
|
else:
|
|
115
116
|
assert not hasattr(builtins, "objc")
|
|
117
|
+
assert len(app.synthesize_chunks_pyttsx3([], voice)) == 0
|
|
116
118
|
|
|
117
119
|
|
|
118
120
|
@pytest.mark.parametrize("message", ["objc unavailable", "other failure"])
|
|
@@ -132,6 +134,62 @@ def test_local_engine_failure_cleans_file(monkeypatch, message):
|
|
|
132
134
|
assert paths and not paths[0].exists()
|
|
133
135
|
|
|
134
136
|
|
|
137
|
+
@pytest.mark.parametrize("second_duration", [100, 0])
|
|
138
|
+
def test_pyttsx3_macos_converts_aiff_to_mp3(
|
|
139
|
+
monkeypatch, synthetic_pdf, invoke, tmp_path, second_duration
|
|
140
|
+
):
|
|
141
|
+
queued = []
|
|
142
|
+
runs = []
|
|
143
|
+
|
|
144
|
+
def save(text, path):
|
|
145
|
+
queued.append((text, Path(path)))
|
|
146
|
+
|
|
147
|
+
def run_and_wait():
|
|
148
|
+
runs.append(len(queued))
|
|
149
|
+
for (_, path), duration in zip(queued, (100, second_duration), strict=True):
|
|
150
|
+
Sine(440).to_audio_segment(duration=duration).export(path, format="aiff").close()
|
|
151
|
+
|
|
152
|
+
monkeypatch.setattr(app.sys, "platform", "darwin")
|
|
153
|
+
# The simulated platform changes executable discovery on Windows.
|
|
154
|
+
monkeypatch.setattr(
|
|
155
|
+
cli, "_dependencies", lambda args: [{"name": "synthetic local engine", "ok": True}]
|
|
156
|
+
)
|
|
157
|
+
monkeypatch.setitem(sys.modules, "objc", SimpleNamespace())
|
|
158
|
+
engine = SimpleNamespace(save_to_file=save, runAndWait=run_and_wait)
|
|
159
|
+
monkeypatch.setitem(sys.modules, "pyttsx3", SimpleNamespace(init=lambda: engine))
|
|
160
|
+
output = tmp_path / "synthetic.mp3"
|
|
161
|
+
original = synthetic_pdf.read_bytes()
|
|
162
|
+
previous = b"previous synthetic audio"
|
|
163
|
+
output.write_bytes(previous)
|
|
164
|
+
|
|
165
|
+
result = invoke(
|
|
166
|
+
"convert",
|
|
167
|
+
synthetic_pdf,
|
|
168
|
+
"--engine",
|
|
169
|
+
"pyttsx3",
|
|
170
|
+
"--max-chars",
|
|
171
|
+
28,
|
|
172
|
+
"-o",
|
|
173
|
+
output,
|
|
174
|
+
"--overwrite",
|
|
175
|
+
)
|
|
176
|
+
if second_duration:
|
|
177
|
+
assert result == 0
|
|
178
|
+
audio = AudioSegment.from_mp3(output)
|
|
179
|
+
assert 420 <= len(audio) <= 470
|
|
180
|
+
assert audio.rms > 0
|
|
181
|
+
else:
|
|
182
|
+
assert result == 5
|
|
183
|
+
assert output.read_bytes() == previous
|
|
184
|
+
assert [text for text, _ in queued] == [
|
|
185
|
+
"Synthetic first sentence.",
|
|
186
|
+
"Synthetic second sentence.",
|
|
187
|
+
]
|
|
188
|
+
assert runs == [2]
|
|
189
|
+
assert synthetic_pdf.read_bytes() == original
|
|
190
|
+
assert all(not path.exists() for _, path in queued)
|
|
191
|
+
|
|
192
|
+
|
|
135
193
|
def test_pyttsx3_empty_audio_fails_and_preserves_input_and_output(
|
|
136
194
|
monkeypatch, synthetic_pdf, invoke, tmp_path, capsys
|
|
137
195
|
):
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|