Skip to content

Commit 50dfca8

Browse files
committed
Switch project meta to pyproject.toml
1 parent 30f23f5 commit 50dfca8

File tree

6 files changed

+162
-87
lines changed

6 files changed

+162
-87
lines changed

conda-recipe/bld.bat

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
44
set "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"
55

66
"%PYTHON%" setup.py clean --all
7-
set "SKBUILD_ARGS=-G Ninja -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
87

98
REM Overriding IPO is useful for building in resources constrained VMs (public CI)
109
if DEFINED OVERRIDE_INTEL_IPO (
11-
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
10+
:: TODO: does it work?
11+
set INTERPROCEDURAL_OPTIMIZATION=0
12+
@REM set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
1213
)
1314

1415
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
@@ -32,20 +33,37 @@ if EXIST "%PLATFORM_DIR%" (
3233
if errorlevel 1 exit 1
3334
)
3435

36+
set "CC=icx"
37+
set "CXX=icx"
38+
39+
set "CMAKE_GENERATOR=Ninja"
40+
:: Make CMake verbose
41+
set "VERBOSE=1"
42+
43+
%PYTHON% -m build -w -n -x
44+
if %ERRORLEVEL% neq 0 exit 1
45+
46+
:: `pip install dist\numpy*.whl` does not work on windows,
47+
:: so use a loop; there's only one wheel in dist/ anyway
48+
for /f %%f in ('dir /b /S .\dist') do (
49+
%PYTHON% -m wheel tags --remove --build %GIT_DESCRIBE_NUMBER% %%f
50+
if %ERRORLEVEL% neq 0 exit 1
51+
)
52+
53+
:: wheel file was renamed
54+
for /f %%f in ('dir /b /S .\dist') do (
55+
%PYTHON% -m pip install %%f ^
56+
--no-build-isolation ^
57+
--no-deps ^
58+
--only-binary :all: ^
59+
--no-index ^
60+
--prefix %PREFIX% ^
61+
-vv
62+
if %ERRORLEVEL% neq 0 exit 1
63+
)
64+
65+
:: Copy wheel package
3566
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
36-
rem Install and assemble wheel package from the build bits
37-
"%PYTHON%" setup.py install bdist_wheel --build-number %GIT_DESCRIBE_NUMBER% %SKBUILD_ARGS%
38-
if errorlevel 1 exit 1
3967
copy dist\dpctl*.whl %WHEELS_OUTPUT_FOLDER%
4068
if errorlevel 1 exit 1
41-
) ELSE (
42-
rem Only install
43-
"%PYTHON%" setup.py install %SKBUILD_ARGS%
44-
if errorlevel 1 exit 1
45-
)
46-
47-
if EXIST "%PLATFORM_DIR%" (
48-
rem copy back
49-
copy /Y "%FN%" "%PLATFORM_DIR%\%FN%"
50-
if errorlevel 1 exit 1
5169
)

conda-recipe/build.sh

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ export ICXCFG="$(pwd)/icpx_for_conda.cfg"
1111
if [ -e "_skbuild" ]; then
1212
${PYTHON} setup.py clean --all
1313
fi
14-
export CMAKE_GENERATOR="Ninja"
15-
SKBUILD_ARGS="-- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
16-
echo "${PYTHON} setup.py install ${SKBUILD_ARGS}"
17-
18-
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
19-
# Install packages and assemble wheel package from built bits
20-
WHEELS_BUILD_ARGS="-p manylinux2014_x86_64 --build-number ${GIT_DESCRIBE_NUMBER}"
21-
${PYTHON} setup.py install bdist_wheel ${WHEELS_BUILD_ARGS} ${SKBUILD_ARGS}
22-
cp dist/dpctl*.whl ${WHEELS_OUTPUT_FOLDER}
23-
else
24-
# Perform regular install
25-
${PYTHON} setup.py install ${SKBUILD_ARGS}
14+
15+
export CC=icx
16+
export CXX=icpx
17+
18+
export CMAKE_GENERATOR=Ninja
19+
# Make CMake verbose
20+
export VERBOSE=1
21+
22+
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
23+
${PYTHON} -m build -w -n -x
24+
${PYTHON} -m wheel tags --remove --build "$GIT_DESCRIBE_NUMBER" \
25+
--platform-tag manylinux2014_x86_64 dist/dpctl*.whl
26+
${PYTHON} -m pip install dist/dpctl*.whl \
27+
--no-build-isolation \
28+
--no-deps \
29+
--only-binary :all: \
30+
--no-index \
31+
--prefix "${PREFIX}" \
32+
-vv
33+
34+
# Copy wheel package
35+
if [[ -v WHEELS_OUTPUT_FOLDER ]]; then
36+
cp dist/dpctl*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
2637
fi
2738

2839
# need to create this folder so ensure that .dpctl-post-link.sh can work correctly

conda-recipe/meta.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{% set excluded_compiler_version2 = "2024.0.2" %}
44
{% set excluded_compiler_version3 = "2024.0.3" %}
55

6+
{% set pyproject = load_file_data('pyproject.toml') %}
7+
{% set py_build_deps = pyproject.get('build-system', {}).get('requires', []) %}
8+
69
package:
710
name: dpctl
811
version: {{ GIT_DESCRIBE_TAG }}
@@ -17,25 +20,41 @@ build:
1720
- OVERRIDE_INTEL_IPO # [win]
1821

1922
requirements:
23+
# TODO: keep in sync with /pyproject.toml
2024
build:
2125
- {{ compiler('cxx') }}
2226
- {{ compiler('dpcpp') }} >={{ required_compiler_version }},!={{ excluded_compiler_version1 }},!={{ excluded_compiler_version2 }},!={{ excluded_compiler_version3 }} # [win]
2327
- {{ compiler('dpcpp') }} >={{ required_compiler_version }},!={{ excluded_compiler_version1 }},!={{ excluded_compiler_version2 }} # [linux]
2428
- sysroot_linux-64 >=2.28 # [linux]
2529
host:
26-
- setuptools
27-
- cmake >=3.21
28-
- ninja
29-
- git
30-
- cython
3130
- python
32-
- scikit-build
33-
- numpy
34-
- wheel
31+
- pip >=24.0
32+
- git
33+
# In case use forces ssh over https for git repository interaction we
34+
# must have compatible SSL library version
35+
- openssh
36+
- {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }}
37+
# Ensure we are using latest version of setuptools, since we don't need
38+
# editable environments for release.
39+
- setuptools >=69
40+
{% for dep in py_build_deps %}
41+
{% if dep.startswith('ninja') %}
42+
- {{ dep.split(';')[0] }} # [not win]
43+
{% elif dep.startswith('cmake') %}
44+
- {{ dep }}
45+
{% elif dep.startswith('build>=') %}
46+
- {{ 'python-' ~ dep }}
47+
{% else %}
48+
- {{ dep|replace('_','-') }}
49+
{% endif %}
50+
{% endfor %}
51+
# versioneer dependency
52+
- tomli # [py<311]
3553
run:
3654
- python
55+
- {{ pin_compatible('dpcpp-cpp-rt', min_pin='x.x', max_pin='x') }}
56+
- {{ pin_compatible('intel-cmplr-lib-rt', min_pin='x.x', max_pin='x') }}
3757
- {{ pin_compatible('numpy', min_pin='x.x', max_pin='x') }}
38-
- dpcpp-cpp-rt >={{ required_compiler_version }}
3958
- level-zero # [linux]
4059

4160
test:

pyproject.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = [
4+
# TODO: keep in sync with [project.dependencies]
5+
"wheel>=0.43",
6+
"build>=1.1",
7+
"setuptools>=63.0.0",
8+
"scikit-build>=0.17.0",
9+
"ninja>=1.11.1; platform_system!='Windows'",
10+
"cmake>=3.29.0",
11+
"cython>=3.0.10",
12+
"numpy >=1.24",
13+
# WARNING: check with doc how to upgrade
14+
"versioneer[toml]==0.29"
15+
]
16+
17+
[project]
18+
authors = [{name = "Intel Corporation"}]
19+
classifiers = [
20+
"Development Status :: 4 - Beta",
21+
"Intended Audience :: Science/Research",
22+
"Intended Audience :: Developers",
23+
"License :: OSI Approved :: Apache Software License",
24+
"Programming Language :: C",
25+
"Programming Language :: Pytho",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: Implementation :: CPython",
31+
"Topic :: Software Development",
32+
"Topic :: Scientific/Engineering",
33+
"Operating System :: Microsoft :: Windows",
34+
"Operating System :: POSIX :: Linux",
35+
"Operating System :: POSIX",
36+
"Operating System :: Unix"
37+
]
38+
dependencies = [
39+
# TODO: keep in sync with [build-system.requires] and /conda-recipe/meta.yaml
40+
# This restrictions are for dependabot, actual restrictions are set with
41+
# conda.
42+
# TODO: populate it during build process
43+
# TODO: do we have to set sycl runtime dependencies here
44+
# "dpcpp-cpp-rt>=0.59.0",
45+
# "intel-cmplr-lib-rt>=0.59.0"
46+
"numpy>=1.24.0"
47+
]
48+
description = "A lightweight Python wrapper for a subset of SYCL."
49+
dynamic = ["version"]
50+
keywords = [
51+
"dpctl",
52+
"intel",
53+
"oneapi",
54+
"dpcpp"
55+
]
56+
license = {text = "Apache 2.0"}
57+
name = "dpctl"
58+
readme = {file = "README.md", content-type = "text/markdown"}
59+
requires-python = ">=3.9"
60+
61+
[project.optional-dependencies]
62+
coverage = ["Cython", "pytest", "pytest-cov", "coverage", "tomli"]
63+
docs = [
64+
"Cython",
65+
"sphinx",
66+
"sphinx_rtd_theme",
67+
"pydot",
68+
"graphviz",
69+
"sphinxcontrib-programoutput"
70+
]
71+
72+
[project.urls]
73+
Changelog = "https://github.com/IntelPython/dpctl/blob/main/CHANGELOG.md"
74+
Documentation = "https://intelpython.github.io/dpctl/"
75+
Homepage = "https://github.com/IntelPython/dpctl"
76+
Issues = "https://github.com/IntelPython/dpctl/issues"
77+
Repository = "https://github.com/IntelPython/dpctl.git"
78+
179
[tool.black]
280
exclude = "versioneer.py|dpctl/_version.py"
381
line-length = 80

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@ versionfile_source = dpctl/_version.py
44
versionfile_build = dpctl/_version.py
55
tag_prefix =
66
parentdir_prefix = dpctl-
7-
8-
[bdist_wheel]
9-
universal=1

setup.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,6 @@
3838
).load_module()
3939
__version__ = version_mod.get_versions()["version"]
4040

41-
# Get long description
42-
with open("README.md", "r", encoding="utf-8") as file:
43-
long_description = file.read()
44-
45-
CLASSIFIERS = """\
46-
Development Status :: 4 - Beta
47-
Intended Audience :: Science/Research
48-
Intended Audience :: Developers
49-
License :: OSI Approved :: Apache Software License
50-
Programming Language :: C
51-
Programming Language :: Python
52-
Programming Language :: Python :: 3
53-
Programming Language :: Python :: 3.8
54-
Programming Language :: Python :: 3.9
55-
Programming Language :: Python :: 3.10
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-
"""
63-
6441

6542
def cleanup_destination(cmake_manifest):
6643
"""Delete library files from dpctl/ folder before
@@ -159,14 +136,8 @@ def _get_cmdclass():
159136

160137

161138
skbuild.setup(
162-
name="dpctl",
163139
version=__version__,
164140
cmdclass=_get_cmdclass(),
165-
description="A lightweight Python wrapper for a subset of SYCL.",
166-
long_description=long_description,
167-
long_description_content_type="text/markdown",
168-
license="Apache 2.0",
169-
author="Intel Corporation",
170141
url="https://github.com/IntelPython/dpctl",
171142
packages=[
172143
"dpctl",
@@ -204,24 +175,5 @@ def _get_cmdclass():
204175
]
205176
},
206177
include_package_data=False,
207-
zip_safe=False,
208-
setup_requires=["Cython"],
209-
install_requires=[
210-
"numpy",
211-
],
212-
extras_require={
213-
"docs": [
214-
"Cython",
215-
"sphinx",
216-
"sphinx_rtd_theme",
217-
"pydot",
218-
"graphviz",
219-
"sphinxcontrib-programoutput",
220-
],
221-
"coverage": ["Cython", "pytest", "pytest-cov", "coverage", "tomli"],
222-
},
223-
keywords="dpctl",
224-
classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f],
225-
platforms=["Linux", "Windows"],
226178
cmake_process_manifest_hook=cleanup_destination,
227179
)

0 commit comments

Comments
 (0)