python-voiceio 1.18.0__tar.gz → 1.18.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.
Files changed (240) hide show
  1. {python_voiceio-1.18.0/python_voiceio.egg-info → python_voiceio-1.18.2}/PKG-INFO +1 -1
  2. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/pyproject.toml +1 -1
  3. {python_voiceio-1.18.0 → python_voiceio-1.18.2/python_voiceio.egg-info}/PKG-INFO +1 -1
  4. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/python_voiceio.egg-info/SOURCES.txt +2 -0
  5. python_voiceio-1.18.2/tests/test_cuda_setup_hint.py +173 -0
  6. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_evdev_uaccess.py +7 -6
  7. python_voiceio-1.18.2/tests/test_evdev_x11_optional.py +199 -0
  8. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_security_hardening.py +2 -2
  9. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_setup.py +75 -3
  10. python_voiceio-1.18.2/voiceio/__init__.py +1 -0
  11. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/doctor.py +5 -6
  12. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/uninstall.py +2 -2
  13. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/health.py +32 -17
  14. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/evdev.py +42 -11
  15. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/platform.py +152 -15
  16. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/noninteractive.py +4 -0
  17. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/steps.py +25 -7
  18. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/system.py +19 -5
  19. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/ydotool.py +12 -9
  20. python_voiceio-1.18.0/voiceio/__init__.py +0 -1
  21. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/LICENSE +0 -0
  22. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/README.md +0 -0
  23. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/python_voiceio.egg-info/dependency_links.txt +0 -0
  24. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/python_voiceio.egg-info/entry_points.txt +0 -0
  25. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/python_voiceio.egg-info/requires.txt +0 -0
  26. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/python_voiceio.egg-info/top_level.txt +0 -0
  27. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/setup.cfg +0 -0
  28. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_announce.py +0 -0
  29. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_app_wiring.py +0 -0
  30. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_audio_quality.py +0 -0
  31. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_audio_source.py +0 -0
  32. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_backend_probes.py +0 -0
  33. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_cancel.py +0 -0
  34. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_cli.py +0 -0
  35. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_clipboard_read.py +0 -0
  36. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_clipboard_typer.py +0 -0
  37. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_commands.py +0 -0
  38. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_concurrency_lockdown.py +0 -0
  39. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_config.py +0 -0
  40. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_context_terms.py +0 -0
  41. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_corrections.py +0 -0
  42. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_dead_mic.py +0 -0
  43. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_decoders.py +0 -0
  44. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_engine.py +0 -0
  45. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_errorlog.py +0 -0
  46. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_fallback.py +0 -0
  47. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_fcitx_bridge.py +0 -0
  48. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_feedback_stream.py +0 -0
  49. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_focus.py +0 -0
  50. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_gpu_fallback.py +0 -0
  51. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_health.py +0 -0
  52. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_hints.py +0 -0
  53. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_history.py +0 -0
  54. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_hotkey_modes.py +0 -0
  55. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_engine_limits.py +0 -0
  56. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_engine_listener.py +0 -0
  57. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_pending.py +0 -0
  58. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_pids.py +0 -0
  59. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_ping.py +0 -0
  60. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_session.py +0 -0
  61. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_textlimit.py +0 -0
  62. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_ibus_typer.py +0 -0
  63. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_idle_audio.py +0 -0
  64. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_install_env.py +0 -0
  65. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_clean.py +0 -0
  66. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_import.py +0 -0
  67. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_language.py +0 -0
  68. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_metrics.py +0 -0
  69. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_pipeline.py +0 -0
  70. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_quiet.py +0 -0
  71. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_resume.py +0 -0
  72. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_review.py +0 -0
  73. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_learn_targets.py +0 -0
  74. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_llm.py +0 -0
  75. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_llm_api.py +0 -0
  76. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_mic_gain.py +0 -0
  77. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_modifier_guard.py +0 -0
  78. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_numbers.py +0 -0
  79. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_paste_last.py +0 -0
  80. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_pipeline.py +0 -0
  81. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_platform.py +0 -0
  82. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_postcorrect.py +0 -0
  83. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_postprocess.py +0 -0
  84. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_prebuffer.py +0 -0
  85. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_presence.py +0 -0
  86. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_prompt.py +0 -0
  87. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_quiet_audio.py +0 -0
  88. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_recorder_integration.py +0 -0
  89. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_report.py +0 -0
  90. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_retention.py +0 -0
  91. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_robustness.py +0 -0
  92. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_server.py +0 -0
  93. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_service.py +0 -0
  94. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_sherpa.py +0 -0
  95. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_spool.py +0 -0
  96. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_streaming.py +0 -0
  97. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_suggest.py +0 -0
  98. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_tokens.py +0 -0
  99. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_transcriber.py +0 -0
  100. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_tray.py +0 -0
  101. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_tts.py +0 -0
  102. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_typer_manager.py +0 -0
  103. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_vad.py +0 -0
  104. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_vocabulary.py +0 -0
  105. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_wordfreq.py +0 -0
  106. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/tests/test_worker_decode.py +0 -0
  107. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/__main__.py +0 -0
  108. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/announce.py +0 -0
  109. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/app.py +0 -0
  110. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/audio_source.py +0 -0
  111. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/backends.py +0 -0
  112. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/__init__.py +0 -0
  113. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/configcmd.py +0 -0
  114. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/corrections.py +0 -0
  115. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/history.py +0 -0
  116. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/learn.py +0 -0
  117. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/models.py +0 -0
  118. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/servicecmd.py +0 -0
  119. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/cli/vocab.py +0 -0
  120. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/clipboard_read.py +0 -0
  121. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/commands.py +0 -0
  122. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/config.py +0 -0
  123. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/consent.py +0 -0
  124. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/context_terms.py +0 -0
  125. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/__init__.py +0 -0
  126. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/bias.py +0 -0
  127. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/__init__.py +0 -0
  128. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/base.py +0 -0
  129. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/catalog.py +0 -0
  130. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
  131. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
  132. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/fetch.py +0 -0
  133. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/lanes.py +0 -0
  134. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/sherpa.py +0 -0
  135. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/decoders/whispercpp.py +0 -0
  136. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/engine.py +0 -0
  137. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/core/pipeline.py +0 -0
  138. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/corrections.py +0 -0
  139. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/data/60-voiceio-uaccess.rules +0 -0
  140. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/data/__init__.py +0 -0
  141. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/demo.py +0 -0
  142. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/display.py +0 -0
  143. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/errorlog.py +0 -0
  144. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/feedback.py +0 -0
  145. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/focus.py +0 -0
  146. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hints.py +0 -0
  147. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/history.py +0 -0
  148. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/__init__.py +0 -0
  149. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/base.py +0 -0
  150. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/chain.py +0 -0
  151. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/pynput_backend.py +0 -0
  152. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/hotkeys/socket_backend.py +0 -0
  153. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/__init__.py +0 -0
  154. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/engine.py +0 -0
  155. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/install.py +0 -0
  156. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/pending.py +0 -0
  157. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/session.py +0 -0
  158. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ibus/textlimit.py +0 -0
  159. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/idle_audio.py +0 -0
  160. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/install_env.py +0 -0
  161. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/__init__.py +0 -0
  162. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/augment.py +0 -0
  163. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/clean.py +0 -0
  164. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/evaluate.py +0 -0
  165. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/importer.py +0 -0
  166. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/metrics.py +0 -0
  167. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/quiet.py +0 -0
  168. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/review.py +0 -0
  169. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/store.py +0 -0
  170. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/teacher.py +0 -0
  171. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/learn/train.py +0 -0
  172. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/llm.py +0 -0
  173. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/llm_api.py +0 -0
  174. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/mic_gain.py +0 -0
  175. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/models/__init__.py +0 -0
  176. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/models/silero_vad.onnx +0 -0
  177. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/numbers.py +0 -0
  178. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/pidlock.py +0 -0
  179. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/postcorrect.py +0 -0
  180. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/postprocess.py +0 -0
  181. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/power.py +0 -0
  182. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/presence.py +0 -0
  183. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/privacy.py +0 -0
  184. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/prompt.py +0 -0
  185. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/quiet_audio.py +0 -0
  186. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/recorder.py +0 -0
  187. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/report.py +0 -0
  188. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/retention.py +0 -0
  189. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/server/__init__.py +0 -0
  190. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/server/__main__.py +0 -0
  191. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/server/app.py +0 -0
  192. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/server/config.py +0 -0
  193. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/server/runtime.py +0 -0
  194. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/service.py +0 -0
  195. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/__init__.py +0 -0
  196. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/configfile.py +0 -0
  197. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/extras.py +0 -0
  198. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/hotkey.py +0 -0
  199. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/speech.py +0 -0
  200. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/setup/ui.py +0 -0
  201. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/sounds/__init__.py +0 -0
  202. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/sounds/alert.wav +0 -0
  203. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/sounds/commit.wav +0 -0
  204. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/sounds/start.wav +0 -0
  205. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/sounds/stop.wav +0 -0
  206. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/spool.py +0 -0
  207. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/streaming.py +0 -0
  208. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/suggest.py +0 -0
  209. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tokens.py +0 -0
  210. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tray/__init__.py +0 -0
  211. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tray/_icons.py +0 -0
  212. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tray/_indicator.py +0 -0
  213. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tray/_pystray.py +0 -0
  214. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/__init__.py +0 -0
  215. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/base.py +0 -0
  216. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/chain.py +0 -0
  217. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/edge_engine.py +0 -0
  218. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/espeak.py +0 -0
  219. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/piper_engine.py +0 -0
  220. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/player.py +0 -0
  221. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/tts/supertonic_engine.py +0 -0
  222. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/__init__.py +0 -0
  223. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/base.py +0 -0
  224. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/chain.py +0 -0
  225. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/clipboard.py +0 -0
  226. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/collecting.py +0 -0
  227. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/fcitx_bridge.py +0 -0
  228. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/ibus.py +0 -0
  229. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/manager.py +0 -0
  230. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/modifier_guard.py +0 -0
  231. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/paste.py +0 -0
  232. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/pynput_type.py +0 -0
  233. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/wtype.py +0 -0
  234. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/typers/xdotool.py +0 -0
  235. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/ui.py +0 -0
  236. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/vad.py +0 -0
  237. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/vocab_stats.py +0 -0
  238. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/vocabulary.py +0 -0
  239. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/watchdog.py +0 -0
  240. {python_voiceio-1.18.0 → python_voiceio-1.18.2}/voiceio/wordfreq.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.0
