Skip to content

Commit fa08f82

Browse files
authored
Merge pull request #97 from IntelPython/update-conda-forge-recipe
Update conda-forge conda recipe
2 parents 02a46a8 + c919785 commit fa08f82

File tree

6 files changed

+121
-49
lines changed

6 files changed

+121
-49
lines changed

.github/workflows/conda-package-cf.yml

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
numpy: "2.3"
3333

3434
steps:
35+
- name: Cancel Previous Runs
36+
uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # v0.13.0
37+
with:
38+
access_token: ${{ github.token }}
39+
3540
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3641
with:
3742
fetch-depth: 0
@@ -78,7 +83,9 @@ jobs:
7883

7984
build_windows:
8085
runs-on: windows-latest
81-
86+
defaults:
87+
run:
88+
shell: cmd /C CALL {0}
8289
strategy:
8390
matrix:
8491
include:
@@ -97,16 +104,21 @@ jobs:
97104
conda-bld: C:\Miniconda\conda-bld\win-64\
98105

99106
steps:
107+
- name: Cancel Previous Runs
108+
uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # v0.13.0
109+
with:
110+
access_token: ${{ github.token }}
111+
100112
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
101113
with:
102114
fetch-depth: 0
103115

104116
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
105117
with:
106-
conda-remove-defaults: true
118+
miniforge-version: latest
119+
activate-environment: build
107120
channels: conda-forge
108-
auto-activate: true
109-
activate-environment: base
121+
python-version: ${{ matrix.python }}
110122

111123
- name: Cache conda packages
112124
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -120,19 +132,24 @@ jobs:
120132
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
121133
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
122134
123-
- name: Install conda-build
124-
run: conda install -n base -y conda-build
135+
- name: Store conda paths as envs
136+
shell: bash -l {0}
137+
run: |
138+
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
139+
140+
- name: Install conda build
141+
run: |
142+
conda install -n base -y conda-build
143+
conda list -n base
125144
126-
- name: Setup MSVC
127-
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
128145
- name: Build conda package
129146
run: conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c conda-forge --override-channels conda-recipe-cf
130147

131148
- name: Upload artifact
132149
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
133150
with:
134151
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
135-
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda
152+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
136153

137154
test_linux:
138155
needs: build_linux
@@ -219,7 +236,9 @@ jobs:
219236
test_windows:
220237
needs: build_windows
221238
runs-on: windows-latest
222-
239+
defaults:
240+
run:
241+
shell: cmd /C CALL {0}
223242
strategy:
224243
matrix:
225244
include:
@@ -245,20 +264,21 @@ jobs:
245264

246265
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
247266
with:
248-
conda-remove-defaults: true
267+
miniforge-version: latest
249268
channels: conda-forge
250-
auto-activate: true
251-
activate-environment: base
269+
activate-environment: ${{ env.TEST_ENV_NAME }}
270+
python-version: ${{ matrix.python }}
252271

253-
- name: Install conda-build
254-
# Needed to be able to run conda index
255-
run: conda install conda-build
272+
- name: Install conda-index
273+
run: |
274+
conda install conda-index
256275
257276
- name: Create conda channel
258277
run: |
259278
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
260279
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
261-
conda index ${{ env.GITHUB_WORKSPACE }}/channel
280+
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel
281+
262282
# Test channel
263283
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
264284
more ${{ env.GITHUB_WORKSPACE }}\ver.json
@@ -272,8 +292,7 @@ jobs:
272292
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
273293
SET PACKAGE_VERSION=%%F
274294
)
275-
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
276-
more lockfile
295+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
277296
278297
- name: Cache conda packages
279298
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -302,5 +321,5 @@ jobs:
302321
303322
- name: Run tests
304323
run: |
305-
conda activate -n ${{ env.TEST_ENV_NAME }}
324+
conda activate ${{ env.TEST_ENV_NAME }}
306325
pytest -v --pyargs ${{ env.MODULE_NAME }}

.github/workflows/conda-package.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ jobs:
7979

8080
build_windows:
8181
runs-on: windows-latest
82-
82+
defaults:
83+
run:
84+
shell: cmd /C CALL {0}
8385
strategy:
8486
matrix:
8587
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
@@ -97,10 +99,9 @@ jobs:
9799
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
98100
with:
99101
miniforge-version: latest
100-
use-mamba: 'true'
101-
conda-remove-defaults: 'true'
102-
activate-environment: 'build'
103-
python-version: '3.13' # no python 3.14 support by conda-build
102+
activate-environment: build
103+
channels: conda-forge
104+
python-version: ${{ matrix.python }}
104105

105106
- name: Cache conda packages
106107
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -114,13 +115,15 @@ jobs:
114115
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
115116
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
116117
117-
- name: Install conda-build
118-
run: conda install conda-build
119-
120118
- name: Store conda paths as envs
121-
shell: bash -el {0}
119+
shell: bash -l {0}
122120
run: |
123-
echo "CONDA_BLD=${CONDA_PREFIX}\\conda-bld\\win-64\\" >> "$GITHUB_ENV"
121+
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
122+
123+
- name: Install conda build
124+
run: |
125+
conda install -n base -y conda-build
126+
conda list -n base
124127
125128
- name: Build conda package
126129
run: conda build --no-test --python "${{ matrix.python }}" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
@@ -247,19 +250,19 @@ jobs:
247250
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
248251
with:
249252
miniforge-version: latest
250-
use-mamba: 'true'
251-
conda-remove-defaults: 'true'
252-
activate-environment: 'test'
253-
python-version: '3.13' # no python 3.14 support by conda-index
253+
channels: conda-forge
254+
activate-environment: ${{ env.TEST_ENV_NAME }}
255+
python-version: ${{ matrix.python }}
254256

