From 53ec95b0e2d53b15f74972c06136ec684e724925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:01:38 +0000 Subject: [PATCH 01/10] cleanup requiorement minimal --- .github/requirements_strict.txt | 9 +++------ .github/workflows/build_tests.yml | 2 -- .gitignore | 3 +++ Makefile | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/requirements_strict.txt b/.github/requirements_strict.txt index d7539c50e..4c58b56b8 100644 --- a/.github/requirements_strict.txt +++ b/.github/requirements_strict.txt @@ -1,7 +1,4 @@ -numpy==1.16.* -scipy==1.0.* -cython==0.23.* -matplotlib -cvxopt -scikit-learn +numpy>=1.16.* +scipy>=1.0.* +cython>=0.23.* pytest diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 41b08b3ac..0ce5e426a 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -31,7 +31,6 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install flake8 pytest "pytest-cov<2.6" codecov - pip install -U "sklearn" - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -68,7 +67,6 @@ jobs: python -m pip install --upgrade pip pip install -r .github/requirements_strict.txt pip install pytest - pip install -U "sklearn" - name: Install POT run: | pip install -e . diff --git a/.gitignore b/.gitignore index a2ace7c6f..b44ea43d7 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,9 @@ var/ *.manifest *.spec +# env +pythonenv3.8/ + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/Makefile b/Makefile index 70cdbdd72..32332b49c 100644 --- a/Makefile +++ b/Makefile @@ -45,10 +45,10 @@ pep8 : flake8 examples/ ot/ test/ test : FORCE pep8 - $(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/ --cov=ot --cov-report html:cov_html + $(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/ pytest : FORCE - $(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/ --cov=ot + $(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/ release : twine upload dist/* From cfad86df48ab0ab2237113e444eab31b8a16acce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:05:51 +0000 Subject: [PATCH 02/10] add pep8 build --- .github/workflows/build_tests.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 0ce5e426a..43dab363d 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -30,13 +30,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install flake8 pytest "pytest-cov<2.6" codecov - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 examples/ ot/ test/ --count --max-line-length=127 --statistics + pip install pytest "pytest-cov<2.6" codecov - name: Install POT run: | pip install -e . @@ -47,6 +41,28 @@ jobs: run: | codecov + pep8: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 examples/ ot/ test/ --count --max-line-length=127 --statistics linux-minimal-deps: @@ -93,7 +109,6 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest "pytest-cov<2.6" - pip install -U "sklearn" - name: Install POT run: | pip install -e . From 39744911743375c70c06ce3cf5ac2b008e3b3329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:12:20 +0000 Subject: [PATCH 03/10] cleanup sklearn --- .github/workflows/build_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 43dab363d..7a80b07e2 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -47,6 +47,7 @@ jobs: max-parallel: 4 matrix: python-version: [3.8] + steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} @@ -135,7 +136,6 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest "pytest-cov<2.6" - pip install -U "sklearn" - name: Install POT run: | pip install -e . From a292481646ac2db4bf27df627aaf1aeb49695f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:21:24 +0000 Subject: [PATCH 04/10] skip test if no sklearn --- test/test_da.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/test_da.py b/test/test_da.py index 3b28119a7..ede260ef2 100644 --- a/test/test_da.py +++ b/test/test_da.py @@ -6,11 +6,18 @@ import numpy as np from numpy.testing import assert_allclose, assert_equal +import pytest import ot from ot.datasets import make_data_classif from ot.utils import unif +try: # test if cudamat installed + import sklearn + nosklearn = False +except ImportError: + nosklearn = True + def test_sinkhorn_lpl1_transport_class(): """test_sinkhorn_transport @@ -690,7 +697,7 @@ def test_jcpot_barycenter(): np.testing.assert_allclose(prop, [1 - pt, pt], rtol=1e-3, atol=1e-3) - +@pytest.mark.skipif(nosklearn, reason="No sklearn available") def test_emd_laplace_class(): """test_emd_laplace_transport """ From b3faa84e9e373283f33e7df49191a18d98a588cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:24:28 +0000 Subject: [PATCH 05/10] debug build yaml --- .github/workflows/build_tests.yml | 2 +- test/test_da.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 7a80b07e2..3361de49c 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -43,7 +43,7 @@ jobs: pep8: runs-on: ubuntu-latest - strategy: + strategy: max-parallel: 4 matrix: python-version: [3.8] diff --git a/test/test_da.py b/test/test_da.py index ede260ef2..ccb334d9e 100644 --- a/test/test_da.py +++ b/test/test_da.py @@ -697,6 +697,7 @@ def test_jcpot_barycenter(): np.testing.assert_allclose(prop, [1 - pt, pt], rtol=1e-3, atol=1e-3) + @pytest.mark.skipif(nosklearn, reason="No sklearn available") def test_emd_laplace_class(): """test_emd_laplace_transport From 11b8e86e52a6dd7a78df56eb45dbd703ced044c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 11 Sep 2020 07:27:07 +0000 Subject: [PATCH 06/10] comment error out in test (test sklearn) --- test/test_da.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_da.py b/test/test_da.py index ccb334d9e..52c6a48c4 100644 --- a/test/test_da.py +++ b/test/test_da.py @@ -13,7 +13,7 @@ from ot.utils import unif try: # test if cudamat installed - import sklearn + import sklearn # noqa: F401 nosklearn = False except ImportError: nosklearn = True From 5f1ed844fc39f92c741eda7252eed0de991a23e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 22 Oct 2020 08:56:52 +0200 Subject: [PATCH 07/10] maybe small stuff for better robustness : copy the sub-array --- ot/lp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py index 2a1b082f5..f08e020e3 100644 --- a/ot/lp/__init__.py +++ b/ot/lp/__init__.py @@ -426,7 +426,7 @@ def f(b): nb = b.shape[1] if processes > 1: - res = parmap(f, [b[:, i] for i in range(nb)], processes) + res = parmap(f, [b[:, i].copy() for i in range(nb)], processes) else: res = list(map(f, [b[:, i].copy() for i in range(nb)])) From 1ca133468177cb0840af9dfe366ae375d6f30f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 22 Oct 2020 09:32:06 +0200 Subject: [PATCH 08/10] bump verison minimal build --- .github/workflows/build_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 3361de49c..fa814baf7 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -71,7 +71,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.6] + python-version: [3.8] steps: - uses: actions/checkout@v1 From fa9c6075961279eec163fd9df27050341526a37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 22 Oct 2020 09:40:43 +0200 Subject: [PATCH 09/10] update version strict requireent --- .github/requirements_strict.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/requirements_strict.txt b/.github/requirements_strict.txt index 4c58b56b8..0809e3d7d 100644 --- a/.github/requirements_strict.txt +++ b/.github/requirements_strict.txt @@ -1,4 +1,4 @@ -numpy>=1.16.* -scipy>=1.0.* -cython>=0.23.* +numpy +scipy>=1.3 +cython>=0.29 pytest From 4c4c8fd86065c54d2001932cad02d5bdf06edc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 22 Oct 2020 09:52:22 +0200 Subject: [PATCH 10/10] update version strict requirement last change --- .github/requirements_strict.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/requirements_strict.txt b/.github/requirements_strict.txt index 0809e3d7d..9a1ada487 100644 --- a/.github/requirements_strict.txt +++ b/.github/requirements_strict.txt @@ -1,4 +1,4 @@ numpy scipy>=1.3 -cython>=0.29 +cython pytest