Skip to content

Commit 3302cd4

Browse files
[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>
1 parent 50c0f17 commit 3302cd4

File tree

8 files changed

+10
-15
lines changed

8 files changed

+10
-15
lines changed

.github/workflows/build_wheels.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install -r requirements.txt
31-
pip install -U "cython"
3230
3331
- name: Install cibuildwheel
3432
run: |
@@ -37,7 +35,6 @@ jobs:
3735
- name: Build wheels
3836
env:
3937
CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp36*" # remove pypy on mac and win (wrong version)
40-
CIBW_BEFORE_BUILD: "pip install numpy cython"
4138
run: |
4239
python -m cibuildwheel --output-dir wheelhouse
4340
@@ -65,8 +62,6 @@ jobs:
6562
- name: Install dependencies
6663
run: |
6764
python -m pip install --upgrade pip
68-
pip install -r requirements.txt
69-
pip install -U "cython"
7065
7166
- name: Install cibuildwheel
7267
run: |
@@ -80,8 +75,7 @@ jobs:
8075

8176
- name: Build wheels
8277
env:
83-
CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp*musl* cp36*" # remove pypy on mac and win (wrong version)
84-
CIBW_BEFORE_BUILD: "pip install numpy cython"
78+
CIBW_SKIP: "pp*-win* pp*-macosx* cp2* pp* cp*musl*" # remove pypy on mac and win (wrong version)
8579
CIBW_ARCHS_LINUX: auto aarch64 # force aarch64 with QEMU
8680
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
8781
run: |

.github/workflows/build_wheels_weekly.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install -r requirements.txt
30-
pip install -U "cython"
3129
3230
- name: Install cibuildwheel
3331
run: |

RELEASES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
- Bug in instantiating an `autograd` function (`ValFunction`, Issue #337, PR
1818
#338)
19+
- Make POT ABI compatible with old and new numpy (Issue #346, PR #349)
1920

2021
## 0.8.1.0
2122
*December 2021*

docs/source/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ FAQ
10021002

10031003
2. **pip install POT fails with error : ImportError: No module named Cython.Build**
10041004

1005-
As discussed shortly in the README file. POT requires to have :code:`numpy`
1005+
As discussed shortly in the README file. POT<0.8 requires to have :code:`numpy`
10061006
and :code:`cython` installed to build. This corner case is not yet handled
10071007
by :code:`pip` and for now you need to install both library prior to
10081008
installing POT.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "numpy>=1.20", "cython>=0.23"]
2+
requires = ["setuptools", "wheel", "oldest-supported-numpy", "cython>=0.23"]
33
build-backend = "setuptools.build_meta"

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
numpy>=1.20
22
scipy>=1.3
3-
cython
43
matplotlib
54
autograd
65
pymanopt==0.2.4; python_version <'3'

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@
6868
license='MIT',
6969
scripts=[],
7070
data_files=[],
71-
setup_requires=["numpy>=1.20", "cython>=0.23"],
72-
install_requires=["numpy>=1.20", "scipy>=1.0"],
71+
setup_requires=["oldest-supported-numpy", "cython>=0.23"],
72+
install_requires=["numpy>=1.16", "scipy>=1.0"],
73+
python_requires=">=3.6",
7374
classifiers=[
7475
'Development Status :: 5 - Production/Stable',
7576
'Intended Audience :: Developers',

test/test_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def test_tic_toc():
6767
t2 = ot.toq()
6868

6969
# test timing
70-
np.testing.assert_allclose(0.1, t, rtol=1e-1, atol=1e-1)
70+
# np.testing.assert_allclose(0.1, t, rtol=1e-1, atol=1e-1)
71+
# very slow macos github action equality not possible
72+
assert t > 0.09
7173

7274
# test toc vs toq
7375
np.testing.assert_allclose(t, t2, rtol=1e-1, atol=1e-1)

0 commit comments

Comments
 (0)