Skip to content

Move build system to meson-python#174

Open
ndgrigorian wants to merge 15 commits into
masterfrom
use-meson-build
Open

Move build system to meson-python#174
ndgrigorian wants to merge 15 commits into
masterfrom
use-meson-build

Conversation

@ndgrigorian

@ndgrigorian ndgrigorian commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

This PR proposes moving from setuptools to meson-python as the mkl-service build system

meson-python is already used by NumPy and allows setup.py to be removed (with its logic moved into the meson.build script)

@ndgrigorian ndgrigorian marked this pull request as draft April 8, 2026 03:59
@ndgrigorian ndgrigorian force-pushed the use-meson-build branch 4 times, most recently from 1f7006a to e209e46 Compare April 8, 2026 06:35
@ndgrigorian ndgrigorian marked this pull request as ready for review April 8, 2026 06:51
Base automatically changed from drop-removed-cbwr-constants to master April 8, 2026 17:17
Copilot AI review requested due to automatic review settings April 8, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates mkl-service from a setuptools/setup.py-driven build to a meson-python build, updating conda recipes and CI workflows accordingly, and adding an mkl runtime dependency.

Changes:

  • Remove setup.py and define extension builds/install layout in meson.build (C + Cython extensions, Python sources, tests).
  • Switch pyproject.toml build backend to mesonpy and add mkl to runtime dependencies.
  • Update conda recipes and GitHub Actions workflows to build/install via pip/python -m build instead of setup.py.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
setup.py Removed legacy setuptools build script.
pyproject.toml Switched build backend to mesonpy, updated build requirements and runtime deps.
meson.build Added Meson build definition for C/Cython extensions and installation layout.
mkl/_py_mkl_service.pyx Added/introduced Cython wrapper implementation used by the public API.
conda-recipe/meta.yaml Updated conda build requirements for Meson-based builds.
conda-recipe/build.sh Updated wheel build/install flow (no setup.py).
conda-recipe/bld.bat Removed setup.py clean step and MKLROOT usage.
conda-recipe-cf/meta.yaml Updated conda-forge recipe host requirements for Meson-based builds.
conda-recipe-cf/build.sh Switched to pip install . build/install flow.
conda-recipe-cf/bld.bat Switched to pip install . build/install flow.
.github/workflows/build-with-standard-clang.yml New CI job building with system clang.
.github/workflows/build-with-clang.yml Updated IntelLLVM clang CI job to Meson-based install.
.github/workflows/build_pip.yml New CI job testing editable install + (pre-)release NumPy in conda env.

