From 65dbf46cdbdc681af3d86497d468f4ccb8a89e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:06:09 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Hackathon=208th=20No.7=E3=80=91Python?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=80=82=E9=85=8D=204=20(#3970)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update setup.py * auto scipy * auto matplotlib * Update setup.py * Apply suggestions from code review --- setup.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 59a3e7db1..fa53b5d7e 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,26 @@ def determine_opencc_version(): return "opencc" # default +def determine_scipy_version(): + # get python version + python_version = f"{sys.version_info.major}.{sys.version_info.minor}" + + # determine scipy version + if python_version == "3.8": + return "scipy>=1.4.0, <=1.12.0" # Python3.8 need scipy>=1.4.0, <=1.12.0 + return "scipy" # default + + +def determine_matplotlib_version(): + # get python version + python_version = f"{sys.version_info.major}.{sys.version_info.minor}" + + # determine matplotlib version + if python_version == "3.8" or python_version == "3.9": + return "matplotlib<=3.8.4" # Python3.8/9 need matplotlib<=3.8.4 + return "matplotlib" # default + + base = [ "braceexpand", "editdistance", @@ -63,9 +83,9 @@ base = [ # paddleaudio align with librosa==0.8.1, which need numpy==1.23.x "numpy==1.23.5", "librosa==0.8.1", - "scipy>=1.4.0, <=1.12.0", + determine_scipy_version(), # scipy or scipy>=1.4.0, <=1.12.0 "loguru", - "matplotlib<=3.8.4", + determine_matplotlib_version(), # matplotlib or matplotlib<=3.8.4 "nara_wpe", "onnxruntime>=1.11.0", determine_opencc_version(), # opencc or opencc==1.1.6 @@ -92,7 +112,7 @@ base = [ "ToJyutping", "typeguard", "webrtcvad", - "yacs~=0.1.8", + "yacs>=0.1.8", "zhon", ]