sci2audio 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. sci2audio-1.0.0/.claude/rules/licences.md +11 -0
  2. sci2audio-1.0.0/.claude/rules/tests.md +40 -0
  3. sci2audio-1.0.0/.gitattributes +3 -0
  4. sci2audio-1.0.0/.github/ISSUE_TEMPLATE/bug.yml +29 -0
  5. sci2audio-1.0.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
  6. sci2audio-1.0.0/.github/ISSUE_TEMPLATE/feature.yml +30 -0
  7. sci2audio-1.0.0/.github/dependabot.yml +15 -0
  8. sci2audio-1.0.0/.github/lanes.yml +30 -0
  9. sci2audio-1.0.0/.github/pull_request_template.md +26 -0
  10. sci2audio-1.0.0/.github/workflows/ci.yml +149 -0
  11. sci2audio-1.0.0/.github/workflows/mutation.yml +32 -0
  12. sci2audio-1.0.0/.github/workflows/nightly.yml +127 -0
  13. sci2audio-1.0.0/.github/workflows/release.yml +165 -0
  14. sci2audio-1.0.0/.github/workflows/zap.yml +68 -0
  15. sci2audio-1.0.0/.gitignore +32 -0
  16. sci2audio-1.0.0/.pre-commit-config.yaml +22 -0
  17. sci2audio-1.0.0/.python-version +1 -0
  18. sci2audio-1.0.0/CHANGELOG.md +86 -0
  19. sci2audio-1.0.0/CLAUDE.md +68 -0
  20. sci2audio-1.0.0/CONTRIBUTING.md +49 -0
  21. sci2audio-1.0.0/LICENSE +674 -0
  22. sci2audio-1.0.0/PKG-INFO +171 -0
  23. sci2audio-1.0.0/README.md +129 -0
  24. sci2audio-1.0.0/THIRD_PARTY_LICENSES.md +86 -0
  25. sci2audio-1.0.0/docs/baseline.md +106 -0
  26. sci2audio-1.0.0/docs/learning/phase-template.md +12 -0
  27. sci2audio-1.0.0/docs/learning/v1.0.md +39 -0
  28. sci2audio-1.0.0/docs/listening-tests/1.0.0.md +50 -0
  29. sci2audio-1.0.0/docs/listening-tests/template.md +35 -0
  30. sci2audio-1.0.0/docs/readalong-format.md +61 -0
  31. sci2audio-1.0.0/docs/release-checklist.md +27 -0
  32. sci2audio-1.0.0/pyproject.toml +190 -0
  33. sci2audio-1.0.0/scripts/release_smoke.sh +28 -0
  34. sci2audio-1.0.0/scripts/speed.py +748 -0
  35. sci2audio-1.0.0/scripts/zap/accepted.toml +53 -0
  36. sci2audio-1.0.0/scripts/zap_scan.py +907 -0
  37. sci2audio-1.0.0/src/sci2audio/__init__.py +3 -0
  38. sci2audio-1.0.0/src/sci2audio/app/__init__.py +110 -0
  39. sci2audio-1.0.0/src/sci2audio/app/audio.py +847 -0
  40. sci2audio-1.0.0/src/sci2audio/app/chapters.py +109 -0
  41. sci2audio-1.0.0/src/sci2audio/app/chunks.py +102 -0
  42. sci2audio-1.0.0/src/sci2audio/app/config.py +136 -0
  43. sci2audio-1.0.0/src/sci2audio/app/estimate.py +192 -0
  44. sci2audio-1.0.0/src/sci2audio/app/files.py +98 -0
  45. sci2audio-1.0.0/src/sci2audio/app/job.py +285 -0
  46. sci2audio-1.0.0/src/sci2audio/app/lock.py +92 -0
  47. sci2audio-1.0.0/src/sci2audio/app/report.py +400 -0
  48. sci2audio-1.0.0/src/sci2audio/app/runner.py +92 -0
  49. sci2audio-1.0.0/src/sci2audio/app/script.py +95 -0
  50. sci2audio-1.0.0/src/sci2audio/app/settings.py +58 -0
  51. sci2audio-1.0.0/src/sci2audio/app/voice.py +70 -0
  52. sci2audio-1.0.0/src/sci2audio/cli.py +1013 -0
  53. sci2audio-1.0.0/src/sci2audio/core/__init__.py +81 -0
  54. sci2audio-1.0.0/src/sci2audio/core/audio.py +39 -0
  55. sci2audio-1.0.0/src/sci2audio/core/content.py +266 -0
  56. sci2audio-1.0.0/src/sci2audio/core/document.py +225 -0
  57. sci2audio-1.0.0/src/sci2audio/core/edits.py +121 -0
  58. sci2audio-1.0.0/src/sci2audio/core/export.py +76 -0
  59. sci2audio-1.0.0/src/sci2audio/extraction/__init__.py +28 -0
  60. sci2audio-1.0.0/src/sci2audio/extraction/cover.py +68 -0
  61. sci2audio-1.0.0/src/sci2audio/extraction/epub.py +576 -0
  62. sci2audio-1.0.0/src/sci2audio/extraction/errors.py +7 -0
  63. sci2audio-1.0.0/src/sci2audio/extraction/markdown.py +250 -0
  64. sci2audio-1.0.0/src/sci2audio/extraction/markup.py +356 -0
  65. sci2audio-1.0.0/src/sci2audio/extraction/pdf.py +623 -0
  66. sci2audio-1.0.0/src/sci2audio/extraction/text.py +136 -0
  67. sci2audio-1.0.0/src/sci2audio/layout/__init__.py +13 -0
  68. sci2audio-1.0.0/src/sci2audio/layout/build.py +265 -0
  69. sci2audio-1.0.0/src/sci2audio/layout/captions.py +77 -0
  70. sci2audio-1.0.0/src/sci2audio/layout/footnotes.py +180 -0
  71. sci2audio-1.0.0/src/sci2audio/layout/formulas.py +392 -0
  72. sci2audio-1.0.0/src/sci2audio/layout/furniture.py +326 -0
  73. sci2audio-1.0.0/src/sci2audio/layout/geometry.py +124 -0
  74. sci2audio-1.0.0/src/sci2audio/layout/graphics.py +569 -0
  75. sci2audio-1.0.0/src/sci2audio/layout/headings.py +358 -0
  76. sci2audio-1.0.0/src/sci2audio/layout/lists.py +167 -0
  77. sci2audio-1.0.0/src/sci2audio/layout/maths.py +47 -0
  78. sci2audio-1.0.0/src/sci2audio/layout/order.py +374 -0
  79. sci2audio-1.0.0/src/sci2audio/layout/paragraphs.py +518 -0
  80. sci2audio-1.0.0/src/sci2audio/layout/settings.py +142 -0
  81. sci2audio-1.0.0/src/sci2audio/layout/split.py +113 -0
  82. sci2audio-1.0.0/src/sci2audio/layout/tagged.py +442 -0
  83. sci2audio-1.0.0/src/sci2audio/output/__init__.py +44 -0
  84. sci2audio-1.0.0/src/sci2audio/output/ffmpeg.py +111 -0
  85. sci2audio-1.0.0/src/sci2audio/output/model.py +125 -0
  86. sci2audio-1.0.0/src/sci2audio/output/names.py +70 -0
  87. sci2audio-1.0.0/src/sci2audio/output/readalong.py +160 -0
  88. sci2audio-1.0.0/src/sci2audio/output/timeline.py +113 -0
  89. sci2audio-1.0.0/src/sci2audio/output/wav.py +83 -0
  90. sci2audio-1.0.0/src/sci2audio/output/write.py +280 -0
  91. sci2audio-1.0.0/src/sci2audio/testing/__init__.py +32 -0
  92. sci2audio-1.0.0/src/sci2audio/testing/documents.py +124 -0
  93. sci2audio-1.0.0/src/sci2audio/testing/regression.py +197 -0
  94. sci2audio-1.0.0/src/sci2audio/testing/text_steps.py +262 -0
  95. sci2audio-1.0.0/src/sci2audio/testing/voices.py +164 -0
  96. sci2audio-1.0.0/src/sci2audio/textprep/__init__.py +105 -0
  97. sci2audio-1.0.0/src/sci2audio/textprep/abbreviations.py +138 -0
  98. sci2audio-1.0.0/src/sci2audio/textprep/characters.py +267 -0
  99. sci2audio-1.0.0/src/sci2audio/textprep/citations.py +683 -0
  100. sci2audio-1.0.0/src/sci2audio/textprep/data/en/abbreviations.toml +209 -0
  101. sci2audio-1.0.0/src/sci2audio/textprep/data/en/units.toml +548 -0
  102. sci2audio-1.0.0/src/sci2audio/textprep/footnotes.py +418 -0
  103. sci2audio-1.0.0/src/sci2audio/textprep/furniture.py +46 -0
  104. sci2audio-1.0.0/src/sci2audio/textprep/hyphens.py +228 -0
  105. sci2audio-1.0.0/src/sci2audio/textprep/links.py +628 -0
  106. sci2audio-1.0.0/src/sci2audio/textprep/notation.py +170 -0
  107. sci2audio-1.0.0/src/sci2audio/textprep/numbers.py +529 -0
  108. sci2audio-1.0.0/src/sci2audio/textprep/placeholders.py +68 -0
  109. sci2audio-1.0.0/src/sci2audio/textprep/references.py +107 -0
  110. sci2audio-1.0.0/src/sci2audio/textprep/registry.py +83 -0
  111. sci2audio-1.0.0/src/sci2audio/textprep/runner.py +206 -0
  112. sci2audio-1.0.0/src/sci2audio/textprep/spoken.py +33 -0
  113. sci2audio-1.0.0/src/sci2audio/textprep/statistics.py +322 -0
  114. sci2audio-1.0.0/src/sci2audio/textprep/steps.py +153 -0
  115. sci2audio-1.0.0/src/sci2audio/textprep/units.py +449 -0
  116. sci2audio-1.0.0/src/sci2audio/textprep/utterances.py +315 -0
  117. sci2audio-1.0.0/src/sci2audio/textprep/wording.py +93 -0
  118. sci2audio-1.0.0/src/sci2audio/textprep/wordlists.py +189 -0
  119. sci2audio-1.0.0/src/sci2audio/voices/__init__.py +102 -0
  120. sci2audio-1.0.0/src/sci2audio/voices/download.py +340 -0
  121. sci2audio-1.0.0/src/sci2audio/voices/engine.py +136 -0
  122. sci2audio-1.0.0/src/sci2audio/voices/errors.py +88 -0
  123. sci2audio-1.0.0/src/sci2audio/voices/kokoro_engine.py +346 -0
  124. sci2audio-1.0.0/src/sci2audio/voices/runtime.py +37 -0
  125. sci2audio-1.0.0/src/sci2audio/voices/types.py +206 -0
  126. sci2audio-1.0.0/src/sci2audio/voices/wav.py +82 -0
  127. sci2audio-1.0.0/src/sci2audio/web/__init__.py +13 -0
  128. sci2audio-1.0.0/src/sci2audio/web/api.py +658 -0
  129. sci2audio-1.0.0/src/sci2audio/web/config.py +97 -0
  130. sci2audio-1.0.0/src/sci2audio/web/documents.py +496 -0
  131. sci2audio-1.0.0/src/sci2audio/web/i18n.py +188 -0
  132. sci2audio-1.0.0/src/sci2audio/web/jobs.py +265 -0
  133. sci2audio-1.0.0/src/sci2audio/web/launch.py +121 -0
  134. sci2audio-1.0.0/src/sci2audio/web/limits.py +64 -0
  135. sci2audio-1.0.0/src/sci2audio/web/models.py +178 -0
  136. sci2audio-1.0.0/src/sci2audio/web/pages.py +509 -0
  137. sci2audio-1.0.0/src/sci2audio/web/player.py +549 -0
  138. sci2audio-1.0.0/src/sci2audio/web/security.py +194 -0
  139. sci2audio-1.0.0/src/sci2audio/web/server.py +116 -0
  140. sci2audio-1.0.0/src/sci2audio/web/state.py +88 -0
  141. sci2audio-1.0.0/src/sci2audio/web/static/app.css +150 -0
  142. sci2audio-1.0.0/src/sci2audio/web/static/app.js +499 -0
  143. sci2audio-1.0.0/src/sci2audio/web/static/player.js +277 -0
  144. sci2audio-1.0.0/src/sci2audio/web/strings/de.toml +348 -0
  145. sci2audio-1.0.0/src/sci2audio/web/strings/en.toml +343 -0
  146. sci2audio-1.0.0/src/sci2audio/web/tasks.py +280 -0
  147. sci2audio-1.0.0/src/sci2audio/web/templates/_remove.html +17 -0
  148. sci2audio-1.0.0/src/sci2audio/web/templates/base.html +32 -0
  149. sci2audio-1.0.0/src/sci2audio/web/templates/document.html +153 -0
  150. sci2audio-1.0.0/src/sci2audio/web/templates/index.html +41 -0
  151. sci2audio-1.0.0/src/sci2audio/web/templates/job.html +66 -0
  152. sci2audio-1.0.0/src/sci2audio/web/templates/listen.html +75 -0
  153. sci2audio-1.0.0/src/sci2audio/web/templates/missing.html +7 -0
  154. sci2audio-1.0.0/src/sci2audio/web/templates/privacy.html +47 -0
  155. sci2audio-1.0.0/src/sci2audio/web/templates/voice.html +31 -0
  156. sci2audio-1.0.0/tests/browser/conftest.py +225 -0
  157. sci2audio-1.0.0/tests/browser/test_axe.py +140 -0
  158. sci2audio-1.0.0/tests/browser/test_flow.py +394 -0
  159. sci2audio-1.0.0/tests/browser/test_german.py +316 -0
  160. sci2audio-1.0.0/tests/browser/test_keyboard.py +152 -0
  161. sci2audio-1.0.0/tests/browser/test_player.py +345 -0
  162. sci2audio-1.0.0/tests/browser/test_reflow.py +91 -0
  163. sci2audio-1.0.0/tests/browser/test_remove.py +144 -0
  164. sci2audio-1.0.0/tests/conftest.py +77 -0
  165. sci2audio-1.0.0/tests/corpus/LICENSES.md +25 -0
  166. sci2audio-1.0.0/tests/corpus/epub/wells-the-time-machine.epub +0 -0
  167. sci2audio-1.0.0/tests/corpus/markdown/sci2audio-sample-note.md +81 -0
  168. sci2audio-1.0.0/tests/corpus/papers/acl2023-chi-plue.pdf +0 -0
  169. sci2audio-1.0.0/tests/corpus/papers/acl2023-hardt-ellipsis.pdf +0 -0
  170. sci2audio-1.0.0/tests/corpus/papers/acl2023-nowak-prefix-probabilities.pdf +0 -0
  171. sci2audio-1.0.0/tests/corpus/papers/arxiv2024-arsiwalla-qualia-meaning.pdf +0 -0
  172. sci2audio-1.0.0/tests/corpus/papers/arxiv2024-liu-orbital-hall.pdf +0 -0
  173. sci2audio-1.0.0/tests/corpus/papers/joss2021-waskom-seaborn.pdf +0 -0
  174. sci2audio-1.0.0/tests/corpus/papers/joss2022-biggs-pymedphys.pdf +0 -0
  175. sci2audio-1.0.0/tests/corpus/text/sci2audio-sample-plain.txt +27 -0
  176. sci2audio-1.0.0/tests/corpus/truth/README.md +117 -0
  177. sci2audio-1.0.0/tests/corpus/truth/acl2023-chi-plue.toml +122 -0
  178. sci2audio-1.0.0/tests/corpus/truth/acl2023-hardt-ellipsis.toml +102 -0
  179. sci2audio-1.0.0/tests/corpus/truth/acl2023-nowak-prefix-probabilities.toml +119 -0
  180. sci2audio-1.0.0/tests/corpus/truth/arxiv2024-arsiwalla-qualia-meaning.toml +138 -0
  181. sci2audio-1.0.0/tests/corpus/truth/arxiv2024-liu-orbital-hall.toml +75 -0
  182. sci2audio-1.0.0/tests/corpus/truth/joss2021-waskom-seaborn.toml +77 -0
  183. sci2audio-1.0.0/tests/corpus/truth/joss2022-biggs-pymedphys.toml +67 -0
  184. sci2audio-1.0.0/tests/corpus/truth/sci2audio-sample-note.toml +46 -0
  185. sci2audio-1.0.0/tests/corpus/truth/sci2audio-sample-plain.toml +24 -0
  186. sci2audio-1.0.0/tests/corpus/truth/wells-the-time-machine.toml +18 -0
  187. sci2audio-1.0.0/tests/fixtures/README.md +28 -0
  188. sci2audio-1.0.0/tests/fixtures/broken/password-protected.pdf +32 -0
  189. sci2audio-1.0.0/tests/integration/prepare_models.py +41 -0
  190. sci2audio-1.0.0/tests/integration/test_audio_job.py +117 -0
  191. sci2audio-1.0.0/tests/integration/test_cli_end_to_end.py +206 -0
  192. sci2audio-1.0.0/tests/integration/test_voice_kokoro.py +299 -0
  193. sci2audio-1.0.0/tests/regression/english.toml +1223 -0
  194. sci2audio-1.0.0/tests/regression/german.toml +202 -0
  195. sci2audio-1.0.0/tests/regression/line-end-hyphens-en.toml +593 -0
  196. sci2audio-1.0.0/tests/unit/__snapshots__/test_app_audio_job.ambr +97 -0
  197. sci2audio-1.0.0/tests/unit/__snapshots__/test_app_corpus.ambr +6321 -0
  198. sci2audio-1.0.0/tests/unit/__snapshots__/test_cli_golden.ambr +211 -0
  199. sci2audio-1.0.0/tests/unit/__snapshots__/test_cli_script.ambr +14 -0
  200. sci2audio-1.0.0/tests/unit/__snapshots__/test_cli_voices.ambr +14 -0
  201. sci2audio-1.0.0/tests/unit/__snapshots__/test_core_content.ambr +254 -0
  202. sci2audio-1.0.0/tests/unit/__snapshots__/test_core_objects.ambr +493 -0
  203. sci2audio-1.0.0/tests/unit/__snapshots__/test_extraction_corpus.ambr +8053 -0
  204. sci2audio-1.0.0/tests/unit/__snapshots__/test_extraction_epub_corpus.ambr +416 -0
  205. sci2audio-1.0.0/tests/unit/__snapshots__/test_extraction_text_corpus.ambr +80 -0
  206. sci2audio-1.0.0/tests/unit/__snapshots__/test_layout_corpus.ambr +1340 -0
  207. sci2audio-1.0.0/tests/unit/__snapshots__/test_layout_tagged_corpus.ambr +429 -0
  208. sci2audio-1.0.0/tests/unit/__snapshots__/test_output_faults.ambr +67 -0
  209. sci2audio-1.0.0/tests/unit/__snapshots__/test_textprep_citations_links_corpus.ambr +616 -0
  210. sci2audio-1.0.0/tests/unit/__snapshots__/test_textprep_footnotes_tagged_corpus.ambr +17 -0
  211. sci2audio-1.0.0/tests/unit/__snapshots__/test_textprep_furniture.ambr +111 -0
  212. sci2audio-1.0.0/tests/unit/__snapshots__/test_textprep_rules_corpus.ambr +68 -0
  213. sci2audio-1.0.0/tests/unit/app_helpers.py +24 -0
  214. sci2audio-1.0.0/tests/unit/audio_fakes.py +145 -0
  215. sci2audio-1.0.0/tests/unit/broken_pdfs.py +102 -0
  216. sci2audio-1.0.0/tests/unit/cli_helpers.py +107 -0
  217. sci2audio-1.0.0/tests/unit/content_description.py +45 -0
  218. sci2audio-1.0.0/tests/unit/core_strategies.py +255 -0
  219. sci2audio-1.0.0/tests/unit/epub_maker.py +166 -0
  220. sci2audio-1.0.0/tests/unit/notation_texts.py +90 -0
  221. sci2audio-1.0.0/tests/unit/output_helpers.py +133 -0
  222. sci2audio-1.0.0/tests/unit/pdf_maker.py +424 -0
  223. sci2audio-1.0.0/tests/unit/test_app_audio_faults.py +341 -0
  224. sci2audio-1.0.0/tests/unit/test_app_audio_job.py +427 -0
  225. sci2audio-1.0.0/tests/unit/test_app_audio_plan.py +210 -0
  226. sci2audio-1.0.0/tests/unit/test_app_chapters.py +164 -0
  227. sci2audio-1.0.0/tests/unit/test_app_chunks.py +203 -0
  228. sci2audio-1.0.0/tests/unit/test_app_corpus.py +113 -0
  229. sci2audio-1.0.0/tests/unit/test_app_cover.py +188 -0
  230. sci2audio-1.0.0/tests/unit/test_app_estimate.py +171 -0
  231. sci2audio-1.0.0/tests/unit/test_app_faults.py +210 -0
  232. sci2audio-1.0.0/tests/unit/test_app_job.py +265 -0
  233. sci2audio-1.0.0/tests/unit/test_app_report.py +213 -0
  234. sci2audio-1.0.0/tests/unit/test_app_script.py +288 -0
  235. sci2audio-1.0.0/tests/unit/test_app_settings.py +208 -0
  236. sci2audio-1.0.0/tests/unit/test_cli_convert.py +310 -0
  237. sci2audio-1.0.0/tests/unit/test_cli_errors.py +175 -0
  238. sci2audio-1.0.0/tests/unit/test_cli_golden.py +33 -0
  239. sci2audio-1.0.0/tests/unit/test_cli_properties.py +76 -0
  240. sci2audio-1.0.0/tests/unit/test_cli_script.py +257 -0
  241. sci2audio-1.0.0/tests/unit/test_cli_voices.py +194 -0
  242. sci2audio-1.0.0/tests/unit/test_core_content.py +282 -0
  243. sci2audio-1.0.0/tests/unit/test_core_objects.py +319 -0
  244. sci2audio-1.0.0/tests/unit/test_core_properties.py +140 -0
  245. sci2audio-1.0.0/tests/unit/test_corpus.py +144 -0
  246. sci2audio-1.0.0/tests/unit/test_corpus_truth.py +277 -0
  247. sci2audio-1.0.0/tests/unit/test_extraction_corpus.py +283 -0
  248. sci2audio-1.0.0/tests/unit/test_extraction_cover.py +257 -0
  249. sci2audio-1.0.0/tests/unit/test_extraction_epub.py +846 -0
  250. sci2audio-1.0.0/tests/unit/test_extraction_epub_corpus.py +107 -0
  251. sci2audio-1.0.0/tests/unit/test_extraction_markdown.py +481 -0
  252. sci2audio-1.0.0/tests/unit/test_extraction_pdf.py +427 -0
  253. sci2audio-1.0.0/tests/unit/test_extraction_pdf_broken.py +475 -0
  254. sci2audio-1.0.0/tests/unit/test_extraction_text.py +246 -0
  255. sci2audio-1.0.0/tests/unit/test_extraction_text_corpus.py +184 -0
  256. sci2audio-1.0.0/tests/unit/test_extraction_timeouts.py +57 -0
  257. sci2audio-1.0.0/tests/unit/test_layout.py +594 -0
  258. sci2audio-1.0.0/tests/unit/test_layout_captions.py +283 -0
  259. sci2audio-1.0.0/tests/unit/test_layout_corpus.py +650 -0
  260. sci2audio-1.0.0/tests/unit/test_layout_footnotes.py +357 -0
  261. sci2audio-1.0.0/tests/unit/test_layout_formulas.py +381 -0
  262. sci2audio-1.0.0/tests/unit/test_layout_graphics.py +610 -0
  263. sci2audio-1.0.0/tests/unit/test_layout_headings.py +833 -0
  264. sci2audio-1.0.0/tests/unit/test_layout_paragraphs.py +599 -0
  265. sci2audio-1.0.0/tests/unit/test_layout_split.py +143 -0
  266. sci2audio-1.0.0/tests/unit/test_layout_tagged.py +627 -0
  267. sci2audio-1.0.0/tests/unit/test_layout_tagged_corpus.py +223 -0
  268. sci2audio-1.0.0/tests/unit/test_output_faults.py +469 -0
  269. sci2audio-1.0.0/tests/unit/test_output_ffmpeg.py +191 -0
  270. sci2audio-1.0.0/tests/unit/test_output_long.py +72 -0
  271. sci2audio-1.0.0/tests/unit/test_output_parts.py +349 -0
  272. sci2audio-1.0.0/tests/unit/test_package_data.py +36 -0
  273. sci2audio-1.0.0/tests/unit/test_quarantine.py +95 -0
  274. sci2audio-1.0.0/tests/unit/test_readme.py +48 -0
  275. sci2audio-1.0.0/tests/unit/test_smoke.py +94 -0
  276. sci2audio-1.0.0/tests/unit/test_speed_script.py +372 -0
  277. sci2audio-1.0.0/tests/unit/test_textprep_characters.py +296 -0
  278. sci2audio-1.0.0/tests/unit/test_textprep_citations.py +501 -0
  279. sci2audio-1.0.0/tests/unit/test_textprep_citations_links_corpus.py +155 -0
  280. sci2audio-1.0.0/tests/unit/test_textprep_conformance.py +158 -0
  281. sci2audio-1.0.0/tests/unit/test_textprep_footnotes.py +253 -0
  282. sci2audio-1.0.0/tests/unit/test_textprep_footnotes_linked.py +489 -0
  283. sci2audio-1.0.0/tests/unit/test_textprep_footnotes_tagged_corpus.py +106 -0
  284. sci2audio-1.0.0/tests/unit/test_textprep_furniture.py +83 -0
  285. sci2audio-1.0.0/tests/unit/test_textprep_hyphens.py +468 -0
  286. sci2audio-1.0.0/tests/unit/test_textprep_links.py +454 -0
  287. sci2audio-1.0.0/tests/unit/test_textprep_numbers.py +303 -0
  288. sci2audio-1.0.0/tests/unit/test_textprep_placeholders.py +339 -0
  289. sci2audio-1.0.0/tests/unit/test_textprep_regression.py +147 -0
  290. sci2audio-1.0.0/tests/unit/test_textprep_regression_german.py +35 -0
  291. sci2audio-1.0.0/tests/unit/test_textprep_rules_corpus.py +143 -0
  292. sci2audio-1.0.0/tests/unit/test_textprep_runner.py +349 -0
  293. sci2audio-1.0.0/tests/unit/test_textprep_statistics.py +313 -0
  294. sci2audio-1.0.0/tests/unit/test_textprep_steps.py +149 -0
  295. sci2audio-1.0.0/tests/unit/test_textprep_units_abbreviations.py +604 -0
  296. sci2audio-1.0.0/tests/unit/test_textprep_utterances.py +395 -0
  297. sci2audio-1.0.0/tests/unit/test_voices_conformance.py +186 -0
  298. sci2audio-1.0.0/tests/unit/test_voices_download.py +341 -0
  299. sci2audio-1.0.0/tests/unit/test_voices_kokoro.py +219 -0
  300. sci2audio-1.0.0/tests/unit/test_voices_runtime.py +32 -0
  301. sci2audio-1.0.0/tests/unit/test_voices_wav.py +93 -0
  302. sci2audio-1.0.0/tests/unit/test_web_audio.py +190 -0
  303. sci2audio-1.0.0/tests/unit/test_web_documents.py +290 -0
  304. sci2audio-1.0.0/tests/unit/test_web_jobs.py +416 -0
  305. sci2audio-1.0.0/tests/unit/test_web_languages.py +614 -0
  306. sci2audio-1.0.0/tests/unit/test_web_launch.py +387 -0
  307. sci2audio-1.0.0/tests/unit/test_web_pages.py +300 -0
  308. sci2audio-1.0.0/tests/unit/test_web_player.py +540 -0
  309. sci2audio-1.0.0/tests/unit/test_web_preview_files.py +256 -0
  310. sci2audio-1.0.0/tests/unit/test_web_refused_pdfs.py +65 -0
  311. sci2audio-1.0.0/tests/unit/test_web_remove.py +863 -0
  312. sci2audio-1.0.0/tests/unit/test_web_schemathesis.py +75 -0
  313. sci2audio-1.0.0/tests/unit/test_web_security.py +384 -0
  314. sci2audio-1.0.0/tests/unit/test_web_settings_voices.py +404 -0
  315. sci2audio-1.0.0/tests/unit/test_zap_scan.py +404 -0
  316. sci2audio-1.0.0/tests/unit/textprep_documents.py +128 -0
  317. sci2audio-1.0.0/tests/unit/voice_fakes.py +85 -0
  318. sci2audio-1.0.0/tests/unit/web_helpers.py +157 -0
  319. sci2audio-1.0.0/uv.lock +4003 -0