Comment thread pyproject.toml
Comment thread meson.build
'mkl-service',
['c', 'cython'],
version: run_command(
'python', '-c',

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run_command('python', ...) hardcodes the interpreter, which may not match Meson’s discovered Python (virtualenv/pyenv/Windows). Use the py installation found by import('python').find_installation() when computing the version to avoid mismatched interpreters.

Suggested change
'python', '-c',
import('python').find_installation(pure: false), '-c',

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds reasonable, NumPy implements the same:

run_command(py, ['-c', 'import os; exec(open("mkl/_version.py").read()); print(__version__)'], check: true).stdout().strip()

Comment thread meson.build
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
numpy_version: ["numpy'>=2'"]

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix value numpy_version: ["numpy'>=2'"] includes embedded quotes and will be passed verbatim to pip install, which is not a valid requirement specifier. Use something like numpy>=2 (or just install numpy and control pre-releases separately).

Suggested change
numpy_version: ["numpy'>=2'"]
numpy_version: ["numpy>=2"]

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build-with-standard-clang.yml Outdated
Comment thread .github/workflows/build-with-clang.yml Outdated
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
numpy_version: ["numpy'>=2'"]

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix value numpy_version: ["numpy'>=2'"] includes embedded quotes and will be passed verbatim to pip install, which is not a valid requirement specifier. Use something like numpy>=2.

Suggested change
numpy_version: ["numpy'>=2'"]
numpy_version: ["numpy>=2"]

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/build_pip.yml Outdated
@ndgrigorian ndgrigorian force-pushed the use-meson-build branch 3 times, most recently from b3cd7c9 to 3fb7aff Compare April 11, 2026 03:05
Comment thread meson.build
Comment thread mkl/_py_mkl_service.pyx
Comment thread meson.build
Comment thread conda-recipe-cf/meta.yaml
Comment thread conda-recipe/meta.yaml
Comment thread meson.build
@ndgrigorian ndgrigorian added this to the 2.8.0 release milestone Apr 26, 2026
@ndgrigorian ndgrigorian requested a review from antonwolfy April 26, 2026 10:26
Comment thread meson.build Outdated
Comment thread .github/workflows/build-with-standard-clang.yml Outdated
Comment thread pyproject.toml
Comment thread meson.build Outdated
Comment thread pyproject.toml Outdated
Comment thread .github/workflows/build_pip.yml Outdated
Comment thread .github/copilot-instructions.md
Comment thread mkl/AGENTS.md Outdated
Comment thread mkl/AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@ndgrigorian ndgrigorian requested a review from antonwolfy July 8, 2026 23:22

permissions: read-all

env:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env block is unused

@@ -37,7 +37,7 @@ Higher-precedence file overrides; lower must not restate overridden guidance.
- Build/config: `pyproject.toml`, `setup.py`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still listing setup.py

Suggested change
- Build/config: `pyproject.toml`, `setup.py`
- Build/config: `pyproject.toml`, `meson.build`

Comment thread AGENTS.md
- **Docs:** MKL support functions documented in [Intel oneMKL Developer Reference](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2025-2/support-functions.html)

## Code structure
- **Cython layer:** `_mkl_service.pyx` + `_mkl_service.pxd` (C declarations)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Cython layer:** `_py_mkl_service.pyx` + `_mkl_service.pxd` (C declarations)

Comment thread AGENTS.md
- **Python versions:** 3.10, 3.11, 3.12, 3.13, 3.14
- **Workflows:** `.github/workflows/`
- `conda-package.yml` — main conda build/test pipeline
- `conda-package-cf.yml — conda build/test using only conda-forge channel

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `conda-package-cf.yml — conda build/test using only conda-forge channel
- `conda-package-cf.yml` — conda build/test using only conda-forge channel

Comment thread AGENTS.md
- `conda-package-cf.yml — conda build/test using only conda-forge channel
- `build-with-clang.yml` — Linux Clang compatibility
- `build-with-standard-clang.yml` — standard Clang compiler compatibility validation
- `build_pip` — validates editable build

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `build_pip` — validates editable build
- `build_pip.yml` — validates editable build

Comment thread conda-recipe-cf/meta.yaml
number: {{ GIT_DESCRIBE_NUMBER }}
skip: true # [osx and arm64]
script_env:
- WHEELS_OUTPUT_FOLDER

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHEELS_OUTPUT_FOLDER is not used with conda-forge

Comment thread conda-recipe/meta.yaml
- {{ stdlib('c') }}
host:
- meson-python >=0.13.0
- meson

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meson-python already cover that:

Suggested change
- meson

Comment thread conda-recipe-cf/meta.yaml
- {{ stdlib('c') }}
host:
- meson-python >=0.13.0
- meson

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same

Suggested change
- meson

Comment thread meson.build
'import os; exec(open("mkl/_version.py").read()); print(__version__)',
check: true
).stdout().strip(),
default_options: [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we floor the meson version (used in NumPy)?

Suggested change
default_options: [
meson_version: '>=1.8.3',
default_options: [

Comment thread meson.build
'mkl-service',
['c', 'cython'],
version: run_command(
'python', '-c',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds reasonable, NumPy implements the same:

run_command(py, ['-c', 'import os; exec(open("mkl/_version.py").read()); print(__version__)'], check: true).stdout().strip()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants