Skip to content

Commit b2478fe

Browse files
authored
migrate from setup.py to pyproject.toml (#131)
* migrate from setup.py to pyproject.toml * update required python version * update numpy version * remove infor for support of macOS
1 parent e1325c5 commit b2478fe

File tree

7 files changed

+115
-70
lines changed

7 files changed

+115
-70
lines changed

.github/workflows/build_pip.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Editable build using pip and pre-release NumPy
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions: read-all
610

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Conda package with conda-forge channel only
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions: read-all
610

.github/workflows/conda-package.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Conda package
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions: read-all
610

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_vendored/__pycache__/
2+
build/
3+
mkl_fft.egg-info/
4+
mkl_fft/__pycache__/
5+
mkl_fft/_pydfti.c
6+
mkl_fft/_pydfti.cpython-310-x86_64-linux-gnu.so
7+
mkl_fft/interfaces/__pycache__/
8+
mkl_fft/src/mklfft.c
9+
mkl_fft/tests/__pycache__/

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ The package also provides `mkl_fft._numpy_fft` and `mkl_fft._scipy_fft` interfac
8282

8383
To build ``mkl_fft`` from sources on Linux:
8484
- install a recent version of MKL, if necessary;
85-
- execute ``source /path/to/mklroot/bin/mklvars.sh intel64`` ;
86-
- execute ``pip install .``
85+
- execute ``source /path_to_oneapi/mkl/latest/env/vars.sh`` ;
86+
- execute ``python -m pip install .``

pyproject.toml

+77
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+
[build-system]
27+
requires = ["setuptools>=64", "Cython", "numpy"]
28+
build-backend = "setuptools.build_meta"
29+
30+
[project]
31+
name = "mkl_fft"
32+
dynamic = ["version"]
33+
description = "MKL-based FFT transforms for NumPy arrays"
34+
readme = { file = "README.md", content-type = "text/markdown" }
35+
requires-python = ">=3.9,<3.13"
36+
license = { text = "BSD" }
37+
authors = [
38+
{ name = "Intel Corporation", email = "[email protected]" }
39+
]
40+
keywords = ["DFTI", "FFT", "Fourier", "MKL"]
41+
classifiers = [
42+
"Development Status :: 5 - Production/Stable",
43+
"Intended Audience :: Science/Research",
44+
"Intended Audience :: Developers",
45+
"License :: OSI Approved",
46+
"Programming Language :: C",
47+
"Programming Language :: Python",
48+
"Programming Language :: Python :: 3",
49+
"Programming Language :: Python :: 3.9",
50+
"Programming Language :: Python :: 3.10",
51+
"Programming Language :: Python :: 3.11",
52+
"Programming Language :: Python :: 3.12",
53+
"Programming Language :: Python :: Implementation :: CPython",
54+
"Topic :: Software Development",
55+
"Topic :: Scientific/Engineering",
56+
"Operating System :: Microsoft :: Windows",
57+
"Operating System :: POSIX",
58+
"Operating System :: Unix",
59+
]
60+
dependencies = ["numpy >=1.26.4", "mkl", "mkl-service"]
61+
62+
[project.optional-dependencies]
63+
test = ["pytest"]
64+
65+
[project.urls]
66+
Homepage = "http://github.com/IntelPython/mkl_fft"
67+
Download = "http://github.com/IntelPython/mkl_fft"
68+
69+
[tool.setuptools]
70+
packages = ["mkl_fft", "mkl_fft.interfaces"]
71+
include-package-data = true
72+
73+
[tool.setuptools.package-data]
74+
"mkl_fft" = ["tests/*.py"]
75+
76+
[tool.setuptools.dynamic]
77+
version = {attr = "mkl_fft._version.__version__"}

setup.py

+12-65
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,15 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
import io
27+
import sys
2828
import os
29-
import re
3029
from os.path import join
3130
import Cython.Build
3231
from setuptools import setup, Extension
3332
import numpy as np
34-
from _vendored.conv_template import process_file as process_c_file
35-
36-
with io.open('mkl_fft/_version.py', 'rt', encoding='utf8') as f:
37-
version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
38-
39-
with open("README.md", "r", encoding="utf-8") as file:
40-
long_description = file.read()
4133

42-
VERSION = version
43-
44-
CLASSIFIERS = """\
45-
Development Status :: 5 - Production/Stable
46-
Intended Audience :: Science/Research
47-
Intended Audience :: Developers
48-
License :: OSI Approved
49-
Programming Language :: C
50-
Programming Language :: Python
51-
Programming Language :: Python :: 3
52-
Programming Language :: Python :: 3.9
53-
Programming Language :: Python :: 3.10
54-
Programming Language :: Python :: 3.11
55-
Programming Language :: Python :: 3.12
56-
Programming Language :: Python :: Implementation :: CPython
57-
Topic :: Software Development
58-
Topic :: Scientific/Engineering
59-
Operating System :: Microsoft :: Windows
60-
Operating System :: POSIX
61-
Operating System :: Unix
62-
Operating System :: MacOS
63-
"""
34+
sys.path.insert(0, os.path.dirname(__file__)) # Ensures local imports work
35+
from _vendored.conv_template import process_file as process_c_file
6436

6537
def extensions():
6638
mkl_root = os.environ.get('MKLROOT', None)
@@ -80,8 +52,8 @@ def extensions():
8052
mkl_library_dirs = mkl_info.get('library_dirs', [])
8153
mkl_libraries = mkl_info.get('libraries', ['mkl_rt'])
8254

83-
mklfft_templ = os.path.join("mkl_fft", "src", "mklfft.c.src")
84-
processed_mklfft_fn = os.path.join("mkl_fft", "src", "mklfft.c")
55+
mklfft_templ = join("mkl_fft", "src", "mklfft.c.src")
56+
processed_mklfft_fn = join("mkl_fft", "src", "mklfft.c")
8557
src_processed = process_c_file(mklfft_templ)
8658

8759
with open(processed_mklfft_fn, 'w') as fid:
@@ -90,52 +62,27 @@ def extensions():
9062
return [
9163
Extension(
9264
"mkl_fft._pydfti",
93-
[
94-
os.path.join("mkl_fft", "_pydfti.pyx"),
95-
os.path.join("mkl_fft", "src", "mklfft.c"),
65+
sources = [
66+
join("mkl_fft", "_pydfti.pyx"),
67+
join("mkl_fft", "src", "mklfft.c"),
9668
],
9769
depends = [
98-
os.path.join("mkl_fft", "src", 'mklfft.h'),
99-
os.path.join("mkl_fft", "src", "multi_iter.h")
70+
join("mkl_fft", "src", 'mklfft.h'),
71+
join("mkl_fft", "src", "multi_iter.h")
10072
],
101-
include_dirs = [os.path.join("mkl_fft", "src"), np.get_include()] + mkl_include_dirs,
73+
include_dirs = [join("mkl_fft", "src"), np.get_include()] + mkl_include_dirs,
10274
libraries = mkl_libraries,
10375
library_dirs = mkl_library_dirs,
10476
extra_compile_args = [
10577
'-DNDEBUG',
10678
# '-ggdb', '-O0', '-Wall', '-Wextra', '-DDEBUG',
10779
],
108-
define_macros=[("NPY_NO_DEPRECATED_API", None), ("PY_ARRAY_UNIQUE_SYMBOL", "mkl_fft_ext")]
80+
define_macros=[("NPY_NO_DEPRECATED_API", None), ("PY_ARRAY_UNIQUE_SYMBOL", "mkl_fft_ext")],
10981
)
11082
]
11183

112-
11384
setup(
114-
name = "mkl_fft",
115-
maintainer = "Intel Corp.",
116-
maintainer_email = "[email protected]",
117-
description = "MKL-based FFT transforms for NumPy arrays",
118-
version = version,
11985
cmdclass={'build_ext': Cython.Build.build_ext},
120-
packages=[
121-
"mkl_fft",
122-
"mkl_fft.interfaces",
123-
],
124-
package_data={"mkl_fft": ["tests/*.py"]},
125-
include_package_data=True,
12686
ext_modules=extensions(),
12787
zip_safe=False,
128-
long_description = long_description,
129-
long_description_content_type="text/markdown",
130-
url = "http://github.com/IntelPython/mkl_fft",
131-
author = "Intel Corporation",
132-
download_url = "http://github.com/IntelPython/mkl_fft",
133-
license = "BSD",
134-
classifiers = [_f for _f in CLASSIFIERS.split('\n') if _f],
135-
platforms = ["Windows", "Linux", "Mac OS-X"],
136-
test_suite = "pytest",
137-
python_requires = '>=3.7',
138-
setup_requires=["Cython",],
139-
install_requires = ["numpy >=1.16", "mkl"],
140-
keywords=["DFTI", "FFT", "Fourier", "MKL",],
14188
)

0 commit comments

Comments
 (0)