From a8f0ed5b2b883472f9770f63189f11d03d06a346 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 24 Jun 2024 09:17:08 -0400 Subject: [PATCH] [MAINT] Deprecate distutils in favor of setuptools (#635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [MAINT] Deprecate distutils in favor of setuptools * In CPython 3.10 distutils was formally marked as deprecated and was removed in Python 3.12 (https://peps.python.org/pep-0632/). Switch to using setuptools as a replacement, which offers a direct port of 'distutils.errors' as 'setuptools.errors'. * [CI] Ensure setuptools installed for tests * To ensure that setuptools is available for setuptools.errors install it for all the tests in the CI. - setuptools.errors was added in v60.0.0 - c.f. https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html --------- Co-authored-by: RĂ©mi Flamary --- .github/workflows/build_tests.yml | 8 ++++---- .github/workflows/build_tests_cuda.yml | 3 ++- .github/workflows/build_wheels.yml | 4 ++-- .github/workflows/build_wheels_weekly.yml | 2 +- ot/helpers/openmp_helpers.py | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index b42dd2b0f..cd45633de 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -35,7 +35,7 @@ jobs: pip install -e . - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools pip install -r requirements_all.txt pip install pytest pytest-cov - name: Run tests @@ -55,7 +55,7 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools pip install flake8 - name: Lint with flake8 run: | @@ -76,7 +76,7 @@ jobs: python-version: "3.10" - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools pip install pytest pytest-cov - name: Install POT run: | @@ -107,7 +107,7 @@ jobs: pip install -e . - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools pip install -r requirements_all.txt pip install pytest - name: Run tests diff --git a/.github/workflows/build_tests_cuda.yml b/.github/workflows/build_tests_cuda.yml index be8e47c8b..2d4e452c5 100644 --- a/.github/workflows/build_tests_cuda.yml +++ b/.github/workflows/build_tests_cuda.yml @@ -15,7 +15,8 @@ jobs: - uses: actions/checkout@v4 - name: Install POT run: | - python3.10 -m pip install --ignore-installed -e . + python3.10 -m pip install --upgrade pip setuptools + python3.10 -m pip install --ignore-installed -e . - name: Run tests run: | python3.10 -m pytest --durations=20 -v test/ ot/ --doctest-modules --color=yes --ignore=test/test_dr.py --ignore=ot.dr --ignore=ot.plot diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index c60babff6..ca3824975 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools - name: Install cibuildwheel run: | @@ -61,7 +61,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools - name: Install cibuildwheel run: | diff --git a/.github/workflows/build_wheels_weekly.yml b/.github/workflows/build_wheels_weekly.yml index 4746a3676..f528c2dce 100644 --- a/.github/workflows/build_wheels_weekly.yml +++ b/.github/workflows/build_wheels_weekly.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools - name: Install cibuildwheel run: | diff --git a/ot/helpers/openmp_helpers.py b/ot/helpers/openmp_helpers.py index a6ad38b06..90a2918da 100644 --- a/ot/helpers/openmp_helpers.py +++ b/ot/helpers/openmp_helpers.py @@ -9,7 +9,7 @@ import textwrap import subprocess -from distutils.errors import CompileError, LinkError +from setuptools.errors import CompileError, LinkError from pre_build_helpers import compile_test_program