Skip to content

Commit 9165494

Browse files
authored
Merge pull request #303 from IntelPython/use-meson-build
Move build system to `meson-python`
2 parents 89a32c9 + 10c490c commit 9165494

21 files changed

Lines changed: 394 additions & 220 deletions

‎.flake8‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ per-file-ignores =
4141
mkl_fft/interfaces/scipy_fft.py: F401
4242
mkl_fft/interfaces/numpy_fft.py: F401
4343

44-
exclude = _vendored/conv_template.py
44+
exclude =
45+
_vendored/conv_template.py
46+
_vendored/process_src_template.py
4547

4648
filename = *.py, *.pyx, *.pxi, *.pxd
4749
max_line_length = 80

‎.github/AGENTS.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CI/CD workflows and repo automation.
66
- `conda-package.yml` — Intel channel conda build/test pipeline
77
- `conda-package-cf.yml` — conda-forge-oriented build/test pipeline
88
- `build-with-clang.yml` — clang compatibility checks
9-
- `build_pip.yaml` — wheel build pipeline
9+
- `build_pip.yml` — editable pip build pipeline
10+
- `build-with-standard-clang.yml` — standard clang compatibility checks
1011
- `pre-commit.yml` — lint/format checks
1112
- `openssf-scorecard.yml` — security scanning
1213

‎.github/copilot-instructions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Higher-precedence file overrides lower-precedence context.
3434
- `pytest mkl_fft/tests`
3535

3636
## Source-of-truth files
37-
- Build/config: `pyproject.toml`, `setup.py`
37+
- Build/config: `pyproject.toml`, `meson.build`
3838
- Dependencies: `pyproject.toml`, `conda-recipe/meta.yaml`, `conda-recipe-cf/meta.yaml`
3939
- CI: `.github/workflows/*.{yml,yaml}`
4040
- API: `mkl_fft/__init__.py`, `mkl_fft/interfaces/*.py`, `mkl_fft/_pydfti.pyx` (interface wrappers are integration/patch entry points)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17-
numpy_version: ["numpy'>=2'"]
17+
numpy_version: ["'numpy>=2'"]
1818

1919
env:
2020
ONEAPI_ROOT: /opt/intel/oneapi
@@ -37,10 +37,9 @@ jobs:
3737
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
3838
sudo apt-get update
3939
40-
- name: Install Intel OneAPI
40+
- name: Install Intel oneAPI
4141
run: |
4242
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
43-
sudo apt-get install intel-oneapi-tbb
4443
sudo apt-get install intel-oneapi-mkl-devel
4544
4645
- name: Setup Python
@@ -56,7 +55,7 @@ jobs:
5655

5756
- name: Install mkl_fft dependencies
5857
run: |
59-
pip install cython setuptools">=77"
58+
pip install meson-python ninja cython cmake
6059
pip install ${{ matrix.numpy_version }}
6160
6261
- name: List oneAPI folder content
@@ -73,5 +72,6 @@ jobs:
7372
- name: Run mkl_fft tests
7473
run: |
7574
source ${{ env.ONEAPI_ROOT }}/setvars.sh
76-
pip install scipy mkl-service pytest
75+
pip install scipy pytest
76+
pip install mkl-service --no-deps
7777
pytest -s -v --pyargs mkl_fft
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build project with standard clang compiler
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
permissions: read-all
9+
10+
jobs:
11+
build-with-standard-clang:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17+
numpy_version: ["'numpy>=2'"]
18+
19+
env:
20+
COMPILER_ROOT: /usr/bin
21+
22+
defaults:
23+
run:
24+
shell: bash -el {0}
25+
26+
steps:
27+
- name: Cancel Previous Runs
28+
uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0
29+
with:
30+
access_token: ${{ github.token }}
31+
32+
- name: Install Dependencies
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y clang
36+
37+
- name: Setup Python
38+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
39+
with:
40+
python-version: ${{ matrix.python }}
41+
architecture: x64
42+
43+
- name: Checkout repo
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Install mkl_fft dependencies
49+
run: |
50+
pip install meson-python ninja cmake cython mkl-devel
51+
pip install ${{ matrix.numpy_version }}
52+
53+
- name: Build mkl_fft
54+
run: |
55+
export CC=${{ env.COMPILER_ROOT }}/clang
56+
pip install -e . --no-build-isolation --no-deps --verbose
57+
58+
- name: Run mkl_fft tests
59+
run: |
60+
pip install pytest mkl-service scipy
61+
python -m pytest -sv --pyargs mkl_fft
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ on:
88

