Skip to content

Commit 17d0987

Browse files
authored
migrate from setup.py to pyproject.toml (#66)
* migrate from setup.py to pyproject.toml * use os.environ.get
1 parent d229a87 commit 17d0987

File tree

11 files changed

+154
-126
lines changed

11 files changed

+154
-126
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7+
day: "saturday"
8+
rebase-strategy: "disabled"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
packages: |
6161
cython
62-
setuptools
62+
setuptools>=77
6363
pytest
6464
6565
- name: List oneAPI folder content

.github/workflows/conda-package.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ env:
1818
jobs:
1919
build_linux:
2020
runs-on: ubuntu-latest
21+
2122
strategy:
2223
matrix:
2324
python: ["3.9", "3.10", "3.11", "3.12"]
25+
2426
steps:
2527
- name: Cancel Previous Runs
2628
uses: styfle/[email protected]
@@ -34,6 +36,7 @@ jobs:
3436
- name: Set pkgs_dirs
3537
run: |
3638
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
39+
3740
- name: Cache conda packages
3841
uses: actions/cache@v4
3942
env:
@@ -48,8 +51,10 @@ jobs:
4851
4952
- name: Add conda to system path
5053
run: echo $CONDA/bin >> $GITHUB_PATH
54+
5155
- name: Install conda-build
5256
run: conda install conda-build
57+
5358
- name: Build conda package
5459
run: |
5560
CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels"
@@ -61,6 +66,7 @@ jobs:
6166
$VERSIONS \
6267
$CHANNELS \
6368
conda-recipe
69+
6470
- name: Upload artifact
6571
uses: actions/[email protected]
6672
with:
@@ -75,6 +81,7 @@ jobs:
7581
python: ['3.9', '3.10', '3.11', '3.12']
7682
env:
7783
conda-bld: C:\Miniconda\conda-bld\win-64\
84+
7885
steps:
7986
- name: Cancel Previous Runs
8087
uses: styfle/[email protected]
@@ -86,6 +93,7 @@ jobs:
8693
fetch-depth: 0
8794
- uses: conda-incubator/setup-miniconda@v3
8895
with:
96+
conda-remove-defaults: true
8997
auto-activate-base: true
9098
activate-environment: ""
9199

@@ -100,10 +108,13 @@ jobs:
100108
restore-keys: |
101109
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
102110
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
111+
103112
- name: Install conda-build
104113
run: conda install conda-build
114+
105115
- name: Build conda package
106116
run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
117+
107118
- name: Upload artifact
108119
uses: actions/[email protected]
109120
with:
@@ -128,10 +139,13 @@ jobs:
128139
uses: actions/download-artifact@v4
129140
with:
130141
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
142+
131143
- name: Add conda to system path
132144
run: echo $CONDA/bin >> $GITHUB_PATH
145+
133146
- name: Install conda-build
134147
run: conda install conda-build
148+
135149
- name: Create conda channel
136150
run: |
137151
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
@@ -141,16 +155,19 @@ jobs:
141155
# Test channel
142156
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
143157
cat ver.json
158+
144159
- name: Collect dependencies
145160
run: |
146161
. $CONDA/etc/profile.d/conda.sh
147162
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
148163
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
149164
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
150165
cat lockfile
166+
151167
- name: Set pkgs_dirs
152168
run: |
153169
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
170+
154171
- name: Cache conda packages
155172
uses: actions/cache@v4
156173
env:
@@ -171,6 +188,7 @@ jobs:
171188
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
172189
# Test installed packages
173190
conda list
191+
174192
- name: Run tests
175193
run: |
176194
. $CONDA/etc/profile.d/conda.sh
@@ -197,11 +215,13 @@ jobs:
197215
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
198216
- uses: conda-incubator/setup-miniconda@v3
199217
with:
218+
conda-remove-defaults: true
200219
auto-activate-base: true
201220
activate-environment: ""
221+
202222
- name: Install conda-build
203-
# Needed to be able to run conda index
204223
run: conda install conda-build
224+
205225
- name: Create conda channel
206226
run: |
207227
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
@@ -210,6 +230,7 @@ jobs:
210230
# Test channel
211231
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
212232
more ${{ env.GITHUB_WORKSPACE }}\ver.json
233+
213234
- name: Collect dependencies
214235
shell: cmd
215236
run: |
@@ -221,6 +242,7 @@ jobs:
221242
)
222243
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
223244
more lockfile
245+
224246
- name: Cache conda packages
225247
uses: actions/cache@v4
226248
env:
@@ -232,6 +254,7 @@ jobs:
232254
restore-keys: |
233255
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
234256
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
257+
235258
# add intel-openmp as an explicit dependency
236259
# to avoid it being missed when package version is specified exactly
237260
- name: Install mkl-service
@@ -247,6 +270,7 @@ jobs:
247270
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
248271
# Test installed packages
249272
conda list
273+
250274
- name: Run tests
251275
run: |
252276
conda activate -n ${{ env.TEST_ENV_NAME }}

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
=====================
21
`mkl-service` changelog
3-
=====================
2+
=======================
43