3
+ Version: 1.18.2
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-voiceio"
7
- version = "1.18.0"
7
+ version = "1.18.2"
8
8
  description = "Voice dictation for Linux. Speak → text, locally, instantly."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.0
3
+ Version: 1.18.2
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -21,11 +21,13 @@ tests/test_concurrency_lockdown.py
21
21
  tests/test_config.py
22
22
  tests/test_context_terms.py
23
23
  tests/test_corrections.py
24
+ tests/test_cuda_setup_hint.py
24
25
  tests/test_dead_mic.py
25
26
  tests/test_decoders.py
26
27
  tests/test_engine.py
27
28
  tests/test_errorlog.py
28
29
  tests/test_evdev_uaccess.py
30
+ tests/test_evdev_x11_optional.py
29
31
  tests/test_fallback.py
30
32
  tests/test_fcitx_bridge.py
31
33
  tests/test_feedback_stream.py
@@ -0,0 +1,173 @@
1
+ """Setup names the CUDA library it can't load instead of a bare "will use CPU"."""
2
+ from __future__ import annotations
3
+
4
+ import sys
5
+ from types import SimpleNamespace
6
+
7
+ import pytest
8
+
9
+ from voiceio import platform as plat
10
+ from voiceio.setup import steps
11
+
12
+
13
+ def _gpu(monkeypatch, count: int, missing: set[str]):
14
+ monkeypatch.setitem(sys.modules, "ctranslate2",
15
+ SimpleNamespace(get_cuda_device_count=lambda: count))
16
+ real = __import__("ctypes").CDLL
17
+
18
+ def cdll(name, *a, **k):
19
+ if name in missing:
20
+ raise OSError(name)
21
+ return real("libc.so.6")
22
+ monkeypatch.setattr("ctypes.CDLL", cdll)
23
+
24
+
25
+ @pytest.fixture
26
+ def mgr(monkeypatch):
27
+ def use(name):
28
+ monkeypatch.setattr(plat, "_detect_pkg_manager", lambda: name)
29
+ return use
30
+
31
+
32
+ def test_no_gpu_is_none(monkeypatch):
33
+ _gpu(monkeypatch, 0, {"libcudnn.so.9"})
34
+ assert plat.missing_cuda_libs() is None
35
+
36
+
37
+ def test_gpu_names_missing_libs(monkeypatch):
38
+ _gpu(monkeypatch, 1, {"libcudnn.so.9"})
39
+ assert plat.missing_cuda_libs() == ["libcudnn.so.9"]
40
+ _gpu(monkeypatch, 1, set())
41
+ assert plat.missing_cuda_libs() == []
42
+
43
+
44
+ @pytest.mark.parametrize("name,pkg", [
45
+ ("emerge", "sudo emerge --ask dev-libs/cudnn"),
46
+ ("pacman", "sudo pacman -S cudnn"),
47
+ ("apt", "sudo apt install nvidia-cudnn"),
48
+ ])
49
+ def test_cudnn_hint_names_the_package(mgr, name, pkg):
50
+ mgr(name)
51
+ hint = plat.cuda_libs_hint(["libcudnn.so.9"])
52
+ assert "separate package from the CUDA toolkit" in hint and f"({pkg}" in hint
53
+ assert "ldconfig -p | grep -E 'cublas.so.12|cudnn.so.9'" in hint
54
+
55
+
56
+ def test_unknown_manager_stays_generic(mgr):
57
+ mgr("dnf")
58
+ hint = plat.cuda_libs_hint(["libcudnn.so.9"])
59
+ assert "(" not in hint.split(".")[0]
60
+
61
+
62
+ def test_cublas_only_skips_cudnn_note(mgr):
63
+ mgr("emerge")
64
+ hint = plat.cuda_libs_hint(["libcublas.so.12"])
65
+ assert "cuDNN" not in hint and hint.startswith("The libraries must be on the loader path")
66
+
67
+
68
+ def test_setup_prints_reason_when_gpu_present(mgr, capsys):
69
+ mgr("emerge")
70
+ steps._print_cuda_check({"cuda": True, "cuda_missing": ["libcudnn.so.9"]})
71
+ out = capsys.readouterr().out
72
+ assert "GPU found, but libcudnn.so.9 can't be loaded: will use CPU" in out
73
+ assert "dev-libs/cudnn" in out and "ldconfig -p" in out
74
+ assert "will use GPU" not in out
75
+
76
+
77
+ @pytest.mark.parametrize("missing", [None, []])
78
+ def test_setup_short_line_without_gpu(capsys, missing):
79
+ steps._print_cuda_check({"cuda": False, "cuda_missing": missing})
80
+ out = capsys.readouterr().out
81
+ assert "will use CPU (still fast)" in out and "ldconfig" not in out
82
+
83
+
84
+ def test_setup_gpu_ok(capsys):
85
+ steps._print_cuda_check({"cuda": True, "cuda_missing": []})
86
+ assert "will use GPU" in capsys.readouterr().out
87
+ steps._print_cuda_check({"cuda": True}) # older checks dicts
88
+ assert "will use GPU" in capsys.readouterr().out
89
+
90
+
91
+ # ── GPU present, but CTranslate2 sees no CUDA device ─────────────────────
92
+
93
+ def _os_gpu(monkeypatch, present: bool, libcuda: bool):
94
+ monkeypatch.setattr(plat, "nvidia_gpu_present", lambda: present)
95
+ real = __import__("ctypes").CDLL
96
+
97
+ def cdll(name, *a, **k):
98
+ if name == "libcuda.so.1" and not libcuda:
99
+ raise OSError(name)
100
+ return real("libc.so.6")
101
+ monkeypatch.setattr("ctypes.CDLL", cdll)
102
+
103
+
104
+ _DEVICE_MSG = ("NVIDIA GPU found, but CTranslate2 sees no CUDA device: check that the "
105
+ "driver's libcuda.so.1 loads (ldconfig -p | grep libcuda.so.1) and that "
106
+ "nvidia-smi works.")
107
+
108
+
109
+ def test_device_problem_when_os_sees_gpu(monkeypatch):
110
+ monkeypatch.setitem(sys.modules, "ctranslate2",
111
+ SimpleNamespace(get_cuda_device_count=lambda: 0))
112
+ _os_gpu(monkeypatch, True, libcuda=True)
113
+ assert plat.cuda_device_problem() == _DEVICE_MSG
114
+
115
+
116
+ def test_device_problem_names_libcuda(monkeypatch):
117
+ monkeypatch.setitem(sys.modules, "ctranslate2",
118
+ SimpleNamespace(get_cuda_device_count=lambda: 0))
119
+ _os_gpu(monkeypatch, True, libcuda=False)
120
+ assert plat.cuda_device_problem().startswith(
121
+ "NVIDIA GPU found, but CTranslate2 sees no CUDA device (libcuda.so.1 can't be loaded): ")
122
+
123
+
124
+ @pytest.mark.parametrize("count,present", [(0, False), (1, True)])
125
+ def test_no_device_problem(monkeypatch, count, present):
126
+ monkeypatch.setitem(sys.modules, "ctranslate2",
127
+ SimpleNamespace(get_cuda_device_count=lambda: count))
128
+ _os_gpu(monkeypatch, present, libcuda=False)
129
+ assert plat.cuda_device_problem() == ""
130
+
131
+
132
+ def test_device_problem_needs_ctranslate2(monkeypatch):
133
+ monkeypatch.setitem(sys.modules, "ctranslate2", None) # import raises
134
+ _os_gpu(monkeypatch, True, libcuda=False)
135
+ assert plat.cuda_device_problem() == ""
136
+
137
+
138
+ def test_nvidia_gpu_present_via_proc_or_smi(monkeypatch):
139
+ import subprocess
140
+ monkeypatch.setattr(plat.os.path, "exists", lambda p: p == "/dev/nvidia0")
141
+ assert plat.nvidia_gpu_present()
142
+ monkeypatch.setattr(plat.os.path, "exists", lambda p: False)
143
+ monkeypatch.setattr(plat.shutil, "which", lambda b: None)
144
+ assert not plat.nvidia_gpu_present()
145
+ monkeypatch.setattr(plat.shutil, "which", lambda b: "/usr/bin/nvidia-smi")
146
+ ok = SimpleNamespace(returncode=0, stdout="GPU 0: NVIDIA GeForce RTX 3060 (UUID: x)\n")
147
+ monkeypatch.setattr(subprocess, "run", lambda *a, **k: ok)
148
+ assert plat.nvidia_gpu_present()
149
+
150
+ def hang(*a, **k):
151
+ raise subprocess.TimeoutExpired("nvidia-smi", 3)
152
+ monkeypatch.setattr(subprocess, "run", hang)
153
+ assert not plat.nvidia_gpu_present()
154
+
155
+
156
+ def test_setup_prints_device_problem(capsys):
157
+ steps._print_cuda_check({"cuda": False, "cuda_missing": None,
158
+ "cuda_device_problem": _DEVICE_MSG})
159
+ out = capsys.readouterr().out
160
+ assert "will use CPU" in out and _DEVICE_MSG in out and "still fast" not in out
161
+
162
+
163
+ def test_doctor_prints_device_problem(monkeypatch):
164
+ from voiceio import health
165
+ from voiceio.config import Config
166
+ cfg = Config()
167
+ cfg.model.name, cfg.model.device = "small", "auto"
168
+ monkeypatch.setattr("voiceio.config.load", lambda: cfg)
169
+ monkeypatch.setattr(plat, "missing_cuda_libs", lambda: None)
170
+ monkeypatch.setattr(plat, "cuda_device_problem", lambda: _DEVICE_MSG)
171
+ assert health._gpu_libs_warning() == _DEVICE_MSG
172
+ monkeypatch.setattr(plat, "cuda_device_problem", lambda: "")
173
+ assert health._gpu_libs_warning() == ""
@@ -31,13 +31,13 @@ def test_rule_ships_as_package_data():
31
31
  assert (ROOT / "voiceio" / "data" / "__init__.py").exists()