255257
- name: Install conda-index
256-
run: conda install conda-index
258+
run: |
259+
conda install conda-index
257260
258261
- name: Create conda channel
259262
run: |
260263
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
261264
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
262-
python -m conda_index "${{ env.GITHUB_WORKSPACE }}/channel"
265+
python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel
263266
264267
# Test channel
265268
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
@@ -274,8 +277,7 @@ jobs:
274277
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
275278
SET PACKAGE_VERSION=%%F
276279
)
277-
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
278-
more lockfile
280+
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
279281
280282
- name: Cache conda packages
281283
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -302,12 +304,12 @@ jobs:
302304
)
303305
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
304306
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
305-
conda activate -n ${{ env.TEST_ENV_NAME }}
307+
conda activate ${{ env.TEST_ENV_NAME }}
306308
307309
# Test installed packages
308310
conda list
309311
310312
- name: Run tests
311313
run: |
312-
conda activate -n "${{ env.TEST_ENV_NAME }}"
314+
conda activate "${{ env.TEST_ENV_NAME }}"
313315
pytest -v --pyargs ${{ env.MODULE_NAME }}

conda-recipe-cf/bld.bat

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
@rem Remember to source the compiler
22

33
set MKLROOT=%CONDA_PREFIX%
4-
%PYTHON% -m pip install --no-build-isolation --no-deps .
5-
if errorlevel 1 exit 1
4+
5+
rem Build wheel package
6+
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
7+
%PYTHON% -m pip wheel --no-build-isolation --no-deps .
8+
if errorlevel 1 exit 1
9+
copy mkl_random*.whl %WHEELS_OUTPUT_FOLDER%
10+
if errorlevel 1 exit 1
11+
) ELSE (
12+
rem Build conda package
13+
%PYTHON% -m pip install --no-build-isolation --no-deps .
14+
if errorlevel 1 exit 1
15+
)

conda-recipe-cf/build.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
#!/bin/bash -x
22

33
export CFLAGS="-I$PREFIX/include $CFLAGS"
4+
export LDFLAGS="-Wl,-rpath,\$ORIGIN/../.. -Wl,-rpath,\$ORIGIN/../../.. -L${PREFIX}/lib ${LDFLAGS}"
45
export MKLROOT=$CONDA_PREFIX
5-
$PYTHON -m pip install --no-build-isolation --no-deps .
6+
7+
read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
8+
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"
9+
10+
# Build wheel package
11+
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
12+
$PYTHON -m pip wheel --no-build-isolation --no-deps .
13+
${PYTHON} -m wheel tags --remove --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" mkl_random*.whl
14+
cp mkl_random*.whl "${WHEELS_OUTPUT_FOLDER}"
15+
else
16+
# Build conda package
17+
$PYTHON -m pip install --no-build-isolation --no-deps .
18+
fi
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
c_compiler: # [linux]
2+
- gcc # [linux]
3+
cxx_compiler: # [linux]
4+
- gxx # [linux]
5+
cxx_compiler_version: # [linux]
6+
- '14' # [linux]
7+
c_stdlib: # [linux]
8+
- sysroot # [linux]
9+
c_stdlib_version: # [linux]
10+
- '2.28' # [linux]
11+
c_stdlib: # [win]
12+
- vs # [win]
13+
cxx_compiler: # [win]
14+
- vs2022 # [win]
15+
c_compiler: # [win]
16+
- vs2022 # [win]

conda-recipe-cf/meta.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
1-
{% set version = "1.4.0dev1" %}
2-
{% set buildnumber = 0 %}
3-
41
package:
52
name: mkl_random
6-
version: {{ version }}
3+
version: {{ GIT_DESCRIBE_TAG }}
74

85
source:
96
path: ..
107

118
build:
12-
number: {{buildnumber}}
9+
number: {{ GIT_DESCRIBE_NUMBER }}
10+
script_env:
11+
- WHEELS_OUTPUT_FOLDER
1312
ignore_run_exports:
1413
- blas
1514

1615
requirements:
1716
build:
1817
- {{ compiler('c') }}
1918
- {{ compiler('cxx') }}
19+
- {{ stdlib('c') }}
2020
host:
2121
- python
22+
- python-gil # [py>=314]
2223
- setuptools >=77
2324
- mkl-devel
2425
- cython
2526
- numpy
2627
- pip
28+
- wheel >=0.41.3
2729
run:
2830
- python
29-
- numpy
31+
- python-gil [py>=314]
32+
- {{ pin_compatible('numpy', min_pin="x.x", max_pin="x") }}
3033
- {{ pin_compatible('mkl', min_pin="x.x", max_pin="x") }}
3134

3235
test:
@@ -43,3 +46,12 @@ about:
4346
license: BSD-3-Clause
4447
license_file: LICENSE.txt
4548
summary: NumPy-based implementation of random number generation sampling using Intel (R) Math Kernel Library, mirroring numpy.random, but exposing all choices of sampling algorithms available in MKL.
49+
description: |
50+
<strong>LEGAL NOTICE: Use of this software package is subject to the
51+
software license agreement (as set forth above, in the license section of
52+
the installed Conda package and/or the README file) and all notices,
53+
disclaimers or license terms for third party or open source software
54+
included in or with the software.</strong>
55+
<br/><br/>
56+
EULA: <a href="https://opensource.org/licenses/BSD-3-Clause" target="_blank">BSD-3-Clause</a>
57+
<br/><br/>

0 commit comments

Comments
 (0)