Skip to content

Commit

Permalink
[MAINT] Deprecate distutils in favor of setuptools (#635)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
matthewfeickert and rflamary authored Jun 24, 2024
1 parent f8f298d commit a8f0ed5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_tests_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion ot/helpers/openmp_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a8f0ed5

Please sign in to comment.