32
32
 
33
33
 
34
- def test_install_cmd_is_single_sudo_script():
34
+ def test_install_cmd_is_single_root_script():
35
35
  cmd = evdev_mod.uaccess_install_cmd()
36
- assert cmd[:2] == ["sh", "-c"] and len(cmd) == 3
37
- script = cmd[2]
38
- assert f"sudo tee {evdev_mod.UACCESS_RULE_PATH}" in script
39
- assert "sudo udevadm control --reload-rules" in script
40
- assert "sudo udevadm trigger" in script
36
+ assert cmd[:3] == ["sudo", "sh", "-c"] and len(cmd) == 4
37
+ script = cmd[3]
38
+ assert f"> {evdev_mod.UACCESS_RULE_PATH}" in script
39
+ assert "udevadm control --reload-rules" in script
40
+ assert "udevadm trigger" in script
41
41
  assert "uaccess" in script
42
42
  assert "usermod" not in script
43
43
 
@@ -60,6 +60,7 @@ def _deny_all_inputs(monkeypatch, tmp_path):
60
60
 
61
61
  def test_probe_offers_uaccess_rule(monkeypatch, tmp_path):
62
62
  monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
63
+ monkeypatch.setattr(evdev_mod, "_pynput_covers_hotkey", lambda: False)
63
64
  _deny_all_inputs(monkeypatch, tmp_path)
