Skip to content

Commit 2120ef4

Browse files
authored
Merge pull request #62 from IntelPython/migrate-random-to-pyproject-toml
Migrate random to `pyproject.toml` from `setup.py`
2 parents 2fde172 + dc5c0c5 commit 2120ef4

File tree

15 files changed

+154
-128
lines changed

15 files changed

+154
-128
lines changed

.github/workflows/build-docs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Build mkl_random documentation
2+
23
on:
34
pull_request:
45
push:
@@ -34,13 +35,13 @@ jobs:
3435
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
3536
uses: actions/setup-python@v5
3637
with:
37-
python-version: '3.11'
38+
python-version: "3.12"
3839
architecture: x64
3940
- name: Install sphinx dependencies
4041
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
4142
shell: bash -l {0}
4243
run: |
43-
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design
44+
pip install numpy cython setuptools">=77" scikit-build cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design
4445
- name: Checkout repo
4546
uses: actions/checkout@v4.1.1
4647
with:
@@ -52,7 +53,7 @@ jobs:
5253
run: |
5354
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
5455
source /opt/intel/oneapi/setvars.sh
55-
python setup.py develop
56+
pip install --no-deps --no-build-isolation -e . --verbose
5657
python -c "import mkl_random; print(mkl_random.__version__)" || exit 1
5758
sphinx-build -M html docs/source docs/build
5859
mkdir -p ~/rendered_docs

.github/workflows/build-with-clang.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
python: ["3.9", "3.10", "3.11", "3.12"]
16-
numpy_build_version: ["numpy'<2'", "numpy'>=2'"]
17-
15+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16+
numpy_version: ["numpy'<2'", "numpy'>=2'"]
1817
env:
1918
ONEAPI_ROOT: /opt/intel/oneapi
2019

@@ -55,8 +54,8 @@ jobs:
5554

5655
- name: Install mkl_random dependencies
5756
run: |
58-
pip install cython setuptools pytest pytest-cov
59-
pip install ${{ matrix.numpy_build_version }}
57+
pip install cython setuptools">=77"
58+
pip install ${{ matrix.numpy_version }}
6059
6160
- name: List oneAPI folder content
6261
run: ls ${{ env.ONEAPI_ROOT }}/compiler
@@ -68,11 +67,10 @@ jobs:
6867
export CC=$CMPLR_ROOT/bin/icx
6968
export CXX=$CMPLR_ROOT/bin/icpx
7069
export CFLAGS="${CFLAGS} -fno-fast-math -O2"
71-
python setup.py develop
70+
pip install -e . --no-build-isolation --no-deps --verbose
7271
7372
- name: Run mkl_random tests
7473
run: |
7574
source ${{ env.ONEAPI_ROOT }}/setvars.sh
76-
# Test with NumPy<2 for now
77-
pip install numpy"<2"
75+
pip install pytest
7876
pytest -s -v --pyargs mkl_random

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Conda package using conda-forge
22

3-
on: push
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
47

58
permissions: read-all
69

@@ -44,7 +47,7 @@ jobs:
4447
- name: Build conda package
4548
run: |
4649
CHANNELS="-c conda-forge --override-channels"
47-
VERSIONS="--python ${{ matrix.python }} --numpy 2"
50+
VERSIONS="--python ${{ matrix.python }} --numpy 2.0"
4851
TEST="--no-test"
4952
5053
conda build \
@@ -56,7 +59,7 @@ jobs:
5659
uses: actions/upload-artifact@v4
5760
with:
5861
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
59-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
62+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
6063

6164
build_windows:
6265
runs-on: windows-2019
@@ -72,6 +75,7 @@ jobs:
7275
fetch-depth: 0
7376
- uses: conda-incubator/setup-miniconda@v3
7477
with:
78+
conda-remove-defaults: true
7579
auto-activate-base: true
7680
activate-environment: ""
7781

