Skip to content

[MRG] Cleanup minimal build and add separate build for pep8 #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/requirements_strict.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
numpy==1.16.*
scipy==1.0.*
cython==0.23.*
matplotlib
cvxopt
scikit-learn
numpy
scipy>=1.3
cython
pytest
37 changes: 25 additions & 12 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ jobs:
run: |
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
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 .
Expand All @@ -48,14 +41,37 @@ 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:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6]
python-version: [3.8]

steps:
- uses: actions/checkout@v1
Expand All @@ -68,7 +84,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 .
Expand All @@ -95,7 +110,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 .
Expand All @@ -122,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 .
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var/
*.manifest
*.spec

# env
pythonenv3.8/

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
2 changes: 1 addition & 1 deletion ot/lp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]))

Expand Down
8 changes: 8 additions & 0 deletions test/test_da.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 # noqa: F401
nosklearn = False
except ImportError:
nosklearn = True


def test_sinkhorn_lpl1_transport_class():
"""test_sinkhorn_transport
Expand Down Expand Up @@ -691,6 +698,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
"""
Expand Down