64
65
  result = evdev_mod.EvdevHotkey().probe()
65
66
  assert not result.ok
@@ -0,0 +1,199 @@
1
+ """On X11 pynput covers the hotkey: evdev access (a root-only udev rule) is
2
+ optional there, and setup/doctor must not fail on it or offer the install."""
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from types import SimpleNamespace
7
+ from unittest.mock import MagicMock, patch
8
+
9
+ import pytest
10
+
11
+ from voiceio import config, health
12
+ from voiceio import platform as plat
13
+ from voiceio.backends import ProbeResult
14
+ from voiceio.hotkeys import evdev as evdev_mod
15
+ from voiceio.platform import Platform
16
+
17
+ _DENIED = ProbeResult(ok=False, reason="No permission to read /dev/input",
18
+ fix_hint="install udev rule", fix_cmd=evdev_mod.uaccess_install_cmd())
19
+
20
+
21
+ def _cfg(backend="auto"):
22
+ return SimpleNamespace(hotkey=SimpleNamespace(backend=backend),
23
+ llm=SimpleNamespace(enabled=False))
24
+
25
+
26
+ def _report(display, pynput_ok=True, backend="auto", monkeypatch=None):
27
+ monkeypatch.setattr(config, "load", lambda *a, **k: _cfg(backend))
28
+ p = Platform(os="linux", display_server=display, desktop="kde")
29
+ chain = ([("pynput", MagicMock(), ProbeResult(ok=pynput_ok, reason="pynput missing"))]
30
+ if display == "x11" else [])
31
+ chain += [("evdev", MagicMock(), _DENIED), ("socket", MagicMock(), ProbeResult(ok=True))]
32
+ with patch("voiceio.health.hotkey_chain.resolve", lambda platform: chain), \
33
+ patch("voiceio.health.typer_chain.resolve",
34
+ lambda platform: [("xdotool", MagicMock(), ProbeResult(ok=True))]), \
35
+ patch.dict("sys.modules", {"sounddevice": MagicMock()}):
36
+ return health.check_health(p)
37
+
38
+
39
+ def _evdev(report):
40
+ return next(b for b in report.hotkey_backends if b.name == "evdev")
41
+
42
+
43
+ @pytest.mark.parametrize("display,pynput_ok,backend,expected", [
44
+ ("x11", True, "auto", True),
45
+ ("x11", True, "pynput", True),
46
+ ("x11", True, "evdev", False), # pinned: evdev is the hotkey
47
+ ("x11", False, "auto", False), # no pynput: evdev is next in the chain
48
+ ("wayland", True, "auto", False), # evdev is the only physical listener
49
+ ("unknown", True, "auto", False),
50
+ ])
51
+ def test_evdev_optional(display, pynput_ok, backend, expected):
52
+ assert evdev_mod.evdev_optional(display, pynput_ok, backend) is expected
53
+
54
+
55
+ def test_doctor_shows_evdev_optional_on_x11_with_pynput(monkeypatch):
56
+ report = _report("x11", monkeypatch=monkeypatch)
57
+ b = _evdev(report)
58
+ assert b.optional and not b.fix_cmd and not b.fix_hint
59
+ assert report.all_ok
60
+ line = next(ln for ln in health.format_report(report).splitlines() if "evdev" in ln)
61
+ assert "pynput handles the hotkey on X11" in line
62
+ assert "✗" not in line
63
+ assert "udev" not in health.format_report(report)
64
+
65
+
66
+ @pytest.mark.parametrize("display,pynput_ok,backend", [
67
+ ("wayland", True, "auto"), ("x11", False, "auto"), ("x11", True, "evdev"),
68
+ ])
69
+ def test_doctor_keeps_evdev_fix_elsewhere(monkeypatch, display, pynput_ok, backend):
70
+ b = _evdev(_report(display, pynput_ok, backend, monkeypatch=monkeypatch))
71
+ assert not b.optional
72
+ assert b.fix_cmd == evdev_mod.uaccess_install_cmd()
73
+
74
+
75
+ def _run_doctor_fix(monkeypatch, report):
76
+ from voiceio import install_env
77
+ from voiceio.cli import doctor
78
+ privileged, ran = [], []
79
+ monkeypatch.setattr(health, "check_health", lambda: report)
80
+ monkeypatch.setattr(health, "format_report", lambda r: "")
81
+ monkeypatch.setattr(health, "usage_findings", lambda: [])
82
+ monkeypatch.setattr(plat, "check_system_deps", lambda: [])
83
+ monkeypatch.setattr(config, "check_permissions", lambda: [])
84
+ monkeypatch.setattr(install_env, "stale_install_paths", lambda: [])
85
+ monkeypatch.setattr(install_env, "running_ephemeral", lambda: False)
86
+ monkeypatch.setattr(doctor, "_offer_report", lambda *a: False)
87
+ monkeypatch.setattr(doctor, "_run_privileged", lambda *a, **k: privileged.append(a))
88
+ monkeypatch.setattr("subprocess.run", lambda *a, **k: ran.append(a))
89
+ report.cli_in_path = True
90
+ with pytest.raises(SystemExit):
91
+ doctor._cmd_doctor(argparse.Namespace(live=False, fix=True, report=False))
92
+ return privileged, ran
93
+
94
+
95
+ def test_doctor_fix_skips_udev_install_on_x11_with_pynput(monkeypatch):
96
+ privileged, ran = _run_doctor_fix(monkeypatch, _report("x11", monkeypatch=monkeypatch))
97
+ assert privileged == [] and ran == []
98
+
99
+
100
+ def test_doctor_fix_still_offers_udev_install_on_wayland(monkeypatch):
101
+ privileged, _ = _run_doctor_fix(monkeypatch, _report("wayland", monkeypatch=monkeypatch))
102
+ assert [a[0] for a in privileged] == ["Fix evdev"]
103
+
104
+
105
+ def test_probe_drops_udev_fix_when_pynput_covers(monkeypatch, tmp_path):
106
+ from pathlib import Path
107
+ monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
108
+ monkeypatch.setattr(evdev_mod, "_pynput_covers_hotkey", lambda: True)
109
+ (tmp_path / "event0").write_text("")
110
+ monkeypatch.setattr(Path, "glob", lambda self, pat: [tmp_path / "event0"])
111
+
112
+ def deny(*a, **k):
113
+ raise PermissionError
114
+ monkeypatch.setattr("builtins.open", deny)
115
+ result = evdev_mod.EvdevHotkey().probe()
116
+ assert not result.ok and not result.fix_cmd
117
+ assert result.fix_hint == evdev_mod.NOT_NEEDED_ON_X11
118
+
119
+
120
+ def test_pynput_covers_hotkey_reads_display_and_config(monkeypatch):
121
+ from voiceio.hotkeys import pynput_backend
122
+ monkeypatch.setattr(pynput_backend.PynputHotkey, "probe", lambda self: ProbeResult(ok=True))
123
+ monkeypatch.setattr(plat, "_detect_display_server", lambda: "x11")
124
+ monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("auto"))
125
+ assert evdev_mod._pynput_covers_hotkey()
126
+ monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("evdev"))
127
+ assert not evdev_mod._pynput_covers_hotkey()
128
+ monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("auto"))
129
+ monkeypatch.setattr(plat, "_detect_display_server", lambda: "wayland")
130
+ assert not evdev_mod._pynput_covers_hotkey()
131
+
132
+
133
+ # ── setup ────────────────────────────────────────────────────────────────
134
+
135
+ _CHECKS = {
136
+ "is_windows": False, "is_mac": False, "is_linux": True, "display": "x11",
137
+ "audio": True, "audio_devices": [object()], "pynput": True, "xdotool": True,
138
+ "xclip": False, "ydotool": False, "wtype": False, "ibus": False, "ibus_gi": False,
139
+ "cuda": False, "evdev_access": False, "evdev_optional": True,
140
+ }
141
+
142
+
143
+ def test_setup_shows_evdev_optional_on_x11(capsys):
144
+ from voiceio.setup import steps
145
+ steps._print_capability_checks(dict(_CHECKS))
146
+ line = next(ln for ln in capsys.readouterr().out.splitlines() if "evdev" in ln)
147
+ assert "pynput handles the hotkey on X11" in line
148
+ assert "✗" not in line and "doctor --fix" not in line
149
+
150
+
151
+ def test_setup_keeps_evdev_hint_on_wayland(capsys, monkeypatch):
152
+ from voiceio.setup import steps
153
+ monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
154
+ steps._print_capability_checks(dict(_CHECKS, display="wayland", pynput=False,
155
+ evdev_optional=False))
156
+ line = next(ln for ln in capsys.readouterr().out.splitlines() if "evdev" in ln)
157
+ assert "✗" in line and "doctor --fix" in line
158
+
159
+
160
+ def test_check_system_detects_pynput_on_startx_x11(monkeypatch):
161
+ """XDG_SESSION_TYPE=tty under startx: DISPLAY still says X11."""
162
+ from voiceio.hotkeys import pynput_backend
163
+ from voiceio.setup import system
164
+ monkeypatch.setenv("XDG_SESSION_TYPE", "tty")
165
+ monkeypatch.setenv("DISPLAY", ":0")
166
+ monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)
167
+ monkeypatch.setattr("sys.platform", "linux")
168
+ monkeypatch.setattr(plat, "_detect_os", lambda: "linux")
169
+ monkeypatch.setattr(pynput_backend.PynputHotkey, "probe", lambda self: ProbeResult(ok=True))
170
+ monkeypatch.setattr(evdev_mod.EvdevHotkey, "probe", lambda self: _DENIED)
171
+ checks = system._check_system()
172
+ assert checks["display"] == "x11"
173
+ assert checks["pynput"] and not checks["evdev_access"] and checks["evdev_optional"]
174
+
175
+
176
+ def test_setup_picks_auto_backend_on_x11_without_evdev(monkeypatch):
177
+ from voiceio.setup import steps
178
+ monkeypatch.setattr("voiceio.ibus.install.ensure", lambda: True)
179
+ state = steps.SetupState(checks=dict(_CHECKS))
180
+ steps._select_output_backend(state)
181
+ assert state.backend == "auto" # pynput first, not the socket-only fallback
182
+
183
+
184
+ # ── install commands ─────────────────────────────────────────────────────
185
+
186
+ @pytest.mark.parametrize("cmd,rule_path", [
187
+ (evdev_mod.uaccess_install_cmd(), evdev_mod.UACCESS_RULE_PATH),
188
+ ])
189
+ def test_install_cmd_creates_rules_dir_first(cmd, rule_path):
190
+ script = cmd[-1]
191
+ assert cmd[:3] == ["sudo", "sh", "-c"]
192
+ assert script.index("mkdir -p /etc/udev/rules.d") < script.index(f"> {rule_path}")
193
+ assert "sudo" not in script
194
+
195
+
196
+ def test_ydotool_install_cmd_creates_rules_dir_first():
197
+ from voiceio.typers import ydotool
198
+ test_install_cmd_creates_rules_dir_first(ydotool.uinput_udev_install_cmd(),
199
+ ydotool.UINPUT_UDEV_RULE_PATH)
@@ -188,7 +188,7 @@ def test_uinput_install_cmd_uses_sudo_not_chmod_0666():
188
188
  from voiceio.typers import ydotool