@@ -89,12 +93,12 @@ jobs:
8993
- name: Install conda-build
9094
run: conda install conda-build
9195
- name: Build conda package
92-
run: conda build --no-test --python ${{ matrix.python }} --numpy 2 -c conda-forge --override-channels conda-recipe-cf
96+
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 -c conda-forge --override-channels conda-recipe-cf
9397
- name: Upload artifact
9498
uses: actions/upload-artifact@v4
9599
with:
96100
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
97-
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
101+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda
98102

99103
test_linux:
100104
needs: build_linux
@@ -123,7 +127,7 @@ jobs:
123127
run: |
124128
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
125129
conda index $GITHUB_WORKSPACE/channel || exit 1
126-
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
130+
mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 || exit 1
127131
conda index $GITHUB_WORKSPACE/channel || exit 1
128132
# Test channel
129133
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
@@ -185,6 +189,7 @@ jobs:
185189
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
186190
- uses: conda-incubator/setup-miniconda@v3
187191
with:
192+
conda-remove-defaults: true
188193
auto-activate-base: true
189194
activate-environment: ""
190195
- name: Install conda-build
@@ -193,7 +198,7 @@ jobs:
193198
- name: Create conda channel
194199
run: |
195200
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
196-
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
201+
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
197202
conda index ${{ env.GITHUB_WORKSPACE }}/channel
198203
# Test channel
199204
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json

.github/workflows/conda-package.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Conda package
22

3-
on: push
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
47

58
permissions: read-all
69

@@ -16,7 +19,7 @@ jobs:
1619
runs-on: ubuntu-latest
1720
strategy:
1821
matrix:
19-
python: ["3.9", "3.10"]
22+
python: ["3.9", "3.10", "3.11", "3.12"]
2023
steps:
2124
- uses: actions/checkout@v4
2225
with:
@@ -56,14 +59,14 @@ jobs:
5659
uses: actions/upload-artifact@v4
5760
with:
5861
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
59-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
62+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
6063

6164
build_windows:
6265
runs-on: windows-2019
6366

6467
strategy:
6568
matrix:
66-
python: ['3.9', '3.10']
69+
python: ["3.9", "3.10", "3.11", "3.12"]
6770
env:
6871
conda-bld: C:\Miniconda\conda-bld\win-64\
6972
steps:
@@ -72,6 +75,7 @@ jobs:
7275
fetch-depth: 0
7376
- uses: conda-incubator/setup-miniconda@v3
7477
with:
78+
conda-remove-defaults: true
7579
auto-activate-base: true
7680
activate-environment: ""
7781

@@ -94,15 +98,15 @@ jobs:
9498
uses: actions/upload-artifact@v4
9599
with:
96100
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
97-
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
101+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.conda
98102

99103
test_linux:
100104
needs: build_linux
101105
runs-on: ${{ matrix.runner }}
102106

103107
strategy:
104108
matrix:
105-
python: ['3.9', '3.10']
109+
python: ["3.9", "3.10", "3.11", "3.12"]
106110
numpy: ['1.26*']
107111
experimental: [false]
108112
runner: [ubuntu-latest]
@@ -123,7 +127,7 @@ jobs:
123127
run: |
124128
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
125129
conda index $GITHUB_WORKSPACE/channel || exit 1
126-
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
130+
mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64 || exit 1
127131
conda index $GITHUB_WORKSPACE/channel || exit 1
128132
# Test channel
129133
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
@@ -170,7 +174,7 @@ jobs:
170174

