Skip to content

Commit 71c1061

Browse files
authored
Merge pull request #349 from IntelPython/feature/organize_package_meta
Organize package meta
2 parents 4501644 + 6542b52 commit 71c1061

File tree

6 files changed

+123
-85
lines changed

6 files changed

+123
-85
lines changed

.github/workflows/build_and_run.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
uses: conda-incubator/setup-miniconda@v2
7878
with:
7979
python-version: ${{ matrix.python }}
80-
miniforge-variant: Mambaforge
8180
miniforge-version: latest
8281
activate-environment: "build"
8382
channel-priority: "disabled"

.github/workflows/conda-package.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ jobs:
5555
fetch-depth: 0
5656

5757
- name: Setup miniconda
58-
uses: conda-incubator/setup-miniconda@v2
58+
uses: conda-incubator/setup-miniconda@v3
5959
with:
60-
python-version: ${{ matrix.python }}
61-
miniforge-variant: Mambaforge
62-
miniforge-version: latest
63-
activate-environment: "build"
60+
auto-activate-base: true
61+
activate-environment: ""
6462
channels: ${{ env.CHANNELS }}
6563
channel-priority: "disabled"
66-
run-post: false
64+
miniforge-version: latest
6765

6866
- name: Disable defautls
6967
run: conda config --remove channels defaults
@@ -74,18 +72,21 @@ jobs:
7472
echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" '/' >> $GITHUB_ENV
7573
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
7674
77-
# boa is an extention to conda so we can use mamba resolver in conda build
7875
- name: Install conda-build
79-
run: mamba install boa
76+
run: conda install conda-build
8077

8178
- name: Configure MSBuild
8279
if: runner.os == 'Windows'
8380
uses: microsoft/[email protected]
8481
with:
8582
vs-version: '14.35'
8683

84+
- name: Show conda-rc
85+
shell: bash -el {0}
86+
run: cat ~/.condarc
87+
8788
- name: Build conda package
88-
run: conda mambabuild --no-test --python ${{ matrix.python }} conda-recipe
89+
run: conda build --python ${{ matrix.python }} conda-recipe
8990

9091
- name: Upload artifact
9192
uses: actions/[email protected]
@@ -122,15 +123,13 @@ jobs:
122123

123124
steps:
124125
- name: Setup miniconda
125-
uses: conda-incubator/setup-miniconda@v2
126+
uses: conda-incubator/setup-miniconda@v3
126127
with:
127128
python-version: ${{ matrix.python }}
128-
miniforge-variant: Mambaforge
129-
miniforge-version: latest
130129
activate-environment: "build"
131130
channels: ${{ env.CHANNELS }}
132131
channel-priority: "disabled"
133-
run-post: false
132+
miniforge-version: latest
134133

135134
- name: Disable defautls
136135
run: conda config --remove channels defaults
@@ -159,7 +158,7 @@ jobs:
159158
160159
# Needed to be able to run conda index
161160
- name: Install conda-build
162-
run: mamba install conda-build conda-index
161+
run: conda install conda-build conda-index
163162

164163
- name: Create conda channel
165164
run: python -m conda_index ${{ env.CHANNEL_PATH }}
@@ -170,7 +169,7 @@ jobs:
170169
cat ${{ env.VER_JSON_PATH }}
171170
172171
- name: Install dpbench
173-
run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest intel::intel-opencl-rt python=${{ matrix.python }} -c ${{ env.CHANNEL_PATH }}
172+
run: conda install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} pytest intel::intel-opencl-rt python=${{ matrix.python }} -c ${{ env.CHANNEL_PATH }}
174173

175174
- name: Setup OpenCL CPU device
176175
if: runner.os == 'Windows'

conda-recipe/bld.bat

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ set "DPBENCH_SYCL=1"
1717
set "CMAKE_GENERATOR=Ninja"
1818
set "CC=icx"
1919
set "CXX=icx"
20-
21-
"%PYTHON%" setup.py clean --all
20+
:: Make CMake verbose
21+
set "VERBOSE=1"
2222

2323
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
2424
REM set DIR_HINT if directory exists
@@ -41,18 +41,41 @@ if EXIST "%PLATFORM_DIR%" (
4141
if errorlevel 1 exit 1
4242
)
4343