189
189
  cmd = ydotool.uinput_udev_install_cmd()
190
190
  joined = " ".join(cmd)
191
- assert "sudo tee" in joined
191
+ assert cmd[0] == "sudo" and "> /etc/udev/rules.d/" in joined
192
192
  assert "udevadm control --reload-rules" in joined
193
193
  assert "chmod 0666" not in joined
194
194
 
@@ -201,7 +201,7 @@ def test_ydotool_probe_offers_udev_not_chmod(monkeypatch):
201
201
  result = ydotool.YdotoolTyper().probe()
202
202
  assert not result.ok
203
203
  assert "chmod 0666" not in " ".join(result.fix_cmd)
204
- assert "sudo tee" in " ".join(result.fix_cmd)
204
+ assert result.fix_cmd[0] == "sudo" and "udevadm" in " ".join(result.fix_cmd)
205
205
 
206
206
 
207
207
  # ── doctor --fix consent prompt for privileged actions ───────────────────
@@ -352,11 +352,20 @@ def test_setup_offers_nightly_learning_once(monkeypatch):
352
352
 
353
353
  # ── root commands with no terminal (agent, launcher, GUI) ────────────
354
354
 
355
- def _no_terminal(monkeypatch, *, sudo_cached=False, pkexec=True, display=True):
355
+ def _tools(monkeypatch, *names):
356
+ """Only these privilege tools are on PATH; not running as root."""
357
+ monkeypatch.setattr(plat, "_is_root", lambda: False)
358
+ monkeypatch.setattr(plat.shutil, "which",
359
+ lambda name: f"/usr/bin/{name}" if name in names else None)
360
+
361
+
362
+ def _no_terminal(monkeypatch, *, sudo_cached=False, pkexec=True, display=True,
363
+ sudo=True, doas=False, doas_cached=False):
356
364
  monkeypatch.setattr(plat, "_has_tty", lambda: False)
