From 3302cd48cdcc5d4832997bae921952cc3917fb59 Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Wed, 23 Feb 2022 09:53:13 +0100 Subject: [MRG] Build POT against oldest-supported-numpy (local PR) (#349) * Configure setup to compile against oldest supported numpy version using the meta-package: https://pypi.org/project/oldest-supported-numpy/ - * Set minimum Python requirement to `>=3.7` in setup.py since !328 removed Python 3.6 support * Fix typo in pyproject.toml - * Update setup.py * Update setup.py and * build wheels * remove install dependencies for wheels building and build wheels * Apply suggestions from code review Co-authored-by: David M. Ghiurco <9147386+davidghiurco@users.noreply.github.com> * correct timing test add info in release file and build wheels * pep8 and Co-authored-by: David Ghiurco <9147386+davidghiurco@users.noreply.github.com> --- .github/workflows/build_wheels.yml | 8 +------- .github/workflows/build_wheels_weekly.yml | 2 -- RELEASES.md | 1 + docs/source/quickstart.rst | 2 +- pyproject.toml | 2 +- requirements.txt | 1 - setup.py | 5 +++-- test/test_utils.py | 4 +++- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index c746eb8..475058c 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -27,8 +27,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -U "cython" - name: Install cibuildwheel run: | @@ -37,7 +35,6 @@ jobs: - name: Build wheels env: CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp36*" # remove pypy on mac and win (wrong version) - CIBW_BEFORE_BUILD: "pip install numpy cython" run: | python -m cibuildwheel --output-dir wheelhouse @@ -65,8 +62,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -U "cython" - name: Install cibuildwheel run: | @@ -80,8 +75,7 @@ jobs: - name: Build wheels env: - CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp*musl* cp36*" # remove pypy on mac and win (wrong version) - CIBW_BEFORE_BUILD: "pip install numpy cython" + CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp*musl*" # remove pypy on mac and win (wrong version) CIBW_ARCHS_LINUX: auto aarch64 # force aarch64 with QEMU CIBW_ARCHS_MACOS: x86_64 universal2 arm64 run: | diff --git a/.github/workflows/build_wheels_weekly.yml b/.github/workflows/build_wheels_weekly.yml index dbf342f..b9154c5 100644 --- a/.github/workflows/build_wheels_weekly.yml +++ b/.github/workflows/build_wheels_weekly.yml @@ -26,8 +26,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -U "cython" - name: Install cibuildwheel run: | diff --git a/RELEASES.md b/RELEASES.md index 925920a..92b7ba5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -16,6 +16,7 @@ - Bug in instantiating an `autograd` function (`ValFunction`, Issue #337, PR #338) +- Make POT ABI compatible with old and new numpy (Issue #346, PR #349) ## 0.8.1.0 *December 2021* diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index e74b019..09a362b 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -1002,7 +1002,7 @@ FAQ 2. **pip install POT fails with error : ImportError: No module named Cython.Build** - As discussed shortly in the README file. POT requires to have :code:`numpy` + As discussed shortly in the README file. POT<0.8 requires to have :code:`numpy` and :code:`cython` installed to build. This corner case is not yet handled by :code:`pip` and for now you need to install both library prior to installing POT. diff --git a/pyproject.toml b/pyproject.toml index 93ebab3..3789206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=1.20", "cython>=0.23"] +requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=0.23"] build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index f9934ce..7cbb29a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ numpy>=1.20 scipy>=1.3 -cython matplotlib autograd pymanopt==0.2.4; python_version <'3' diff --git a/setup.py b/setup.py index d46ae1c..c03191a 100644 --- a/setup.py +++ b/setup.py @@ -68,8 +68,9 @@ setup( license='MIT', scripts=[], data_files=[], - setup_requires=["numpy>=1.20", "cython>=0.23"], - install_requires=["numpy>=1.20", "scipy>=1.0"], + setup_requires=["oldest-supported-numpy", "cython>=0.23"], + install_requires=["numpy>=1.16", "scipy>=1.0"], + python_requires=">=3.6", classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', diff --git a/test/test_utils.py b/test/test_utils.py index 5ad167b..3cfd295 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -67,7 +67,9 @@ def test_tic_toc(): t2 = ot.toq() # test timing - np.testing.assert_allclose(0.1, t, rtol=1e-1, atol=1e-1) + # np.testing.assert_allclose(0.1, t, rtol=1e-1, atol=1e-1) + # very slow macos github action equality not possible + assert t > 0.09 # test toc vs toq np.testing.assert_allclose(t, t2, rtol=1e-1, atol=1e-1) -- cgit v1.2.3