Skip to content
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

Change conda-build-version to mamba-version #178

Merged
merged 4 commits into from
Feb 12, 2023
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
11 changes: 7 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout CyIpopt
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: test-environment
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-build-version: '3.21.4'
miniforge-variant: Mambaforge
- name: Install basic dependencies
run: conda install -q -y lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 --file docs/requirements.txt
run: mamba install -y -v lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 --file docs/requirements.txt
- name: Install CyIpopt
run: python -m pip install .
run: |
rm pyproject.toml
python -m pip install .
mamba list
- name: Test building documentation
run: cd docs && make clean && make html && cd ..
17 changes: 10 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout CyIpopt
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: test-environment
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-build-version: '3.21.4'
miniforge-variant: Mambaforge
- name: Install basic dependencies
run: conda install -q -y lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0
run: mamba install -y -v lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0
- name: Install CyIpopt
run: python -m pip install .
run: |
rm pyproject.toml
python -m pip install .
mamba list
- name: Test with pytest
run:
run: |
python -c "import cyipopt"
conda install -y -q pytest>=3.3.2
mamba install -y -v cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 pytest>=3.3.2
pytest
conda install -y -q scipy>=0.19.1
mamba install -y -v cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 pytest>=3.3.2 scipy>=0.19.1
pytest
28 changes: 21 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,36 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout CyIpopt
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: test-environment
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-build-version: '3.21.4'
- name: Install basic dependencies
run: conda install -q -y lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0
run: |
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install -q -y lapack "libblas=*=*netlib" cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0
- name: Install CyIpopt
run: python -m pip install .
run: |
rm pyproject.toml
python -m pip install .
conda list
- name: Test with pytest
run:
run: |
python -c "import cyipopt"
conda install -y -q pytest>=3.3.2
conda remove lapack
conda install -q -y cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 pytest>=3.3.2
conda list
pytest
conda install -y -q scipy>=0.19.1
- name: Test with pytest and scipy, new ipopt
# cyipopt can build with these dependencies, but it seems impossible to
# also install scipy into these environments likely due to SciPy and
# Ipopt needed different libfortrans.
if: (matrix.ipopt-version != '3.12' && matrix.python-version != '3.11') || (matrix.ipopt-version != '3.12' && matrix.python-version != '3.10' && matrix.os != 'macos-latest')
run: |
conda install -q -y -c conda-forge cython>=0.26 "ipopt=${{ matrix.ipopt-version }}" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 pytest>=3.3.2 scipy>=0.19.0
conda list
pytest
16 changes: 11 additions & 5 deletions cyipopt/tests/unit/test_scipy_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_minimize_ipopt_nojac_constraints_if_scipy():
reason="Test only valid if Scipy available.")
def test_minimize_ipopt_jac_and_hessians_constraints_if_scipy(
):
"""`minimize_ipopt` works with objective gradient and Hessian
"""`minimize_ipopt` works with objective gradient and Hessian
and constraint jacobians and Hessians."""
from scipy.optimize import rosen, rosen_der, rosen_hess
x0 = [0.0, 0.0]
Expand Down Expand Up @@ -109,7 +109,10 @@ def test_minimize_ipopt_sparse_jac_if_scipy():
x0 * x1 * x2 * x3 - 25 >= 0
1 <= x0,x1,x2,x3 <= 5
"""
from scipy.sparse import coo_array
try:
from scipy.sparse import coo_array
except ImportError:
from scipy.sparse import coo_matrix as coo_array

def obj(x):
return x[0] * x[3] * np.sum(x[:3]) + x[2]
Expand Down Expand Up @@ -161,7 +164,10 @@ def test_minimize_ipopt_sparse_and_dense_jac_if_scipy():
x0 * x1 * x2 * x3 - 25 >= 0
1 <= x0,x1,x2,x3 <= 5
"""
from scipy.sparse import coo_array
try:
from scipy.sparse import coo_array
except ImportError:
from scipy.sparse import coo_matrix as coo_array

def obj(x):
return x[0] * x[3] * np.sum(x[:3]) + x[2]
Expand Down Expand Up @@ -204,10 +210,10 @@ def grad(x):
@pytest.mark.skipif("scipy" not in sys.modules,
reason="Test only valid if Scipy available.")
def test_minimize_ipopt_hs071():
""" `minimize_ipopt` works with objective gradient and Hessian and
""" `minimize_ipopt` works with objective gradient and Hessian and
constraint jacobians and Hessians.

The objective and the constraints functions return a tuple containing
The objective and the constraints functions return a tuple containing
the function value and the evaluated gradient or jacobian. Solves
Hock & Schittkowski's test problem 71:

Expand Down