357
365
  monkeypatch.setattr(plat, "_sudo_without_password", lambda: sudo_cached)
358
- monkeypatch.setattr(plat.shutil, "which",
359
- lambda name: "/usr/bin/pkexec" if pkexec and name == "pkexec" else None)
366
+ monkeypatch.setattr(plat, "_doas_without_password", lambda: doas_cached)
367
+ _tools(monkeypatch, *[n for n, on in (("sudo", sudo), ("doas", doas),
368
+ ("pkexec", pkexec)) if on])
360
369
  monkeypatch.delenv("DISPLAY", raising=False)
361
370
  if display:
362
371
  monkeypatch.setenv("WAYLAND_DISPLAY", "wayland-0")
@@ -366,6 +375,7 @@ def _no_terminal(monkeypatch, *, sudo_cached=False, pkexec=True, display=True):
366
375
 
367
376
  def test_privileged_argv_unchanged_with_a_terminal(monkeypatch):
368
377
  monkeypatch.setattr(plat, "_has_tty", lambda: True)
378
+ _tools(monkeypatch, "sudo", "doas", "pkexec")
369
379
  argv = ["sudo", "apt", "install", "ibus"]
370
380
  assert plat.privileged_argv(argv) == argv
371
381
 
@@ -395,6 +405,8 @@ def test_privileged_argv_drops_emerge_ask_without_a_terminal(monkeypatch):
395
405
  "pkexec", "emerge", "media-libs/portaudio"]