54
2.3.0
65
=====

conda-recipe/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
@rem Remember to activate compiler, if needed
33

44
set MKLROOT=%CONDA_PREFIX%
5-
%PYTHON% setup.py install
5+
%PYTHON% -m pip install --no-build-isolation --no-deps .
66
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
# make sure that compiler has been sourced, if necessary
44

5-
MKLROOT=$CONDA_PREFIX $PYTHON setup.py install
5+
MKLROOT=$CONDA_PREFIX $PYTHON -m pip install --no-build-isolation --no-deps .

conda-recipe/meta.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ requirements:
1919
- {{ compiler('c') }}
2020
host:
2121
- python
22-
- setuptools
23-
- mkl-devel >=2019.3
22+
- setuptools >=77
23+
- mkl-devel
2424
- cython
2525
run:
2626
- python
27-
- mkl >=2019.3
27+
- mkl
2828

2929
test:
3030
requires:
@@ -40,15 +40,15 @@ about:
4040
license_file: LICENSE.txt
4141
license_family: BSD
4242
description:
43-
Intel(R) Math Kernel Library (Intel(R) MKL) support functions are
43+
Intel(R) OneAPI Math Kernel Library (OneMKL) support functions are
4444
subdivided into the following groups according to their purpose, such as
4545
Version Information
4646
Threading Control
4747
Timing
4848
Memory Management
4949
Conditional Numerical Reproducibility Control
5050
Miscellaneous
51-
summary: Python hooks for Intel(R) Math Kernel Library runtime control settings.
51+
summary: Python hooks for Intel(R) OneMKL runtime control settings.
5252

5353
extra:
5454
recipe-maintainers:

mkl/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,4 @@ def __exit__(self, *args):
5252
del sys
5353

5454
from ._py_mkl_service import *
55-
56-
57-
__version__ = '2.4.2'
55+
from ._version import __version__

mkl/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "2.4.2"

pyproject.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright (c) 2025, Intel Corporation
2+
#
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions are met:
5+
#
6+
# * Redistributions of source code must retain the above copyright notice,
7+
# this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
# * Neither the name of Intel Corporation nor the names of its contributors
12+
# may be used to endorse or promote products derived from this software
13+
# without specific prior written permission.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
19+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
26+
27+
[build-system]
28+
build-backend = "setuptools.build_meta"
29+
requires = ["setuptools>=77", "Cython"]
30+
31+
[project]
32+
authors = [
33+
{name = "Intel Corporation", email = "[email protected]"}
34+
]
35+
classifiers = [
36+
"Development Status :: 5 - Production/Stable",
37+
"Intended Audience :: Science/Research",
38+
"Intended Audience :: Developers",
39+
"Programming Language :: C",
40+
"Programming Language :: Python",
41+
"Programming Language :: Python :: 3",
42+
"Programming Language :: Python :: 3.9",
43+
"Programming Language :: Python :: 3.10",
44+
"Programming Language :: Python :: 3.11",
45+
"Programming Language :: Python :: 3.12",
46+
"Programming Language :: Python :: Implementation :: CPython",
47+
"Topic :: Software Development",
48+
"Topic :: Utilities",
49+
"Operating System :: Microsoft :: Windows",
50+
"Operating System :: POSIX",
51+
"Operating System :: Unix"
52+
]
53+
dependencies = []
54+
description = "Python hooks for Intel® OneAPI Math Kernel Library (OneMKL) runtime control settings"
55+
dynamic = ["version"]
56+
keywords = ["MKL"]
57+
license = "BSD-3-Clause"
58+
name = "mkl-service"
59+
readme = {file = "README.md", content-type = "text/markdown"}
60+
requires-python = ">=3.9,<3.13"
61+
62+
[project.optional-dependencies]
63+
test = ["pytest"]
64+
65+
[project.urls]
66+
Download = "http://github.com/IntelPython/mkl-service"
67+
Homepage = "http://github.com/IntelPython/mkl-service"
68+
69+
[tool.setuptools]
70+
include-package-data = true
71+
packages = ["mkl"]
72+
73+
[tool.setuptools.dynamic]
74+
version = {attr = "mkl._version.__version__"}
75+
76+
[tool.setuptools.package-data]
77+
"mkl" = ["tests/*.py"]

0 commit comments

Comments
 (0)