171175
strategy:
172176
matrix:
173-
python: ['3.9', '3.10']
177+
python: ["3.9", "3.10", "3.11", "3.12"]
174178
numpy: ['1.26*']
175179
experimental: [false]
176180
runner: [windows-2019]
@@ -185,6 +189,7 @@ jobs:
185189
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
186190
- uses: conda-incubator/setup-miniconda@v3
187191
with:
192+
conda-remove-defaults: true
188193
auto-activate-base: true
189194
activate-environment: ""
190195
- name: Install conda-build
@@ -193,7 +198,7 @@ jobs:
193198
- name: Create conda channel
194199
run: |
195200
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
196-
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
201+
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
197202
conda index ${{ env.GITHUB_WORKSPACE }}/channel
198203
# Test channel
199204
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
@@ -220,6 +225,9 @@ jobs:
220225
restore-keys: |
221226
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
222227
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
228+
229+
# add intel-openmp as an explicit dependency
230+
# to avoid it being missed when package version is specified exactly
223231
- name: Install mkl_random
224232
shell: cmd
225233
run: |
@@ -229,7 +237,8 @@ jobs:
229237
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
230238
SET PACKAGE_VERSION=%%F
231239
)
232-
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
240+
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
241+
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 }}
233242
# Test installed packages
234243
conda list
235244
- name: Run tests

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ The list of supported by `mkl_random.RandomState` constructor `brng` keywords is
6565
* 'PHILOX4X32X10'
6666
* 'NONDETERM'
6767
* 'ARS5'
68+
69+
---
70+
71+
To build `mkl_random` from sources on Linux:
72+
- install a recent version of MKL, if necessary;
73+
- execute `source /path_to_oneapi/mkl/latest/env/vars.sh`;
74+
- execute `python -m pip install .`

conda-recipe-cf/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@rem Remember to source the compiler
22

33
set MKLROOT=%CONDA_PREFIX%
4-
%PYTHON% setup.py install
4+
%PYTHON% -m pip install --no-build-isolation --no-deps .
55
if errorlevel 1 exit 1

conda-recipe-cf/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
export CFLAGS="-I$PREFIX/include $CFLAGS"
44
export MKLROOT=$CONDA_PREFIX
5-
$PYTHON setup.py install
5+
$PYTHON -m pip install --no-build-isolation --no-deps .

conda-recipe-cf/meta.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requirements:
1919
- {{ compiler('cxx') }}
2020
host:
2121
- python
22-
- setuptools
22+
- setuptools >=77
2323
- mkl-devel
2424
- cython
2525
- numpy
@@ -34,15 +34,12 @@ test:
3434
- pytest --pyargs mkl_random
3535
requires:
3636
- pytest
37-
- mkl-service
38-
- numpy
3937
imports:
4038
- mkl_random
4139
- mkl_random.mklrand
4240

4341
about:
4442
home: http://github.com/IntelPython/mkl_random
4543
license: BSD-3-Clause
46-
license_family: BSD
4744
license_file: LICENSE.txt
4845
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.

conda-recipe/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@rem Remember to source the compiler
22

33
set MKLROOT=%CONDA_PREFIX%
4-
%PYTHON% setup.py install
4+
%PYTHON% -m pip install --no-build-isolation --no-deps .
55
if errorlevel 1 exit 1

conda-recipe/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
export CFLAGS="-I$PREFIX/include $CFLAGS"
44
export MKLROOT=$CONDA_PREFIX
5-
$PYTHON setup.py install
5+
$PYTHON -m pip install --no-build-isolation --no-deps .

conda-recipe/meta.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requirements:
1919
- {{ compiler('cxx') }}
2020
host:
2121
- python
22-
- setuptools
22+
- setuptools >=77
2323
- mkl-devel
2424
- cython
2525
- numpy-base
@@ -34,15 +34,12 @@ test:
3434
- pytest --pyargs mkl_random
3535
requires:
3636
- pytest
37-
- mkl-service
38-
- numpy
3937
imports:
4038
- mkl_random
4139
- mkl_random.mklrand
4240

4341
about:
4442
home: http://github.com/IntelPython/mkl_random
4543
license: BSD-3-Clause
46-
license_family: BSD
4744
license_file: LICENSE.txt
4845
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.

docs/source/maintenance/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ can be found.
3131
:caption: Building mkl_random
3232
3333
$ export MKLROOT=</path/to/mkl>
34-
python setup.py develop
34+
python -m pip install .
3535
3636
To run test suite, install :mod:`pytest`, and run
3737

0 commit comments

Comments
 (0)