44-
@REM TODO: switch to pip build. Currently results in broken binary
45-
@REM %PYTHON% -m pip install --no-index --no-deps --no-build-isolation . -v
44+
:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check
45+
%PYTHON% -m build -w -n -x
46+
if %ERRORLEVEL% neq 0 exit 1
47+
48+
:: `pip install dist\dpbench*.whl` does not work on windows,
49+
:: so use a loop; there's only one wheel in dist/ anyway
50+
for /f %%f in ('dir /b /S .\dist') do (
51+
%PYTHON% -m wheel tags --remove --build %GIT_DESCRIBE_NUMBER% %%f
52+
if %ERRORLEVEL% neq 0 exit 1
53+
)
54+
55+
:: wheel file was renamed
56+
for /f %%f in ('dir /b /S .\dist') do (
57+
%PYTHON% -m pip install %%f ^
58+
--no-build-isolation ^
59+
--no-deps ^
60+
--only-binary :all: ^
61+
--no-index ^
62+
--prefix %PREFIX% ^
63+
-vv
64+
if %ERRORLEVEL% neq 0 exit 1
65+
)
66+
67+
:: Must be consistent with pyproject.toml project.scritps. Currently pip does
68+
:: not allow to ignore scripts installation, so we have to remove them manually.
69+
:: https://github.com/pypa/pip/issues/3980
70+
:: We have to let conda-build manage it for use in order to set proper python
71+
:: path.
72+
:: https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#python-entry-points
73+
rm %PREFIX%\Scripts\dpbench.exe
74+
75+
:: Copy wheel package
4676
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
47-
rem Install and assemble wheel package from the build bits
48-
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt bdist_wheel --build-number %GIT_DESCRIBE_NUMBER%
49-
if errorlevel 1 exit 1
5077
copy dist\dpbench*.whl %WHEELS_OUTPUT_FOLDER%
5178
if errorlevel 1 exit 1
52-
) ELSE (
53-
rem Only install
54-
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
55-
if errorlevel 1 exit 1
5679
)
5780

5881
rem copy back

conda-recipe/build.sh

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,30 @@ export CMAKE_GENERATOR="Ninja"
1616
export CC=icx
1717
export CXX=icpx
1818

19-
if [ -e "_skbuild" ]; then
20-
${PYTHON} setup.py clean --all
21-
fi
22-
2319
# TODO: switch to pip build. Currently results in broken binary on Windows
2420
# $PYTHON -m pip install --no-index --no-deps --no-build-isolation . -v
2521

26-
# Build wheel package
27-
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
28-
$PYTHON setup.py install --single-version-externally-managed --record=record.txt bdist_wheel -p manylinux2014_x86_64 --build-number $GIT_DESCRIBE_NUMBER
29-
mkdir -p ${WHEELS_OUTPUT_FOLDER}
30-
cp dist/dpbench*.whl ${WHEELS_OUTPUT_FOLDER}
31-
else
32-
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
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/dpbench*.whl
26+
${PYTHON} -m pip install dist/dpbench*.whl \
27+
--no-build-isolation \
28+
--no-deps \
29+
--only-binary :all: \
30+
--no-index \
31+
--prefix ${PREFIX} \
32+
-vv
33+
34+
# Must be consistent with pyproject.toml project.scritps. Currently pip does
35+
# not allow to ignore scripts installation, so we have to remove them manually.
36+
# https://github.com/pypa/pip/issues/3980
37+
# We have to let conda-build manage it for use in order to set proper python
38+
# path.
39+
# https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#python-entry-points
40+
rm ${PREFIX}/bin/dpbench
41+
42+
# Copy wheel package
43+
if [[ -v WHEELS_OUTPUT_FOLDER ]]; then
44+
cp dist/dpbench*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
3345
fi

conda-recipe/meta.yaml

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
{% set pyproject = load_file_data('pyproject.toml') %}
6+
{% set py_deps = pyproject.get('project', {}).get('dependencies', []) %}
7+
{% set py_build_deps = pyproject.get('build-system', {}).get('requires', []) %}
8+
{% set project_scripts = pyproject.get('project', {}).get('scripts', {}) %}
9+
510
package:
611
name: dpbench
712
version: {{ GIT_DESCRIBE_TAG }}
@@ -13,49 +18,40 @@ build:
1318
number: {{ GIT_DESCRIBE_NUMBER }}
1419
script_env:
1520
- WHEELS_OUTPUT_FOLDER
21+
entry_points:
22+
{% for script, module in project_scripts | dictsort %}
23+
- {{ script ~ " = " ~ module }}
24+
{% endfor %}
1625