396
406
  monkeypatch.setattr(plat, "_has_tty", lambda: True)
397
407
  assert plat.privileged_argv(["sudo", "emerge", "--ask", "x"]) == ["sudo", "emerge", "--ask", "x"]
408
+ _tools(monkeypatch, "doas")
409
+ assert plat.privileged_argv(["sudo", "emerge", "--ask", "x"]) == ["doas", "emerge", "--ask", "x"]
398
410
 
399
411
 
400
412
  def test_privileged_argv_prefers_cached_sudo(monkeypatch):
@@ -403,6 +415,66 @@ def test_privileged_argv_prefers_cached_sudo(monkeypatch):
403
415
  "sudo", "-n", "apt", "install", "-y", "x"]
404
416
 
405
417
 
418
+ def test_privileged_argv_uses_doas_with_a_terminal_when_no_sudo(monkeypatch):
419
+ monkeypatch.setattr(plat, "_has_tty", lambda: True)
420
+ _tools(monkeypatch, "doas", "pkexec")
421
+ assert plat.privileged_argv(["sudo", "apt", "install", "x"]) == ["doas", "apt", "install", "x"]
422
+ _tools(monkeypatch, "sudo", "doas")
423
+ assert plat.privileged_argv(["sudo", "apt", "install", "x"]) == ["sudo", "apt", "install", "x"]
424
+
425
+
426
+ def test_privileged_argv_runs_the_udev_fix_under_doas(monkeypatch):
427
+ from voiceio.hotkeys.evdev import uaccess_install_cmd
428
+ monkeypatch.setattr(plat, "_has_tty", lambda: True)
429
+ _tools(monkeypatch, "doas")
430
+ cmd = uaccess_install_cmd()
431
+ argv = plat.privileged_argv(cmd)
432
+ assert argv == ["doas", *cmd[1:]]
433
+ assert "sudo" not in " ".join(argv) # the script itself never calls sudo
434
+
435
+
436
+ def test_privileged_argv_without_terminal_order_is_sudo_doas_pkexec(monkeypatch):
437
+ argv = ["sudo", "apt", "install", "x"]
438
+ _no_terminal(monkeypatch, sudo_cached=True, doas=True, doas_cached=True)
439
+ assert plat.privileged_argv(argv) == ["sudo", "-n", "apt", "install", "-y", "x"]
440
+ _no_terminal(monkeypatch, sudo_cached=False, doas=True, doas_cached=True)
441
+ assert plat.privileged_argv(argv) == ["doas", "-n", "apt", "install", "-y", "x"]
442
+ _no_terminal(monkeypatch, sudo=False, doas=True, doas_cached=True)
443
+ assert plat.privileged_argv(argv) == ["doas", "-n", "apt", "install", "-y", "x"]
444
+ _no_terminal(monkeypatch, doas=True, doas_cached=False)
445
+ assert plat.privileged_argv(argv) == ["pkexec", "apt", "install", "-y", "x"]
446
+
447
+
448
+ def test_privileged_argv_as_root_drops_sudo(monkeypatch):
449
+ _tools(monkeypatch)
450
+ monkeypatch.setattr(plat, "_is_root", lambda: True)
451
+ assert plat.privileged_argv(["sudo", "udevadm", "trigger"]) == ["udevadm", "trigger"]
452
+
453
+
454
+ def test_privileged_argv_none_without_any_tool(monkeypatch, capsys):
455
+ from voiceio.cli import doctor
456
+ from voiceio.hotkeys.evdev import uaccess_install_cmd
457
+ monkeypatch.setattr(plat, "_has_tty", lambda: True)
458
+ _tools(monkeypatch)
459
+ cmd = uaccess_install_cmd()
460
+ assert plat.privileged_argv(cmd) is None
461
+ msg = plat.privilege_unavailable_message(cmd)
462
+ assert "as root" in msg and "su" in msg
463
+ assert "sudo" not in msg.split("\n", 1)[1] # the command to paste in a root shell
464
+ assert "mkdir -p /etc/udev/rules.d" in msg
465
+ # doctor --fix prints that instead of running anything
466
+ ran = []
467
+ monkeypatch.setattr("subprocess.run", lambda *a, **k: ran.append(a))
468
+ monkeypatch.setattr(doctor, "_confirm_privileged", lambda d, c: True)
469
+ assert doctor._run_privileged("Fix evdev", cmd, 5) is False
470
+ assert ran == [] and "as root" in capsys.readouterr().out
471
+
472
+
473
+ def test_as_root_command_strips_sudo():
474
+ assert plat.as_root_command(["sudo", "emerge", "--ask", "x"]) == "emerge --ask x"
475
+ assert plat.as_root_command(["sh", "-c", "a | sudo tee f && sudo -n b"]) == "sh -c 'a | tee f && b'"
476
+
477
+
406
478
  @pytest.mark.parametrize("pkexec,display", [(False, True), (True, False)])
