From dcdc162f8fc5bd993e98413d471b356f3ce1f5ea Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:19:26 +0100 Subject: [PATCH 01/14] add gha --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..48a60983 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + +jobs: + base: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Prepare python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install + run: | + pip install . From a50b2f45e9dd6dd7e556420c0cf52df516f93067 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:21:19 +0100 Subject: [PATCH 02/14] test --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 8d51043b..e93e12a5 100644 --- a/setup.py +++ b/setup.py @@ -195,6 +195,7 @@ def handle_ext_modules_general_os(): license=LICENSE, classifiers=CLASSIFIERS, packages=[PACKAGE_NAME, DEPRECATED_PACKAGE_NAME], + setup_requires=['setuptools>=18.0', 'cython'], install_requires=DEPENDENCIES, include_package_data=include_package_data, data_files=DATA_FILES, From 87e9012bd4290a5373f21ae48967c24d1c39edab Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:24:11 +0100 Subject: [PATCH 03/14] add catch --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e93e12a5..5624582e 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,13 @@ from setuptools import setup from setuptools.extension import Extension -from Cython.Distutils import build_ext +try: + from Cython.Distutils import build_ext +except ImportError: + # create closure for deferred import + def build_ext(*args, **kwargs): + from Cython.Distutils import build_ext + return build_ext(*args, **kwargs) import numpy as np From b83a36fd7971148accfd834a81fb816318ca0a31 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:26:24 +0100 Subject: [PATCH 04/14] 2nd catch --- setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 5624582e..ea76399f 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,12 @@ def build_ext(*args, **kwargs): from Cython.Distutils import build_ext return build_ext(*args, **kwargs) -import numpy as np +try: + from numpy import get_include +except ImportError: + def get_include(*args, **kwargs): + import nump as np + return np.get_include(*args, **kwargs) exec(open("cyipopt/version.py", encoding="utf-8").read()) @@ -112,7 +117,7 @@ def pkgconfig(*packages, **kw): else: kw.setdefault("extra_compile_args", []).append(token) - kw["include_dirs"] += [np.get_include()] + kw["include_dirs"] += [get_include()] return kw @@ -121,7 +126,7 @@ def handle_ext_modules_win_32_conda_forge_ipopt(): conda_prefix = os.path.split(sys.executable)[0] IPOPT_INCLUDE_DIRS = [os.path.join(conda_prefix, "Library", "include", - "coin-or"), np.get_include()] + "coin-or"), get_include()] IPOPT_LIBS = ["ipopt-3"] IPOPT_LIB_DIRS = [os.path.join(conda_prefix, "Library", "lib")] EXT_MODULES = [Extension("ipopt_wrapper", @@ -136,7 +141,7 @@ def handle_ext_modules_win_32_conda_forge_ipopt(): def handle_ext_modules_win_32_other_ipopt(): IPOPT_INCLUDE_DIRS = [os.path.join(ipoptdir, "include", "coin-or"), - np.get_include()] + get_include()] # These are the specific binaries in the IPOPT 3.13.2 binary download: # https://github.com/coin-or/Ipopt/releases/download/releases%2F3.13.2/Ipopt-3.13.2-win64-msvs2019-md.zip From 69fe8e716875499e639fff69d5e494582ac4b90d Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:30:29 +0100 Subject: [PATCH 05/14] install deps --- .github/workflows/ci.yml | 9 ++++++++- setup.py | 24 ++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48a60983..012dd222 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,13 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install + - name: Install dependencies + run: | + sudo apt-get install \ + build-essential \ + coinor-libipopt1v5 coinor-libipopt-dev \ + gfortran lcov pkg-config python-dev zlib1g-dev + + - name: Install package run: | pip install . diff --git a/setup.py b/setup.py index ea76399f..1ba4c4ad 100644 --- a/setup.py +++ b/setup.py @@ -20,19 +20,11 @@ from setuptools import setup from setuptools.extension import Extension -try: - from Cython.Distutils import build_ext -except ImportError: - # create closure for deferred import - def build_ext(*args, **kwargs): - from Cython.Distutils import build_ext - return build_ext(*args, **kwargs) -try: - from numpy import get_include -except ImportError: - def get_include(*args, **kwargs): - import nump as np - return np.get_include(*args, **kwargs) + +from setuptools import dist +dist.Distribution().fetch_build_eggs(['Cython', 'numpy']) +from Cython.Distutils import build_ext +import numpy as np exec(open("cyipopt/version.py", encoding="utf-8").read()) @@ -117,7 +109,7 @@ def pkgconfig(*packages, **kw): else: kw.setdefault("extra_compile_args", []).append(token) - kw["include_dirs"] += [get_include()] + kw["include_dirs"] += [np.get_include()] return kw @@ -126,7 +118,7 @@ def handle_ext_modules_win_32_conda_forge_ipopt(): conda_prefix = os.path.split(sys.executable)[0] IPOPT_INCLUDE_DIRS = [os.path.join(conda_prefix, "Library", "include", - "coin-or"), get_include()] + "coin-or"), np.get_include()] IPOPT_LIBS = ["ipopt-3"] IPOPT_LIB_DIRS = [os.path.join(conda_prefix, "Library", "lib")] EXT_MODULES = [Extension("ipopt_wrapper", @@ -141,7 +133,7 @@ def handle_ext_modules_win_32_conda_forge_ipopt(): def handle_ext_modules_win_32_other_ipopt(): IPOPT_INCLUDE_DIRS = [os.path.join(ipoptdir, "include", "coin-or"), - get_include()] + np.get_include()] # These are the specific binaries in the IPOPT 3.13.2 binary download: # https://github.com/coin-or/Ipopt/releases/download/releases%2F3.13.2/Ipopt-3.13.2-win64-msvs2019-md.zip From 9cd79fa5ab600f3a7f24ff7ace70a20735aa1a67 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:32:20 +0100 Subject: [PATCH 06/14] spec ubuntu --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 012dd222..ec4196fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: jobs: base: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: python-version: [3.8] From a65614b1eb161dc8668537c9307012ae4b0a2592 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:33:58 +0100 Subject: [PATCH 07/14] tidy up --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 1ba4c4ad..b181e8dd 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ from setuptools.extension import Extension from setuptools import dist +# install requirements before import dist.Distribution().fetch_build_eggs(['Cython', 'numpy']) from Cython.Distutils import build_ext import numpy as np From 123cde749d985c415eb833d0b5ffdd77bb2aba46 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 00:36:28 +0100 Subject: [PATCH 08/14] tidy up --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index b181e8dd..f0655fca 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,11 @@ from setuptools import setup from setuptools.extension import Extension -from setuptools import dist # install requirements before import -dist.Distribution().fetch_build_eggs(['Cython', 'numpy']) +from setuptools import dist +SETUP_REQUIRES = ['cython>=0.26', 'numpy>=1.15'] +dist.Distribution().fetch_build_eggs(SETUP_REQUIRES) + from Cython.Distutils import build_ext import numpy as np @@ -199,7 +201,6 @@ def handle_ext_modules_general_os(): license=LICENSE, classifiers=CLASSIFIERS, packages=[PACKAGE_NAME, DEPRECATED_PACKAGE_NAME], - setup_requires=['setuptools>=18.0', 'cython'], install_requires=DEPENDENCIES, include_package_data=include_package_data, data_files=DATA_FILES, From ae1d2fde37cbe7e0d9cd421da12dfa768b18a8b4 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 13:34:04 +0100 Subject: [PATCH 09/14] fixup --- setup.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index f0655fca..e9a4e8a6 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,12 @@ # install requirements before import from setuptools import dist -SETUP_REQUIRES = ['cython>=0.26', 'numpy>=1.15'] +SETUP_REQUIRES = [ + "setuptools >= 39.0", + "wheel >= 0.26.2", + "cython >= 0.26", + "numpy>=1.15", +] dist.Distribution().fetch_build_eggs(SETUP_REQUIRES) from Cython.Distutils import build_ext @@ -47,12 +52,13 @@ AUTHOR = "Matthias Kümmerer" EMAIL = "matthias.kuemmerer@bethgelab.org" URL = "https://github.com/matthias-k/cyipopt" -DEPENDENCIES = ["numpy>=1.15", - "cython>=0.26", - "future>=0.15", - "setuptools>=39.0", - "six>=1.11" - ] +INSTALL_REQUIRES = [ + "numpy>=1.15", + "cython>=0.26", + "future>=0.15", + "setuptools>=39.0", + "six>=1.11", +] LICENSE = "EPL-1.0" CLASSIFIERS = [ "Development Status :: 4 - Beta", @@ -201,7 +207,8 @@ def handle_ext_modules_general_os(): license=LICENSE, classifiers=CLASSIFIERS, packages=[PACKAGE_NAME, DEPRECATED_PACKAGE_NAME], - install_requires=DEPENDENCIES, + setup_requires=SETUP_REQUIRES, + install_requires=INSTALL_REQUIRES, include_package_data=include_package_data, data_files=DATA_FILES, zip_safe=False, # required for Py27 on Windows to work From 27b2d3ba8ff68b71391bc90124c6ba97eaa9aa4e Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 13:39:27 +0100 Subject: [PATCH 10/14] update travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc211cc9..5dbfe653 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ install: # https://github.com/conda-forge/blas-feedstock/issues/58 - conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION - conda activate test-env - - conda install -y -q lapack "libblas=*=*netlib" cython>=0.26 future>=0.15 "ipopt=$IPOPT_VERSION" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 six>=1.11 + - conda install -y -q lapack "libblas=*=*netlib" "ipopt=$IPOPT_VERSION" pkg-config>=0.29.2 setuptools>=39.0 before_script: - conda info -a From 7e764d88aa1b12ce168805194f6315e6909bc65b Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 13:50:52 +0100 Subject: [PATCH 11/14] remove gha --- .github/workflows/ci.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ec4196fe..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: CI - -on: - push: - -jobs: - base: - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [3.8] - - steps: - - name: Check out repository - uses: actions/checkout@v2 - - - name: Prepare python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - sudo apt-get install \ - build-essential \ - coinor-libipopt1v5 coinor-libipopt-dev \ - gfortran lcov pkg-config python-dev zlib1g-dev - - - name: Install package - run: | - pip install . From 424f01b035fbe7f9bd30475727673612b7b49557 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 16:17:46 +0100 Subject: [PATCH 12/14] revert conda install; rm wheel --- .travis.yml | 4 +++- setup.py | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5dbfe653..7124aaa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,9 @@ install: # https://github.com/conda-forge/blas-feedstock/issues/58 - conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION - conda activate test-env - - conda install -y -q lapack "libblas=*=*netlib" "ipopt=$IPOPT_VERSION" pkg-config>=0.29.2 setuptools>=39.0 + - conda install -y -q lapack "libblas=*=*netlib" \ + cython>=0.26 future>=0.15 "ipopt=$IPOPT_VERSION" numpy>=1.15 \ + pkg-config>=0.29.2 setuptools>=39.0 six>=1.11 before_script: - conda info -a diff --git a/setup.py b/setup.py index e9a4e8a6..296e138e 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,6 @@ # install requirements before import from setuptools import dist SETUP_REQUIRES = [ - "setuptools >= 39.0", - "wheel >= 0.26.2", "cython >= 0.26", "numpy>=1.15", ] From 841b005f71afc04654b33a9d3b293304534d5756 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 16:23:06 +0100 Subject: [PATCH 13/14] travis parsing doesn't work --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7124aaa7..bc211cc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,9 +36,7 @@ install: # https://github.com/conda-forge/blas-feedstock/issues/58 - conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION - conda activate test-env - - conda install -y -q lapack "libblas=*=*netlib" \ - cython>=0.26 future>=0.15 "ipopt=$IPOPT_VERSION" numpy>=1.15 \ - pkg-config>=0.29.2 setuptools>=39.0 six>=1.11 + - conda install -y -q lapack "libblas=*=*netlib" cython>=0.26 future>=0.15 "ipopt=$IPOPT_VERSION" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 six>=1.11 before_script: - conda info -a From 1606bf361e780077a8adf03d540828672a41fac2 Mon Sep 17 00:00:00 2001 From: yannikschaelte Date: Thu, 11 Mar 2021 16:26:17 +0100 Subject: [PATCH 14/14] spacing --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 296e138e..68b170cd 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ from setuptools import dist SETUP_REQUIRES = [ "cython >= 0.26", - "numpy>=1.15", + "numpy >= 1.15", ] dist.Distribution().fetch_build_eggs(SETUP_REQUIRES)