Fix voice sample validation on Python 3.13 (fixes #852)#853
Fix voice sample validation on Python 3.13 (fixes #852)#853maskedsyntax wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds a Python 3.13+ conditional dependency on ChangesAudioop Python 3.13 compatibility fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Related Issues: Suggested labels: bug, python3.13, dependencies, tests Suggested reviewers: jamiepine 🐰 A hop, a skip, a version check, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/tests/test_audioop_python313.py (1)
71-83: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicate
FakeVersionInfoclass in both build-arg tests.Extract into a shared module-level helper/fixture to avoid the identical class definition in
test_pyinstaller_includes_audioop_on_python_313andtest_pyinstaller_omits_audioop_on_python_312.♻️ Suggested consolidation
+class _FakeVersionInfo(tuple): + `@property` + def major(self): + return self[0] + + `@property` + def minor(self): + return self[1] + + `@property` + def micro(self): + return self[2] + + class TestAudioopBuildArgs: `@staticmethod` def _hidden_imports(args): imports = [] for i, arg in enumerate(args): if arg == "--hidden-import" and i + 1 < len(args): imports.append(args[i + 1]) return imports def test_pyinstaller_includes_audioop_on_python_313(self): - class FakeVersionInfo(tuple): - `@property` - def major(self): - return self[0] - - `@property` - def minor(self): - return self[1] - - `@property` - def micro(self): - return self[2] - - fake_313 = FakeVersionInfo((3, 13, 0, "final", 0)) + fake_313 = _FakeVersionInfo((3, 13, 0, "final", 0))Also applies to: 99-111
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/tests/test_audioop_python313.py` around lines 71 - 83, The identical FakeVersionInfo helper is duplicated across the two PyInstaller audioop tests, so move it to a shared module-level helper or fixture and reuse it from both test_pyinstaller_includes_audioop_on_python_313 and test_pyinstaller_omits_audioop_on_python_312. Keep the tuple-based version behavior the same, but define it once near the test helpers so the tests reference the same FakeVersionInfo symbol instead of re-declaring the class.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@backend/tests/test_audioop_python313.py`:
- Around line 71-83: The identical FakeVersionInfo helper is duplicated across
the two PyInstaller audioop tests, so move it to a shared module-level helper or
fixture and reuse it from both test_pyinstaller_includes_audioop_on_python_313
and test_pyinstaller_omits_audioop_on_python_312. Keep the tuple-based version
behavior the same, but define it once near the test helpers so the tests
reference the same FakeVersionInfo symbol instead of re-declaring the class.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 13f1d4dd-4669-488b-b89c-aa1939a6e580
📒 Files selected for processing (3)
backend/build_binary.pybackend/requirements.txtbackend/tests/test_audioop_python313.py
ad8d68b to
fda8d82
Compare
Python 3.13 removed audioop from the standard library, which broke reference audio validation when adding voice samples. Add the audioop-lts backport for 3.13+ installs and bundle audioop in PyInstaller builds on the same versions.
fda8d82 to
bf74939
Compare
Summary
Fixes #852. Python 3.13 dropped
audioopfrom the standard library, but reference audio validation still needs it through librosa and audioread. Uploading a voice sample then fails withNo module named 'audioop'.This adds the
audioop-ltsbackport for Python 3.13 and above, and tells PyInstaller to bundleaudioopwhen building on those versions.Test plan
audioop-lts: validation returnsError validating audio: No module named 'audioop'audioop-ltspytest backend/tests/test_audioop_python313.py -von Python 3.13 (5 passed)pytest backend/tests/test_audio_preprocess.py -von Python 3.13 (9 passed)Summary by CodeRabbit
audioopmodule is unavailable.