99
permissions: read-all
1010

11-
env:
12-
PACKAGE_NAME: mkl_fft
13-
MODULE_NAME: mkl_fft
14-
TEST_ENV_NAME: test_mkl_fft
15-
1611
jobs:
1712
build:
1813
runs-on: ubuntu-latest
@@ -26,11 +21,6 @@ jobs:
2621
use_pre: ["", "--pre"]
2722

2823
steps:
29-
- name: Install jq
30-
shell: bash -l {0}
31-
run: |
32-
sudo apt-get install jq
33-
3424
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3525
with:
3626
fetch-depth: 0
@@ -48,10 +38,8 @@ jobs:
4838
4939
- name: Build conda package
5040
run: |
51-
pip install --no-cache-dir cython setuptools
41+
pip install --no-cache-dir meson-python ninja cmake cython
5242
pip install --no-cache-dir numpy ${{ matrix.use_pre }}
53-
echo "CONDA_PREFFIX is '${CONDA_PREFIX}'"
54-
export MKLROOT=${CONDA_PREFIX}
5543
pip install -e ".[test]" --no-build-isolation --verbose
5644
pip list
5745
python -m pytest -v mkl_fft/tests

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ jobs:
6161
- name: Add conda to system path
6262
run: echo "$CONDA"/bin >> "$GITHUB_PATH"
6363

64+
- name: Store conda paths as envs
65+
run: |
66+
echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> "$GITHUB_ENV"
67+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> "$GITHUB_ENV"
68+
6469
- name: Update conda
6570
run: |
6671
conda update -n base --all
@@ -92,7 +97,13 @@ jobs:
9297
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
9398
with:
9499
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
95-
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.conda
100+
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
101+
102+
- name: Upload wheels artifact
103+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
104+
with:
105+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
106+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
96107

97108
test_linux:
98109
needs: build_linux
@@ -239,6 +250,7 @@ jobs:
239250
shell: bash -l {0}
240251
run: |
241252
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
253+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> "$GITHUB_ENV"
242254
243255
- name: Show Conda info
244256
run: |
@@ -258,6 +270,12 @@ jobs:
258270
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
259271
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda
260272

273+
- name: Upload wheels artifact
274+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
275+
with:
276+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
277+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
278+
261279
test_windows:
262280
needs: build_windows
263281
runs-on: ${{ matrix.runner }}
@@ -366,7 +384,6 @@ jobs:
366384
)
367385
SET "TEST_DEPENDENCIES=pytest"
368386
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} ${{ matrix.numpy }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
369-
}
370387
- name: Install additional test dependencies
371388
shell: cmd /C CALL {0}
372389
run: |

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ It provides accelerated FFT transforms while aiming to preserve upstream API beh
1616
- **Packaging:** `conda-recipe/`, `conda-recipe-cf/`
1717

1818
## Build/runtime basics
19-
- Build system: `pyproject.toml` + `setup.py`
20-
- Build deps: `cython`, `numpy`, `mkl-devel`
19+
- Build system: `pyproject.toml` + `meson.build`
20+
- Build deps: `cython`, `numpy`, `mkl-devel`, `meson-python`, `cmake`, `ninja`
2121
- Runtime deps: `numpy`, `mkl-service`
2222