1726
requirements:
1827
build:
1928
- {{ compiler('cxx') }}
2029
- {{ compiler('dpcpp') }}
30+
# This is required to get compatible headers with the system installed glibc
2131
- sysroot_linux-64 >=2.28 # [linux]
2232
host:
2333
- python
24-
- setuptools
25-
- cmake==3.26* # [win]
26-
- cmake # [not win]
27-
- ninja # [not win]
28-
- scikit-build
29-
- cython
30-
- pybind11
31-
- versioneer
32-
- intel::numpy
33-
- numba
34-
- dpctl
35-
- dpnp
36-
- numba-dpex
34+
- pip
35+
{% for dep in py_build_deps %}
36+
{% if dep.startswith('ninja') %}
37+
- {{ dep.split(';')[0] }} # [not win]
38+
{% elif dep.startswith('cmake') %}
39+
- cmake=3.26 # [win]
40+
- {{ dep }} # [not win]
41+
{% elif dep.startswith('build>=') %}
42+
- {{ 'python-' ~ dep }}
43+
{% else %}
44+
- {{ dep|replace('_','-') }}
45+
{% endif %}
46+
{% endfor %}
3747
run:
38-
- python
39-
- tomli
40-
- alembic
41-
- sqlalchemy
42-
- py-cpuinfo
43-
- scipy
44-
- scikit-learn
45-
- pandas
46-
- intel::numpy
47-
- numba
48-
- dpctl
49-
- dpnp
50-
- numba-dpex
48+
{% for dep in py_deps %}
49+
- {{ dep|replace('_','-') }}
50+
{% endfor %}
5151

5252
test:
53-
requires:
54-
- dpctl
55-
- dpnp
56-
- numba-dpex
57-
- numba
58-
- numpy
53+
commands:
54+
- dpbench --help
5955

6056
about:
6157
home: https://github.com/IntelPython/dpbench

pyproject.toml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,25 @@ classifiers = [
2828
license = { text = "Apache-2.0" }
2929
requires-python = ">=3.9"
3030
dependencies = [
31-
"tomli",
31+
"tomli>=2.0.0",
3232
"alembic>=1.10.0",
3333
"sqlalchemy>=2.0.0",
34-
"py-cpuinfo",
35-
"scipy",
36-
"scikit_learn",
37-
"pandas",
38-
"numpy",
39-
"dpctl",
40-
"dpnp",
41-
"numba",
42-
"numba_dpex",
34+
"py-cpuinfo>=9.0.0",
35+
"scipy>=1.13.0",
36+
"scikit_learn>=1.4.0",
37+
"pandas>=2.2.0",
38+
"numpy>=1.24.0",
39+
"dpctl>=0.16.1",
40+
"dpnp>=0.14.0",
41+
"numba>=0.59.0",
42+
"numba_dpex>=0.23.0a0",
4343
]
44-
dynamic =["version"]
44+
dynamic = ["version"]
4545

4646
[project.optional-dependencies]
4747
numba-mlir = ["numba_mlir"]
4848
color-config = ["pygments"]
49-
sycl-build = ["scikit-build>=0.13", "cmake>=3.18", "ninja"]
50-
npbench = ["dace","dask","legate"]
49+
npbench = ["dace", "dask", "legate"]
5150
json-to-toml = ["tomli_w"]
5251
expected-failure = ["tomlkit"]
5352

@@ -56,14 +55,24 @@ expected-failure = ["tomlkit"]
5655
"Homepage" = "https://https://github.com/IntelPython/dpbench"
5756

5857
[project.scripts]
58+
# Keep consistent with conda build scripts
5959
dpbench = "dpbench.console.entry:main"
6060

6161
[build-system]
6262
# TODO: make it optional for no sycl build. Workaround: `--no-deps`.
6363
# https://github.com/scikit-build/scikit-build/issues/981
6464
requires = [
65-
"setuptools>=42,<64",
66-
"versioneer[toml]",
65+
"wheel>=0.43",
66+
"build>=1.1",
67+
"setuptools>=63.0.0",
68+
"scikit-build>=0.17.0", # sycl build dep
69+
"ninja>=1.11.1; platform_system!='Windows'", # sycl build dep
70+
"cmake>=3.29.0", # sycl build dep
71+
# We need dpctl for UsmNdArray integration for dpcpp code
72+
"dpctl>=0.16.1",
73+
"pybind11>=2.12.0",
74+
# WARNING: check with doc how to upgrade
75+
"versioneer[toml]==0.29",
6776
]
6877
build-backend = "setuptools.build_meta"
6978

0 commit comments

Comments
 (0)