@@ -0,0 +1,11 @@
1
+ # Licence gate
2
+
3
+ Applies to every PR that adds or moves in a dependency, copied code, a model, a voice, a font, an icon or a sample text.
4
+
5
+ 1. Find the licence at the source (repository LICENSE file, model card, PyPI metadata). Quote its SPDX identifier.
6
+ 2. Allowed: MIT, BSD, Apache-2.0, ISC, MPL-2.0, LGPL, GPL-2.0-or-later, GPL-3.0, CC0, CC BY (texts and data, with attribution), public domain.
7
+ 3. Refused: AGPL, SSPL, any non-commercial or research-only licence, "no licence stated", model weights with restricted licences, voices trained on data with unclear rights.
8
+ 4. Copied code keeps its original copyright and licence notice at the top of each file.
9
+ 5. Add a row to `THIRD_PARTY_LICENSES.md` (code, dependencies, models, programs) or `tests/corpus/LICENSES.md` (sample texts) in the same PR.
10
+ 6. Code moved in from the private `audiobook-generator` repo: check it contains no third-party text, no personal data (names, addresses, e-mail), no keys or tokens, and no cloud or payment code.
11
+ 7. When unsure, stop and ask in the PR; label it `risk:high`.
@@ -0,0 +1,40 @@
1
+ # Tests
2
+
3
+ Testing strategy: D-58. One runner (pytest) for everything except the browser, where Playwright runs inside pytest.
4
+
5
+ ## Basics
6
+
7
+ - Fast tests (no marker) run on every PR on Linux, macOS and Windows; keep the whole fast suite under about 2 minutes.
8
+ - Mark tests that need voices, models, audio or the full sample corpus with `@pytest.mark.slow`; speed measurements with `@pytest.mark.benchmark`. Both run nightly (`.github/workflows/nightly.yml`).
9
+ - Browser tests live in `tests/browser/` and get the `browser` marker there: they run in their own CI job on Linux with Chromium on every PR, and with Chromium, Firefox and WebKit nightly (D-259). Run them with `uv run pytest -m browser` after `uv run playwright install chromium`. They fail on any request the page makes outside the test server.
10
+ - Exception: a test that encodes or decodes only a few seconds of generated audio with ffmpeg may stay in the fast suite, so every PR proves the bundled ffmpeg works on all three systems (#69).
11
+ - Hypothesis profiles: `dev` (local default), `ci` (every PR, deterministic), `nightly` (many examples). Set with `HYPOTHESIS_PROFILE`.
12
+ - Golden files (syrupy): accept a wanted change with `uv run pytest --snapshot-update` and explain the diff in the PR.
13
+ - Never weaken or delete a test to make CI green. If a test is wrong, say why in the PR.
14
+ - No network in tests. Mock downloads.
15
+
16
+ ## Moving code in and changing text rules
17
+
18
+ - Moving code in: first copy its existing tests, then add a characterisation golden file that pins today's output on a sample from `tests/corpus/`. The move is done when that output is identical, or the PR explains every difference.
19
+ - Text rules: add the input and the expected spoken script to the English regression cases before changing a rule; the PR shows the before/after diff.
20
+
21
+ ## First of its kind: the PR that adds the code also adds its test pipeline
22
+
23
+ A PR is not done if it introduces one of these for the first time without the matching tests and CI wiring. This keeps every testing method of D-58 in place from the moment it can exist.
24
+
25
+ | When a PR first adds ... | it must also add ... |
26
+ |---|---|
27
+ | a module in `textprep/` | unit tests, a Hypothesis property test (no crash on any text; edit spans valid; idempotent), and an entry in the English regression cases |
28
+ | the text-step or voice plugin interface | the conformance suite in `sci2audio.testing` that every plugin must pass, run against the built-in plugins |
29
+ | a module in `extraction/` | golden files for corpus samples and a set of deliberately broken files that must fail with a clear message |
30
+ | a module in `layout/` | corpus truth tests (columns per page, furniture in both directions: truth furniture only in furniture blocks and furniture blocks only truth furniture, verbatim sentences read in order), a golden file of every block for the corpus papers, and Hypothesis property tests (never fails on any `Content`, every item in exactly one block) (D-76) |
31
+ | the FastAPI server in `web/` | TestClient tests, Schemathesis against the OpenAPI schema, and tests for 127.0.0.1-only binding, start-up token and origin check |
32
+ | the HTML interface | Playwright tests (pytest-playwright) for the main flow with axe-core checks (`axe-playwright-python`), wired into CI |
33
+ | a voice in `voices/` | a `slow` integration test (text → audio file) and the speech-recognition round-trip (faster-whisper) in the nightly run |
34
+ | a pipeline step that can take long | a `benchmark` test and a row in `docs/baseline.md` |
35
+ | resume, download or any file writing | fault-injection tests: kill mid-run and resume, no network, disk full, file removed during the run |
36
+ | installers or the app window | an installer smoke test on all three systems in the release workflow |
37
+
38
+ ## Before each release
39
+
40
+ Follow `docs/release-checklist.md`: listening test, screen-reader pass, OWASP ZAP baseline scan (the last run of `.github/workflows/zap.yml` on `main`, #12), mutation run, speed numbers.
@@ -0,0 +1,3 @@
1
+ # The sample corpus is stored byte for byte on every system: no line-end conversion, so
2
+ # the text samples keep their hashes and golden files on Windows too (#74).
3
+ tests/corpus/** -text
@@ -0,0 +1,29 @@
1
+ name: Bug report
2
+ description: Something sci2audio does wrong
3
+ labels: [inbox, bug]
4
+ body:
5
+ - type: textarea
6
+ id: what
7
+ attributes:
8
+ label: What happened, and what did you expect?
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: steps
13
+ attributes:
14
+ label: Steps to reproduce
15
+ description: Please use a text you may share (your own, public domain or CC BY). Never attach copyrighted documents.
16
+ validations:
17
+ required: true
18
+ - type: input
19
+ id: version
20
+ attributes:
21
+ label: sci2audio version and operating system
22
+ placeholder: "sci2audio 0.1.0, macOS 15"
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: log
27
+ attributes:
28
+ label: Error message or diagnostics file
29
+ render: text
@@ -0,0 +1 @@
1
+ blank_issues_enabled: false
@@ -0,0 +1,30 @@
1
+ name: Feature or task
2
+ description: Something sci2audio should do or something to build
3
+ labels: [inbox, feature]
4
+ body:
5
+ - type: input
6
+ id: feature-id
7
+ attributes:
8
+ label: Feature ID
9
+ description: From the feature list, if there is one (e.g. WI-02)
10
+ - type: textarea
11
+ id: problem
12
+ attributes:
13
+ label: Problem or outcome
14
+ description: What should be possible afterwards, and for whom? Describe the need, not only a solution.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: acceptance
19
+ attributes:
20
+ label: Acceptance criteria
21
+ description: How do we check it is done? One line each.
22
+ placeholder: |
23
+ - ...
24
+ validations:
25
+ required: true
26
+ - type: textarea
27
+ id: notes
28
+ attributes:
29
+ label: Notes
30
+ description: Technical hints, licences, related Issues
@@ -0,0 +1,15 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ labels: [chore, "lane:infra"]
8
+ - package-ecosystem: uv
9
+ directory: /
10
+ schedule:
11
+ interval: weekly
12
+ labels: [chore, "lane:infra"]
13
+ groups:
14
+ dev-tools:
15
+ dependency-type: development
@@ -0,0 +1,30 @@
1
+ # One agent thread per lane at a time. A PR changes files of its own lane only
2
+ # (plus tests for those files and docs). Shared files need lane:infra.
3
+ lanes:
4
+ core:
5
+ paths: [src/sci2audio/core/**]
6
+ single_threaded: true # shared data objects: changes ripple everywhere
7
+ extraction:
8
+ paths: [src/sci2audio/extraction/**]
9
+ layout:
10
+ paths: [src/sci2audio/layout/**]
11
+ textprep:
12
+ # sci2audio.testing holds the conformance suites (Q11); the voice part follows in #18
13
+ paths: [src/sci2audio/textprep/**, src/sci2audio/testing/**]
14
+ voices:
15
+ paths: [src/sci2audio/voices/**]
16
+ output:
17
+ paths: [src/sci2audio/output/**]
18
+ app:
19
+ paths: [src/sci2audio/app/**]
20
+ single_threaded: true
21
+ web:
22
+ paths: [src/sci2audio/web/**]
23
+ single_threaded: true
24
+ cli:
25
+ paths: [src/sci2audio/cli.py]
26
+ infra:
27
+ paths: [.github/**, pyproject.toml, uv.lock, .pre-commit-config.yaml]
28
+ single_threaded: true
29
+ docs:
30
+ paths: ["*.md", docs/**, .claude/**]
@@ -0,0 +1,26 @@
1
+ ## What and why
2
+
3
+ Closes #
4
+ Feature ID: <!-- e.g. WI-02, from the feature list -->
5
+
6
+ ## How it was tested
7
+
8
+ - [ ] `uv run ruff check && uv run ruff format --check`
9
+ - [ ] `uv run lint-imports && uv run deptry src`
10
+ - [ ] `uv run pytest -m "not slow and not benchmark and not browser"`: <!-- e.g. 42 passed -->
11
+ - [ ] Interface changed? `uv run pytest -m browser`: <!-- e.g. 13 passed / not applicable -->
12
+ - [ ] First of its kind? Tests and CI wiring added as required by `.claude/rules/tests.md`: <!-- yes / not applicable -->
13
+ - [ ] Golden files changed? Diff explained: <!-- yes / no change -->
14
+ - [ ] Slow tests or a manual check, if relevant: <!-- what you ran -->
15
+
16
+ ## Licences
17
+
18
+ <!-- New dependency, copied code, model, voice or sample text? Name it and its licence, or write "none". -->
19
+
20
+ ## Risk
21
+
22
+ <!-- low / risk:high (licences, deleting user files, network, release, layer contracts and plugin interfaces, core dataclasses, golden files; any of these makes the PR critical; until v1.0 the coordinator merges critical PRs after review and Colin is informed, D-80) -->
23
+
24
+ ## Out of scope
25
+
26
+ <!-- Follow-up Issues created for things not done here. -->
@@ -0,0 +1,149 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ env:
13
+ # The Python of .python-version (3.12.16 or newer), as uv downloads it; never the runner's
14
+ # own, which is older on macOS and Windows and reads broken HTML differently (D-378, #175).
15
+ UV_PYTHON_PREFERENCE: only-managed
16
+
17
+ concurrency:
18
+ group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19
+ cancel-in-progress: true
20
+
21
+ jobs:
22
+ lint:
23
+ name: lint and layers
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27
+ with:
28
+ persist-credentials: false
29
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
30
+ - run: uv sync --locked
31
+ - name: Ruff lint (incl. security rules)
32
+ run: uv run ruff check --output-format=github
33
+ - name: Ruff format
34
+ run: uv run ruff format --check
35
+ - name: Layer rules (import-linter)
36
+ run: uv run lint-imports
37
+ - name: Dependencies (deptry)
38
+ run: uv run deptry src
39
+ # D-374: flaky tests are skipped with a linked issue; all must be fixed before v1.0.
40
+ - name: Quarantined tests (listed in the job summary)
41
+ run: |
42
+ uv run pytest -m quarantined --collect-only -q -p no:cacheprovider | tee quarantined.txt
43
+ {
44
+ echo "## Quarantined tests (D-374)"
45
+ echo
46
+ echo "Each is skipped until its issue is fixed; all must be fixed before v1.0 (#80)."
47
+ echo
48
+ echo '```'
49
+ grep -E '^ +#[0-9]+ ' quarantined.txt || echo "none"
50
+ echo '```'
51
+ } >> "$GITHUB_STEP_SUMMARY"
52
+
53
+ licences:
54
+ name: licences
55
+ runs-on: ubuntu-latest
56
+ steps:
57
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
58
+ with:
59
+ persist-credentials: false
60
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
61
+ # Only the app's own run-time dependencies are checked, not the dev tools.
62
+ # espeakng-loader states no licence in its package metadata; it was checked by hand
63
+ # (loader MIT, bundled espeak-ng GPL-3.0-or-later) and is listed in THIRD_PARTY_LICENSES.md.
64
+ - run: uv sync --locked --no-dev
65
+ - name: Refuse AGPL, non-commercial and unknown licences
66
+ run: >
67
+ uv run --no-sync --with pip-licenses pip-licenses
68
+ --ignore-packages sci2audio pip-licenses prettytable wcwidth espeakng-loader
69
+ --partial-match
70
+ --fail-on="Affero;AGPL;SSPL;Non-Commercial;NonCommercial;UNKNOWN"
71
+ --format=markdown
72
+
73
+ security:
74
+ name: security
75
+ runs-on: ubuntu-latest
76
+ steps:
77
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
78
+ with:
79
+ persist-credentials: false
80
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
81
+ - run: uv sync --locked
82
+ - name: Known vulnerabilities in run-time dependencies (pip-audit)
83
+ run: |
84
+ uv export --locked --no-dev --no-emit-project --format requirements.txt -o runtime-requirements.txt
85
+ uv run pip-audit --requirement runtime-requirements.txt --disable-pip --no-deps --progress-spinner off
86
+ - name: Workflow security (zizmor)
87
+ run: uv run zizmor --offline .github/workflows
88
+
89
+ tests:
90
+ name: tests (${{ matrix.os }})
91
+ runs-on: ${{ matrix.os }}
92
+ strategy:
93
+ fail-fast: false
94
+ matrix:
95
+ os: [ubuntu-latest, macos-latest, windows-latest]
96
+ steps:
97
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
98
+ with:
99
+ persist-credentials: false
100
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
101
+ - run: uv sync --locked
102
+ - name: Fast tests (unit, property-based, golden files)
103
+ run: uv run pytest -m "not slow and not benchmark and not browser" -n auto
104
+ env:
105
+ HYPOTHESIS_PROFILE: ci
106
+ # PE-02 (D-224): the installed command on one corpus PDF, as a person runs it.
107
+ - name: Smoke test (sci2audio script on a corpus PDF)
108
+ shell: bash
109
+ run: |
110
+ uv run sci2audio script tests/corpus/papers/joss2021-waskom-seaborn.pdf \
111
+ -o "$RUNNER_TEMP/smoke" --work-folder "$RUNNER_TEMP/smoke-work" --ignore-settings
112
+ for suffix in script.txt report.json report.md; do
113
+ test -s "$RUNNER_TEMP/smoke/joss2021-waskom-seaborn.$suffix"
114
+ done
115
+
116
+ # The interface in a real browser (#77, #8, D-259): main flow, keyboard-only path and
117
+ # axe-core. Chromium on Linux on every PR; Firefox and WebKit run nightly.
118
+ browser:
119
+ name: browser (Linux, Chromium)
120
+ runs-on: ubuntu-latest
121
+ steps:
122
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
123
+ with:
124
+ persist-credentials: false
125
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
126
+ - run: uv sync --locked
127
+ # A CI download of the test browser; the tests themselves never use the network.
128
+ - name: Install Chromium for Playwright
129
+ run: uv run playwright install --with-deps chromium
130
+ - name: Browser tests (main flow, keyboard, axe-core)
131
+ run: uv run pytest -m browser --browser chromium -rA
132
+ env:
133
+ HYPOTHESIS_PROFILE: ci
134
+
135
+ # The only check required by the ruleset on main. Its name must not change.
136
+ ci-passed:
137
+ name: CI passed
138
+ if: always()
139
+ needs: [lint, licences, security, tests, browser]
140
+ runs-on: ubuntu-latest
141
+ steps:
142
+ - name: Fail if any required job did not succeed
143
+ if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
144
+ env:
145
+ RESULTS: ${{ toJSON(needs) }}
146
+ run: |
147
+ echo "At least one job did not succeed: $RESULTS"
148
+ exit 1
149
+ - run: echo "All checks passed."
@@ -0,0 +1,32 @@
1
+ name: Mutation testing
2
+
3
+ # Run by hand (Actions -> Mutation testing -> Run workflow), e.g. monthly or
4
+ # before a release. Shows which code changes the tests fail to notice.
5
+ on:
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ env:
12
+ # The Python of .python-version (3.12.16 or newer), as uv downloads it; never the runner's
13
+ # own, which is older on macOS and Windows and reads broken HTML differently (D-378, #175).
14
+ UV_PYTHON_PREFERENCE: only-managed
15
+
16
+ jobs:
17
+ mutmut:
18
+ name: mutmut
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ persist-credentials: false
24
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
25
+ - run: uv sync --locked
26
+ # mutmut exits 0 when it has run every mutant, whatever their results; a non-zero
27
+ # exit means the run itself broke (for example the first, unmutated test run failed),
28
+ # and the job must say so instead of listing every mutant as "not checked".
29
+ - name: Mutation run
30
+ run: uv run mutmut run
31
+ - name: Results
32
+ run: uv run mutmut results
@@ -0,0 +1,127 @@
1
+ name: Nightly
2
+
3
+ # Slow tests (voices, models, the whole corpus, speech-recognition round-trip)
4
+ # and benchmarks. Not required for merging; a red nightly run is a P1 Issue.
5
+ on:
6
+ schedule:
7
+ - cron: "17 2 * * *" # 02:17 UTC every day
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ env:
14
+ # The Python of .python-version (3.12.16 or newer), as uv downloads it; never the runner's
15
+ # own, which is older on macOS and Windows and reads broken HTML differently (D-378, #175).
16
+ UV_PYTHON_PREFERENCE: only-managed
17
+
18
+ jobs:
19
+ slow-tests:
20
+ name: slow tests (${{ matrix.os }})
21
+ runs-on: ${{ matrix.os }}
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ os: [ubuntu-latest, macos-latest, windows-latest]
26
+ steps:
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+ with:
29
+ persist-credentials: false
30
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
31
+ - run: uv sync --locked --group asr
32
+ - name: Cache the voice and speech-recognition models
33
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
34
+ with:
35
+ path: ${{ runner.temp }}/test-models
36
+ # Bump with the pinned revisions in voices/download.py and prepare_models.py.
37
+ key: test-models-${{ runner.os }}-kokoro-f3ff357-spacy-3.8.0-whisper-536b066
38
+ # The only step with network: sci2audio's own voice download plus the whisper model.
39
+ - name: Fetch the models (skips files already cached)
40
+ shell: bash
41
+ run: uv run python tests/integration/prepare_models.py "$RUNNER_TEMP/test-models/voices" "$RUNNER_TEMP/test-models/whisper"
42
+ - name: Slow tests (the network is blocked inside the tests)
43
+ shell: bash
44
+ env:
45
+ HYPOTHESIS_PROFILE: nightly
46
+ SCI2AUDIO_TEST_MODELS: ${{ runner.temp }}/test-models/voices
47
+ SCI2AUDIO_TEST_WHISPER: ${{ runner.temp }}/test-models/whisper
48
+ run: uv run pytest -m slow -rA
49
+
50
+ property-deep:
51
+ name: property-based tests, many examples
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
55
+ with:
56
+ persist-credentials: false
57
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
58
+ - run: uv sync --locked
59
+ - name: Hypothesis with the nightly profile
60
+ env:
61
+ HYPOTHESIS_PROFILE: nightly
62
+ run: uv run pytest -m "not slow and not benchmark and not browser"
63
+
64
+ browsers:
65
+ name: browser (${{ matrix.browser }}, ${{ matrix.os }})
66
+ runs-on: ${{ matrix.os }}
67
+ strategy:
68
+ fail-fast: false
69
+ matrix:
70
+ # #8: all three engines; WebKit on macOS too, the engine of the app window (D-47)
71
+ include:
72
+ - { os: ubuntu-latest, browser: chromium }
73
+ - { os: ubuntu-latest, browser: firefox }
74
+ - { os: ubuntu-latest, browser: webkit }
75
+ - { os: macos-latest, browser: webkit }
76
+ steps:
77
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
78
+ with:
79
+ persist-credentials: false
80
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
81
+ - run: uv sync --locked
82
+ - name: Install the browser for Playwright
83
+ env:
84
+ BROWSER: ${{ matrix.browser }}
85
+ run: uv run playwright install --with-deps "$BROWSER"
86
+ # A runner has no sound card. Firefox, unlike Chromium and WebKit, then fails every
87
+ # <audio> with OnMediaSinkAudioError, so the player tests need a sound server that
88
+ # plays into its null sink (#205).
89
+ - name: A silent sound server for Firefox
90
+ if: matrix.browser == 'firefox'
91
+ run: |
92
+ sudo apt-get install --yes --no-install-recommends pulseaudio
93
+ pulseaudio --start --exit-idle-time=-1
94
+ - name: Browser tests (main flow, keyboard, axe-core)
95
+ env:
96
+ BROWSER: ${{ matrix.browser }}
97
+ HYPOTHESIS_PROFILE: nightly
98
+ run: uv run pytest -m browser --browser "$BROWSER" -rA
99
+
100
+ benchmarks:
101
+ name: benchmarks
102
+ runs-on: ubuntu-latest
103
+ steps:
104
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
105
+ with:
106
+ persist-credentials: false
107
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
108
+ - run: uv sync --locked --group asr
109
+ - name: Cache the voice and speech-recognition models
110
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
111
+ with:
112
+ path: ${{ runner.temp }}/test-models
113
+ # Bump with the pinned revisions in voices/download.py and prepare_models.py.
114
+ key: test-models-${{ runner.os }}-kokoro-f3ff357-spacy-3.8.0-whisper-536b066
115
+ # The only step with network: sci2audio's own voice download plus the whisper model.
116
+ - name: Fetch the models (skips files already cached)
117
+ shell: bash
118
+ run: uv run python tests/integration/prepare_models.py "$RUNNER_TEMP/test-models/voices" "$RUNNER_TEMP/test-models/whisper"
119
+ - name: Benchmarks (trend only; CI machines vary)
120
+ shell: bash
121
+ env:
122
+ SCI2AUDIO_TEST_MODELS: ${{ runner.temp }}/test-models/voices
123
+ run: uv run pytest -m benchmark --benchmark-only --benchmark-json=benchmark.json
124
+ # The speed script against the real voice, so it cannot rot (D-287); numbers in the log.
125
+ - name: Speed script, short run on the CPU (trend only)
126
+ shell: bash
127
+ run: uv run python scripts/speed.py --quick --device cpu --models-folder "$RUNNER_TEMP/test-models/voices" --json "$RUNNER_TEMP/speed.json"
@@ -0,0 +1,165 @@
1
+ name: Release
2
+
3
+ # A tag vX.Y.Z builds the package, installs the built wheel on Linux, macOS and Windows and
4
+ # runs it on a corpus PDF, and only then publishes to PyPI; after that it makes the GitHub
5
+ # release from the changelog and installs the release from PyPI on all three systems
6
+ # (#80, D-484 to D-487).
7
+ on:
8
+ push:
9
+ tags: ["v*"]
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ env:
15
+ # The Python of .python-version (3.12.16 or newer), as uv downloads it; never the runner's
16
+ # own, which is older on macOS and Windows and reads broken HTML differently (D-378, #175).
17
+ UV_PYTHON_PREFERENCE: only-managed
18
+
19
+ jobs:
20
+ build:
21
+ name: build
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+ with:
26
+ persist-credentials: false
27
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
28
+ with:
29
+ enable-cache: false
30
+ - name: The tag names the package's version
31
+ env:
32
+ TAG: ${{ github.ref_name }}
33
+ run: |
34
+ version=$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' src/sci2audio/__init__.py)
35
+ echo "tag $TAG, package version $version"
36
+ test "$TAG" = "v$version"
37
+ - name: The changelog dates this version
38
+ env:
39
+ TAG: ${{ github.ref_name }}
40
+ run: |
41
+ # CHANGELOG.md has "## [X.Y.Z] - YYYY-MM-DD" for the tag's version, not "unreleased"
42
+ version="${TAG#v}"
43
+ grep -Eq "^## \[${version//./\\.}\] - [0-9]{4}-[0-9]{2}-[0-9]{2}[[:space:]]*$" CHANGELOG.md
44
+ - run: uv build
45
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+
50
+ # The built wheel, installed as a person installs it, on a corpus PDF (#80, D-485). Offline
51
+ # like CI's smoke test: no voice download (D-487); the nightly run covers the real voice.
52
+ smoke:
53
+ name: installed wheel (${{ matrix.os }})
54
+ needs: build
55
+ runs-on: ${{ matrix.os }}
56
+ strategy:
57
+ fail-fast: false
58
+ matrix:
59
+ os: [ubuntu-latest, macos-latest, windows-latest]
60
+ steps:
61
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
62
+ with:
63
+ persist-credentials: false # for .python-version and the corpus PDF only
64
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
65
+ with:
66
+ enable-cache: false
67
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
68
+ with:
69
+ name: dist
70
+ path: dist/
71
+ - name: Install the wheel with uv tool, as the README says
72
+ shell: bash
73
+ run: |
74
+ wheel=$(ls "$GITHUB_WORKSPACE"/dist/sci2audio-*.whl)
75
+ backend=()
76
+ if [ "$RUNNER_OS" = Linux ]; then backend=(--torch-backend cpu); fi
77
+ cd "$RUNNER_TEMP" # outside the checkout: nothing can be imported from the source tree
78
+ uv tool install --python "$(cat "$GITHUB_WORKSPACE/.python-version")" "${backend[@]}" "$wheel"
79
+ - name: Run it on a corpus PDF
80
+ shell: bash
81
+ run: bash scripts/release_smoke.sh "$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' src/sci2audio/__init__.py)"
82
+
83
+ publish:
84
+ name: publish to PyPI
85
+ needs: [build, smoke]
86
+ runs-on: ubuntu-latest
87
+ environment: pypi
88
+ permissions:
89
+ id-token: write # trusted publishing, no stored token
90
+ steps:
91
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
92
+ with:
93
+ name: dist
94
+ path: dist/
95
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
96
+
97
+ # The GitHub release: the tag's section of CHANGELOG.md, with the sdist and wheel (D-486).
98
+ github-release:
99
+ name: GitHub release
100
+ needs: publish
101
+ runs-on: ubuntu-latest
102
+ permissions:
103
+ contents: write # this job only: it creates the release
104
+ steps:
105
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
106
+ with:
107
+ persist-credentials: false
108
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
109
+ with:
110
+ name: dist
111
+ path: dist/
112
+ - name: Create the release
113
+ env:
114
+ GH_TOKEN: ${{ github.token }}
115
+ TAG: ${{ github.ref_name }}
116
+ run: |
117
+ version="${TAG#v}"
118
+ awk -v head="## [$version]" '
119
+ index($0, head) == 1 { inside = 1; next }
120
+ inside && (/^## \[/ || /^\[[^]]+\]: /) { exit } # next version, or the link list
121
+ inside { print }
122
+ ' CHANGELOG.md > "$RUNNER_TEMP/notes.md"
123
+ # the changelog's section for this version has text, not only blank lines
124
+ grep -q '[^[:space:]]' "$RUNNER_TEMP/notes.md"
125
+ gh release create "$TAG" dist/* --verify-tag --title "sci2audio $version" \
126
+ --notes-file "$RUNNER_TEMP/notes.md"
127
+
128
+ # The release as PyPI serves it, on clean runners (D-485).
129
+ from-pypi:
130
+ name: install from PyPI (${{ matrix.os }})
131
+ needs: publish
132
+ runs-on: ${{ matrix.os }}
133
+ strategy:
134
+ fail-fast: false
135
+ matrix:
136
+ os: [ubuntu-latest, macos-latest, windows-latest]
137
+ steps:
138
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
139
+ with:
140
+ persist-credentials: false # for .python-version and the corpus PDF only
141
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
142
+ with:
143
+ enable-cache: false
144
+ - name: Install sci2audio from PyPI (waits up to 10 minutes for the index)
145
+ shell: bash
146
+ env:
147
+ TAG: ${{ github.ref_name }}
148
+ run: |
149
+ backend=()
150
+ if [ "$RUNNER_OS" = Linux ]; then backend=(--torch-backend cpu); fi
151
+ python=$(cat "$GITHUB_WORKSPACE/.python-version")
152
+ cd "$RUNNER_TEMP"
153
+ for attempt in $(seq 20); do
154
+ if uv tool install --refresh --python "$python" "${backend[@]}" "sci2audio==${TAG#v}"; then
155
+ exit 0
156
+ fi
157
+ echo "attempt $attempt: not installable yet; waiting 30 s"
158
+ sleep 30
159
+ done
160
+ exit 1
161
+ - name: Run it on a corpus PDF
162
+ shell: bash
163
+ env:
164
+ TAG: ${{ github.ref_name }}
165
+ run: bash scripts/release_smoke.sh "${TAG#v}"