407
479
  def test_privileged_argv_gives_up_without_pkexec_or_desktop(monkeypatch, pkexec, display):
408
480
  _no_terminal(monkeypatch, pkexec=pkexec, display=display)
@@ -0,0 +1 @@
1
+ __version__ = "1.18.2"
@@ -2,6 +2,7 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import argparse
5
+ import shlex
5
6
  import sys
6
7
 
7
8
 
@@ -44,13 +45,12 @@ def _confirm_privileged(description: str, command_str: str) -> bool:
44
45
 
45
46
  def _run_privileged(description: str, argv: list[str], timeout: float,
46
47
  cmd_str: str | None = None) -> bool | None:
47
- """Ask first, then run a root command: sudo with a terminal, else pkexec
48
- (see platform.privileged_argv), else print it for the user to run.
48
+ """Ask first, then run a root command with sudo, doas or pkexec (see
49
+ platform.privileged_argv), else print it for the user to run as root.
49
50
 
50
51
  Returns True when it ran, False when it failed or could not run, None
51
52
  when the user declined. Raises nothing.
52
53
  """
53
- import shlex
54
54
  import subprocess
55
55
 
56
56
  from voiceio import platform as plat
@@ -59,8 +59,7 @@ def _run_privileged(description: str, argv: list[str], timeout: float,
59
59
  return None
60
60
  run_argv = plat.privileged_argv(argv)
61
61
  if run_argv is None:
62
- print(" No terminal for sudo to ask your password, and no pkexec. Run it yourself:")
63
- print(f" {cmd_str}")
62
+ print(plat.privilege_unavailable_message(argv))
64
63
  return False
65
64
  try:
66
65
  subprocess.run(run_argv, check=True, timeout=timeout)
@@ -155,7 +154,7 @@ def _cmd_doctor(args: argparse.Namespace) -> None:
155
154
 
156
155
  for b in report.hotkey_backends + report.typer_backends:
157
156
  if not b.ok and b.fix_cmd:
158
- cmd_str = " ".join(b.fix_cmd)
157
+ cmd_str = shlex.join(b.fix_cmd)
159
158
  if _is_privileged_cmd(b.fix_cmd):
160
159
  ran = _run_privileged(f"Fix {b.name}", b.fix_cmd, 120, cmd_str=cmd_str)
161
160
  if ran is None:
@@ -165,10 +165,10 @@ def _cmd_uninstall() -> None:
165
165
  continue
166
166
  cmd = f"sudo rm {rule_path}"
167
167
  if _confirm_privileged(f"Remove the voiceio {what} udev rule", cmd):
168
- from voiceio.platform import privileged_argv
168
+ from voiceio.platform import privilege_unavailable_message, privileged_argv
169
169
  argv = privileged_argv(["sudo", "rm", rule_path])
170
170
  if argv is None:
171
- print(f" No terminal for sudo to ask your password. Run manually: {cmd}")
171
+ print(privilege_unavailable_message(["sudo", "rm", rule_path]))
172
172
  continue
173
173
  try:
174
174
  subprocess.run(argv, timeout=120)