From 4ade7f32f995a3b6ffbf1928a4a75f2761dd4bcf Mon Sep 17 00:00:00 2001 From: hongtaozhang Date: Thu, 20 Feb 2025 12:15:08 -0800 Subject: [PATCH] Add 3.11 and 3.13 support. --- .azure-pipelines/cpu-unit-test.yml | 8 ++++++-- setup.py | 17 ++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.azure-pipelines/cpu-unit-test.yml b/.azure-pipelines/cpu-unit-test.yml index 12d5404a7..142af0102 100644 --- a/.azure-pipelines/cpu-unit-test.yml +++ b/.azure-pipelines/cpu-unit-test.yml @@ -13,9 +13,13 @@ strategy: imageTag: '3.8' python-3.10: imageTag: '3.10' + python-3.11: + imageTag: '3.11' python-3.12: imageTag: '3.12' - maxParallel: 4 + python-3.13: + imageTag: '3.13' + maxParallel: 6 pool: vmImage: ubuntu-latest @@ -28,7 +32,7 @@ steps: echo "##vso[task.prependpath]$HOME/.local/bin" displayName: Export path - script: | - if [[ "$(echo $(imageTag) '< 3.12' | bc -l)" == 1 ]]; then + if [[ "$(echo $(imageTag) '< 3.11' | bc -l)" == 1 ]]; then python3 -m pip install --upgrade pip setuptools==65.7 else python3 -m pip install --upgrade pip diff --git a/setup.py b/setup.py index 7d5393f3a..221eb4e09 100644 --- a/setup.py +++ b/setup.py @@ -27,12 +27,6 @@ 'python3 -m pip install --upgrade pip wheel setuptools==65.7\033[0m' ) raise -elif sys.version_info[:2] != (3, 12): - print( - f'\033[0mPython {sys.version_info.major}.{sys.version_info.minor} is not supported yet, ' - 'please use Python 3.7, 3.8, 3.9, 3.10 or 3.12.\033[0m' - ) - sys.exit(1) here = pathlib.Path(__file__).parent.resolve() long_description = (here / 'README.md').read_text(encoding='utf-8') @@ -59,8 +53,8 @@ def finalize_options(self): def run(self): """Fromat the code using yapf.""" - if sys.version_info[:2] == (3, 12): - print('Disable yapf for Python 3.12 due to the compatibility issue.') + if sys.version_info[:2] >= (3, 12): + print('Disable yapf for Python 3.12+ due to the compatibility issue.') else: errno = os.system('python3 -m yapf --in-place --recursive --exclude .git --exclude .eggs .') sys.exit(0 if errno == 0 else 1) @@ -87,11 +81,12 @@ def finalize_options(self): def run(self): """Lint the code with yapf, mypy, and flake8.""" - # Disable yapf for Python 3.12 due to the compatibility issue. + if sys.version_info[:2] >= (3, 12): + print('Disable lint for Python 3.12+ due to the compatibility issue.') errno = os.system( ' && '.join( [ - 'python3 -m yapf --diff --recursive --exclude .git --exclude .eggs .' if sys.version_info[:2] != + 'python3 -m yapf --diff --recursive --exclude .git --exclude .eggs .' if sys.version_info[:2] < (3, 12) else ':', 'python3 -m mypy .', 'python3 -m flake8', @@ -200,7 +195,7 @@ def run(self): extras_require=( lambda x: { **x, - 'develop': x['dev'] + x['test'] + x['torch'], + 'develop': x['dev'] + x['test'], 'cpuworker': x['torch'], 'amdworker': x['torch'] + x['amd'], 'nvworker': x['torch'] + x['ort'] + x['nvidia'],