Support NumPy 2 compatible installs - #168
Conversation
There was a problem hiding this comment.
Code Review
This pull request relaxes dependency constraints in pyproject.toml (including removing the upper bound on NumPy) and resolves NumPy 2.0 compatibility issues by replacing deprecated np.int with int. It also replaces the Librosa dependency in test_fft with a custom NumPy-based STFT reference. The review feedback suggests using bitwise operations to calculate the next power of two more robustly, points out other files in the repository that still contain np.int, and recommends using np.lib.stride_tricks.sliding_window_view in the test to avoid unnecessary memory copies.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
This PR updates ClearVoice dependency constraints and a NumPy compatibility issue so the package can work in environments using NumPy 2.x while still allowing NumPy 1.24.3+.
Changes:
<2.0upper boundnp.intusage with built-ininttest_fft()to compareConvSTFTagainst a reference with matching framing semanticsWhy
The current package metadata blocks NumPy 2 installs via
numpy>=1.24.3,<2.0. NumPy 2 also removes deprecated aliases such asnp.int, which causes runtime failures inConvSTFT.Keeping
numpy>=1.24.3allows existing NumPy 1.x users to continue installing ClearVoice while also allowing newer NumPy 2.x environments.The
test_fft()helper previously compared againstlibrosa.stft, which usesn_fft-based framing for these parameters.ConvSTFTuseswin_len-based framing, so the helper could fail with a shape mismatch. The updated reference uses the same framing convention asConvSTFT.Validation
Tested locally with NumPy 2.4.6:
python -m pip checkpython -m compileall -q clearvoice speechscore trainclearvoicemodules: 51 modules, 0 failuresConvSTFT/ConviSTFTsmoke testtest_fft(); MSE was approximately1.14e-11