Skip to content

Commit c2117e2

Browse files
authored
Merge pull request #221 from bnavigator/conda-forge-recipe
Use conda-build for build matrix and pin like conda-forge
2 parents 9485d94 + cbbddc6 commit c2117e2

6 files changed

Lines changed: 65 additions & 27 deletions

File tree

.github/conda-env/test-env.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: test-env
22
dependencies:
33
# in addtion to package dependencies and explicit LAPACK/BLAS implementations installed in workflow
4-
- conda-build # for conda index
54
- scipy
65
- matplotlib
76
- pytest

.github/workflows/slycot-build-and-test.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
path: slycot-wheels
133133

134134
build-conda:
135-
name: Build conda Py${{ matrix.python }}, ${{ matrix.os }}
135+
name: Build conda, ${{ matrix.os }}
136136
runs-on: ${{ matrix.os }}-latest
137137
needs: build-sdist
138138
strategy:
@@ -143,7 +143,7 @@ jobs:
143143
- 'macos'
144144
- 'windows'
145145
python:
146-
- '3.9'
146+
# this is not the packaged version, just the version conda-build runs on.
147147
- '3.11'
148148

149149
steps:
@@ -167,14 +167,14 @@ jobs:
167167
shell: bash -l {0}
168168
run: |
169169
set -e
170-
numpyversion=$(python -c 'import numpy; print(numpy.version.version)')
171-
conda mambabuild --python "${{ matrix.python }}" --numpy $numpyversion conda-recipe
170+
conda mambabuild conda-recipe
172171
# preserve directory structure for custom conda channel
173172
find "${CONDA_PREFIX}/conda-bld" -maxdepth 2 -name 'slycot*.tar.bz2' | while read -r conda_pkg; do
174173
conda_platform=$(basename $(dirname "${conda_pkg}"))
175174
mkdir -p "slycot-conda-pkgs/${conda_platform}"
176175
cp "${conda_pkg}" "slycot-conda-pkgs/${conda_platform}/"
177176
done
177+
conda index --no-progress ./slycot-conda-pkgs
178178
- name: Save to local conda pkg channel
179179
uses: actions/upload-artifact@v3
180180
with:
@@ -357,7 +357,6 @@ jobs:
357357
echo "libblas * *mkl" >> $CONDA_PREFIX/conda-meta/pinned
358358
;;
359359
esac
360-
conda index --no-progress ./slycot-conda-pkgs
361360
mamba install -c ./slycot-conda-pkgs slycot
362361
conda list
363362
- name: Slycot and python-control tests

README.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ Riccati, Lyapunov, and Sylvester equations.
1919
Dependencies
2020
------------
2121

22-
Slycot supports Python versions 3.8 or later.
22+
Slycot supports Python versions 3.10 or later.
2323

2424
To run the compiled Slycot package, the following must be installed as
2525
dependencies:
2626

27-
- Python 3.8+
27+
- Python 3.10+
2828
- NumPy
2929

3030
If you are compiling and installing Slycot from source, you will need the
3131
following dependencies:
3232

33-
- Python 3.8+
33+
- Python 3.10+
3434
- NumPy
3535
- scikit-build
3636
- CMake
@@ -189,8 +189,6 @@ A similar method can be used for Linux and macOS, but is detailed here
189189
for Windows. This method uses conda and conda-forge to get most build
190190
dependencies, *except* for the C compiler.
191191

192-
This procedure has been tested on Python 3.8.
193-
194192
1. Install `Microsoft Visual Studio`_.
195193
2. Unpack the source code to a directory of your choice,
196194
3. Create a command shell setup that can run the conda commands and the Visual
@@ -199,7 +197,7 @@ This procedure has been tested on Python 3.8.
199197
following commands to build and install Slycot (this example creates a
200198
Python 3.8 environment)::
201199

202-
conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
200+
conda create --channel conda-forge --name build-slycot python=3.10 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
203201
conda activate build-slycot
204202

205203
pip install -v .

conda-recipe/bld.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:: correct FC, apparently pointed to host prefix??
2+
set FC=%BUILD_PREFIX%\Library\bin\flang.exe
13
set BLAS_ROOT=%PREFIX%
24
set LAPACK_ROOT=%PREFIX%
35

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# https://github.com/conda-forge/blas-feedstock/issues/106#issuecomment-1771747983
2+
# https://github.com/conda-forge/conda-forge-pinning-feedstock/blob/main/recipe/conda_build_config.yaml
3+
4+
5+
# zip_keys Python/Numpy matrix to build for
6+
python:
7+
- 3.10.* *_cpython
8+
- 3.11.* *_cpython
9+
# 3.12 is already building in conda-forge/slycot-feedstock, but they did not publish everything yet
10+
# - 3.12.* *_cpython
11+
numpy:
12+
- 1.22
13+
- 1.23
14+
# - 1.23
15+
16+
zip_keys:
17+
-
18+
- python
19+
- numpy
20+
21+
# Compiler selection
22+
c_compiler:
23+
- gcc # [linux]
24+
- clang # [osx]
25+
- vs2019 # [win and x86_64]
26+
- vs2022 # [win and arm64]
27+
c_compiler_version: # [unix]
28+
- 12 # [linux]
29+
- 16 # [osx]
30+
fortran_compiler: # [unix or win64]
31+
- gfortran # [linux64 or (osx and x86_64)]
32+
- gfortran # [aarch64 or ppc64le or armv7l or s390x]
33+
- flang # [win64]
34+
fortran_compiler_version: # [unix or win64]
35+
- 12 # [linux]
36+
- 12 # [osx]
37+
- 5 # [win64]
38+
39+
# Pinning
40+
41+
# blas
42+
libblas:
43+
- 3.9 *netlib
44+
libcblas:
45+
- 3.9 *netlib
46+
liblapack:
47+
- 3.9 *netlib
48+
liblapacke:
49+
- 3.9 *netlib

conda-recipe/meta.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,23 @@ build:
1111

1212
requirements:
1313
build:
14-
- {{ compiler('fortran') }} # [not win]
14+
- {{ compiler('fortran') }}
1515
- {{ compiler('c') }}
1616
- cmake >=3.14
1717
- make # [linux]
18-
- flang >=11 # [win]
19-
2018
host:
21-
# Always build against NETLIB ('Generic') LAPACK/Blas
22-
# https://conda-forge.org/docs/maintainer/knowledge_base.html#blas
23-
# deviating from above link: we have to specifiy netlib variant, because
24-
# the mkl variant selected by default for older pythons on windows
25-
# does not provide the generic headers
26-
- libblas * *netlib
27-
- libcblas * *netlib
28-
- liblapack * *netlib
19+
- libblas
20+
- libcblas
21+
- liblapack
2922
- python
30-
- numpy >=1.19,!=1.23.0
31-
- pip
23+
- numpy
3224
- scikit-build >=0.15
25+
- pip
3326
- setuptools >=45
3427
- setuptools_scm >=7
35-
3628
run:
3729
- python {{ PY_VER }}
3830
- {{ pin_compatible('numpy') }}
39-
- libflang # [win]
4031

4132
test:
4233
requires:

0 commit comments

Comments
 (0)