2323
## Development guardrails
@@ -28,7 +28,7 @@ It provides accelerated FFT transforms while aiming to preserve upstream API beh
2828
- Avoid hardcoding mutable versions/matrices/channels in docs.
2929

3030
## Where truth lives
31-
- Build/config: `pyproject.toml`, `setup.py`
31+
- Build/config: `pyproject.toml`, `meson.build`
3232
- Dependencies: `pyproject.toml`, `conda-recipe*/meta.yaml`
3333
- CI/workflows: `.github/workflows/*.{yml,yaml}`
3434
- Public API: `mkl_fft/__init__.py`, `mkl_fft/interfaces/` (including wrapper/patch adapter modules)

‎README.md‎

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Conda package](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package.yml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package.yml)
2-
[![Editable build using pip and pre-release NumPy](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yaml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yaml)
2+
[![Editable build using pip and pre-release NumPy](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/build_pip.yml)
33
[![Conda package with conda-forge channel only](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package-cf.yml/badge.svg)](https://github.com/IntelPython/mkl_fft/actions/workflows/conda-package-cf.yml)
44
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/IntelPython/mkl_fft/badge)](https://securityscorecards.dev/viewer/?uri=github.com/IntelPython/mkl_fft)
55

@@ -139,25 +139,28 @@ with mkl_fft.mkl_fft():
139139
---
140140
# Building from source
141141

142-
To build `mkl_fft` from sources on Linux with Intel® oneMKL:
143-
- create a virtual environment: `python3 -m venv fft_env`
144-
- activate the environment: `source fft_env/bin/activate`
145-
- install a recent version of oneMKL, if necessary
146-
- execute `source /path_to_oneapi/mkl/latest/env/vars.sh`
147-
- `git clone https://github.com/IntelPython/mkl_fft.git mkl_fft`
148-
- `cd mkl_fft`
149-
- `python -m pip install .`
150-
- `pip install scipy` (optional: for using `mkl_fft.interface.scipy_fft` module)
151-
- `cd ..`
152-
- `python -c "import mkl_fft"`
153-
154-
To build `mkl_fft` from sources on Linux with conda follow these steps:
155-
- `conda create -n fft_env python=3.12 mkl-devel`
156-
- `conda activate fft_env`
157-
- `export MKLROOT=$CONDA_PREFIX`
158-
- `git clone https://github.com/IntelPython/mkl_fft.git mkl_fft`
159-
- `cd mkl_fft`
160-
- `python -m pip install .`
161-
- `conda install scipy` (optional: for using `mkl_fft.interface.scipy_fft` module)
162-
- `cd ..`
163-
- `python -c "import mkl_fft"`
142+
A C compiler, Intel® oneAPI Math Kernel Library (oneMKL), and NumPy are required
143+
to build `mkl_fft` from source.
144+
145+
Executing
146+
```sh
147+
python -m pip install .
148+
```
149+
will pull in the required build dependencies, including `mkl` and `numpy`, and build `mkl_fft`.
150+
151+
If you already have `mkl` and `numpy` installed (from your system or a conda environment)
152+
and want to reuse them instead of pulling fresh copies into an isolated build, first
153+
install the build dependencies:
154+
```sh
155+
pip install meson-python cmake ninja cython numpy mkl-devel
156+
```
157+
158+
then build against the existing installation with:
159+
```sh
160+
python -m pip install --no-build-isolation --no-deps .
161+
```
162+
163+
Optionally, install `scipy` to use the `mkl_fft.interfaces.scipy_fft` module:
164+
```sh
165+
pip install scipy
166+
```

‎_vendored/README.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
## Vendored files
22

3-
File `conv_template.py` is copied from NumPy's numpy/distutils folder, since
4-
`numpy.distutils` is absent from the installation layout starting with
5-
Python 3.12
3+
Files `conv_template.py` and `process_src_template.py` are copied from NumPy's numpy/numpy/_build_utils folder

0 commit comments

Comments
 (0)