Skip to content

Commit 04c5bdd

Browse files
lesteveogrisel
andauthored
BUILD/CI Switch to Meson as main build backend (#28506)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent 34a715b commit 04c5bdd

38 files changed

+336
-144
lines changed

.github/workflows/wheels.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,13 @@ jobs:
163163
CIBW_ARCHS: all
164164
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
165165
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
166+
# Needed on Windows CI to compile with Visual Studio compiler
167+
# otherwise Meson detects a MINGW64 platform and use MINGW64
168+
# toolchain
169+
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
166170
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
167171
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }}
168-
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl
172+
CIBW_TEST_REQUIRES: pytest pandas
169173
CIBW_TEST_COMMAND: bash {project}/build_tools/wheels/test_wheels.sh
170174
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }}
171175
CIBW_BUILD_VERBOSITY: 1

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ inplace:
2424
$(PYTHON) setup.py build_ext -i
2525

2626
dev-meson:
27-
# Temporary script to try the experimental meson build. Once meson is
28-
# accepted as the default build tool, this will go away.
29-
python build_tools/build-meson-editable-install.py
27+
pip install --verbose --no-build-isolation --editable . --config-settings editable-verbose=true
3028

3129
clean-meson:
3230
pip uninstall -y scikit-learn

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ jobs:
168168
DISTRIB: 'conda'
169169
LOCK_FILE: './build_tools/azure/pylatest_conda_forge_mkl_linux-64_conda.lock'
170170
COVERAGE: 'true'
171-
BUILD_WITH_MESON: 'true'
172171
SKLEARN_TESTS_GLOBAL_RANDOM_SEED: '42' # default global random seed
173172
# Tests that require large downloads over the networks are skipped in CI.
174173
# Here we make sure, that they are still run on a regular basis.
@@ -244,6 +243,7 @@ jobs:
244243
SKLEARN_ENABLE_DEBUG_CYTHON_DIRECTIVES: '1'
245244
SKLEARN_RUN_FLOAT32_TESTS: '1'
246245
SKLEARN_TESTS_GLOBAL_RANDOM_SEED: '2' # non-default seed
246+
BUILD_WITH_SETUPTOOLS: 'true'
247247
# Linux environment to test the latest available dependencies.
248248
# It runs tests requiring lightgbm, pandas and PyAMG.
249249
pylatest_pip_openblas_pandas:

build_tools/azure/debian_atlas_32bit_lock.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ iniconfig==2.0.0
1414
# via pytest
1515
joblib==1.2.0
1616
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
17+
meson==1.4.0
18+
# via meson-python
19+
meson-python==0.15.0
20+
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
21+
ninja==1.11.1.1
22+
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
1723
packaging==24.0
18-
# via pytest
24+
# via
25+
# pyproject-metadata
26+
# pytest
1927
pluggy==1.4.0
2028
# via pytest
2129
py==1.11.0
2230
# via pytest
31+
pyproject-metadata==0.7.1
32+
# via meson-python
2333
pytest==7.1.2
2434
# via
2535
# -r build_tools/azure/debian_atlas_32bit_requirements.txt
@@ -29,4 +39,6 @@ pytest-cov==2.9.0
2939
threadpoolctl==2.2.0
3040
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
3141
tomli==2.0.1
32-
# via pytest
42+
# via
43+
# meson-python
44+
# pytest

build_tools/azure/debian_atlas_32bit_requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ joblib==1.2.0 # min
66
threadpoolctl==2.2.0
77
pytest==7.1.2 # min
88
pytest-cov==2.9.0 # min
9+
ninja
10+
meson-python

build_tools/azure/install.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,23 @@ scikit_learn_install() {
126126
export LDFLAGS="$LDFLAGS -Wl,--sysroot=/"
127127
fi
128128

129-
if [[ "$BUILD_WITH_MESON" == "true" ]]; then
130-
make dev-meson
129+
if [[ "$BUILD_WITH_SETUPTOOLS" == "true" ]]; then
130+
python setup.py develop
131131
elif [[ "$PIP_BUILD_ISOLATION" == "true" ]]; then
132132
# Check that pip can automatically build scikit-learn with the build
133133
# dependencies specified in pyproject.toml using an isolated build
134134
# environment:
135-
pip install --verbose --editable .
135+
pip install --verbose .
136136
else
137+
if [[ "$UNAMESTR" == "MINGW64"* ]]; then
138+
# Needed on Windows CI to compile with Visual Studio compiler
139+
# otherwise Meson detects a MINGW64 platform and use MINGW64
140+
# toolchain
141+
ADDITIONAL_PIP_OPTIONS='-Csetup-args=--vsenv'
142+
fi
137143
# Use the pre-installed build dependencies and build directly in the
138144
# current environment.
139-
python setup.py develop
145+
pip install --verbose --no-build-isolation --editable . $ADDITIONAL_PIP_OPTIONS
140146
fi
141147

142148
ccache -s || echo "ccache not installed, skipping ccache statistics"

build_tools/azure/pylatest_conda_forge_mkl_linux-64_conda.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by conda-lock.
22
# platform: linux-64
3-
# input_hash: cdc27128862fe4a9c586b6961e094936bdb919a4b142282ae0370d7e4cb2c9a4
3+
# input_hash: 8c926fdb4279b181aa6ad88f79c862023c796ec1c3a5cff07cf2ea8dd3a05b0d
44
@EXPLICIT
55
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
66
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.2.2-hbcca054_0.conda#2f4327a1cbe7f022401b236e915a5fef
@@ -52,7 +52,7 @@ https://conda.anaconda.org/conda-forge/linux-64/mpg123-1.32.4-h59595ed_0.conda#3
5252
https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.4-h59595ed_2.conda#7dbaa197d7ba6032caf7ae7f32c1efa0
5353
https://conda.anaconda.org/conda-forge/linux-64/ninja-1.11.1-h924138e_0.conda#73a4953a2d9c115bdc10ff30a52f675f
5454
https://conda.anaconda.org/conda-forge/linux-64/nspr-4.35-h27087fc_0.conda#da0ec11a6454ae19bff5b02ed881a2b1
55-
https://conda.anaconda.org/conda-forge/linux-64/openssl-3.2.1-hd590300_0.conda#51a753e64a3027bd7e23a189b1f6e91e
55+
https://conda.anaconda.org/conda-forge/linux-64/openssl-3.2.1-hd590300_1.conda#9d731343cff6ee2e5a25c4a091bf8e2a
5656
https://conda.anaconda.org/conda-forge/linux-64/pixman-0.43.2-h59595ed_0.conda#71004cbf7924e19c02746ccde9fd7123
5757
https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-h36c2ea0_1001.tar.bz2#22dad4df6e8630e8dff2428f6f6a7036
5858
https://conda.anaconda.org/conda-forge/linux-64/rdma-core-28.9-h59595ed_1.conda#aeffb7c06b5f65e55e6c637408dc4100
@@ -204,7 +204,7 @@ https://conda.anaconda.org/conda-forge/noarch/array-api-strict-1.1-pyhd8ed1ab_0.
204204
https://conda.anaconda.org/conda-forge/linux-64/contourpy-1.2.0-py311h9547e67_0.conda#40828c5b36ef52433e21f89943e09f33
205205
https://conda.anaconda.org/conda-forge/linux-64/libarrow-12.0.1-hb87d912_8_cpu.conda#3f3b11398fe79b578e3c44dd00a44e4a
206206
https://conda.anaconda.org/conda-forge/linux-64/pandas-2.2.1-py311h320fe9a_0.conda#aac8d7137fedc2fd5f8320bf50e4204c
207-
https://conda.anaconda.org/conda-forge/linux-64/polars-0.20.15-py311h78b473b_0.conda#92bdda09eefc2c22d1aed663b682ba9c
207+
https://conda.anaconda.org/conda-forge/linux-64/polars-0.20.16-py311h78b473b_0.conda#9b12b4aeb34be2794aa057eb0b9f711d
208208
https://conda.anaconda.org/conda-forge/linux-64/pyqt-5.15.9-py311hf0fb5b6_5.conda#ec7e45bc76d9d0b69a74a2075932b8e8
209209
https://conda.anaconda.org/conda-forge/linux-64/pytorch-1.13.1-cpu_py311h410fd25_1.conda#ddd2fadddf89e3dc3d541a2537fce010
210210
https://conda.anaconda.org/conda-forge/linux-64/scipy-1.12.0-py311h64a7726_2.conda#24ca5107ab75c5521067b8ba505dfae5

build_tools/azure/pylatest_conda_forge_mkl_linux-64_environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ dependencies:
1717
- pytest<8
1818
- pytest-xdist
1919
- pillow
20-
- setuptools
20+
- pip
21+
- ninja
22+
- meson-python
2123
- pytest-cov
2224
- coverage
2325
- ccache
24-
- meson-python
25-
- pip
2626
- pytorch=1.13
2727
- pytorch-cpu
2828
- polars

build_tools/azure/pylatest_conda_forge_mkl_osx-64_conda.lock

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by conda-lock.
22
# platform: osx-64
3-
# input_hash: 1a426ea210e386d35f7d10d1994232053aaddcffe015b7c418298385f796c6e5
3+
# input_hash: e95c63335e9c0bc244575184fa6c8d7e50ba9637cccd9ca66b0c97e0852ab959
44
@EXPLICIT
55
https://conda.anaconda.org/conda-forge/osx-64/bzip2-1.0.8-h10d778d_5.conda#6097a6ca9ada32699b5fc4312dd6ef18
66
https://conda.anaconda.org/conda-forge/osx-64/ca-certificates-2024.2.2-h8857fd0_0.conda#f2eacee8c33c43692f1ccfd33d0f50b1
@@ -34,7 +34,8 @@ https://conda.anaconda.org/conda-forge/osx-64/libsqlite-3.45.2-h92b6c6a_0.conda#
3434
https://conda.anaconda.org/conda-forge/osx-64/libxcb-1.15-hb7f2c08_0.conda#5513f57e0238c87c12dffedbcc9c1a4a
3535
https://conda.anaconda.org/conda-forge/osx-64/libxml2-2.12.6-hc0ae0f7_0.conda#913ce3dbfa8677fba65c44647ef88594
3636
https://conda.anaconda.org/conda-forge/osx-64/ncurses-6.4-h93d8f39_2.conda#e58f366bd4d767e9ab97ab8b272e7670
37-
https://conda.anaconda.org/conda-forge/osx-64/openssl-3.2.1-hd75f5a5_0.conda#3033be9a59fd744172b03971b9ccd081
37+
https://conda.anaconda.org/conda-forge/osx-64/ninja-1.11.1-hb8565cd_0.conda#49ad513efe39447aa51affd47e3aa68f
38+
https://conda.anaconda.org/conda-forge/osx-64/openssl-3.2.1-hd75f5a5_1.conda#570a6f04802df580be529f3a72d2bbf7
3839
https://conda.anaconda.org/conda-forge/osx-64/tapi-1100.0.11-h9ce4665_0.tar.bz2#f9ff42ccf809a21ba6f8607f8de36108
3940
https://conda.anaconda.org/conda-forge/osx-64/tk-8.6.13-h1abcd95_1.conda#bf830ba5afc507c6232d4ef0fb1a882d
4041
https://conda.anaconda.org/conda-forge/osx-64/zlib-1.2.13-h8a1eda9_5.conda#75a8a98b1c4671c5d2897975731da42d
@@ -85,18 +86,23 @@ https://conda.anaconda.org/conda-forge/noarch/threadpoolctl-3.3.0-pyhc1e730c_0.c
8586
https://conda.anaconda.org/conda-forge/noarch/toml-0.10.2-pyhd8ed1ab_0.tar.bz2#f832c45a477c78bebd107098db465095
8687
https://conda.anaconda.org/conda-forge/noarch/tomli-2.0.1-pyhd8ed1ab_0.tar.bz2#5844808ffab9ebdb694585b50ba02a96
8788
https://conda.anaconda.org/conda-forge/osx-64/tornado-6.4-py312h41838bb_0.conda#2d2d1fde5800d45cb56218583156d23d
89+
https://conda.anaconda.org/conda-forge/noarch/wheel-0.42.0-pyhd8ed1ab_0.conda#1cdea58981c5cbc17b51973bcaddcea7
8890
https://conda.anaconda.org/conda-forge/osx-64/cctools-986-h40f6528_0.conda#b7a2ca0062a6ee8bc4e83ec887bef942
8991
https://conda.anaconda.org/conda-forge/osx-64/clang-16.0.6-hdae98eb_5.conda#5f020dce5a00342141d87f952c9c0282
9092
https://conda.anaconda.org/conda-forge/osx-64/coverage-7.4.4-py312h41838bb_0.conda#b0e22bba5fbc3c8d02e25aeb33475fce
9193
https://conda.anaconda.org/conda-forge/osx-64/fonttools-4.49.0-py312h41838bb_0.conda#910043c784378419df3160b7661ee915
9294
https://conda.anaconda.org/conda-forge/noarch/joblib-1.3.2-pyhd8ed1ab_0.conda#4da50d410f553db77e62ab62ffaa1abc
9395
https://conda.anaconda.org/conda-forge/osx-64/libblas-3.9.0-20_osx64_mkl.conda#160fdc97a51d66d51dc782fb67d35205
96+
https://conda.anaconda.org/conda-forge/noarch/meson-1.4.0-pyhd8ed1ab_0.conda#52a0660cfa40b45bf254ecc3374cb2e0
9497
https://conda.anaconda.org/conda-forge/osx-64/mkl-devel-2023.2.0-h694c41f_50500.conda#1b4d0235ef253a1e19459351badf4f9f
95-
https://conda.anaconda.org/conda-forge/noarch/pytest-8.1.1-pyhd8ed1ab_0.conda#94ff09cdedcb7b17e9cd5097ee2cfcff
98+
https://conda.anaconda.org/conda-forge/noarch/pip-24.0-pyhd8ed1ab_0.conda#f586ac1e56c8638b64f9c8122a7b8a67
99+
https://conda.anaconda.org/conda-forge/noarch/pyproject-metadata-0.7.1-pyhd8ed1ab_0.conda#dcb27826ffc94d5f04e241322239983b
100+
https://conda.anaconda.org/conda-forge/noarch/pytest-7.4.4-pyhd8ed1ab_0.conda#a9d145de8c5f064b5fa68fb34725d9f4
96101
https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.9.0-pyhd8ed1ab_0.conda#2cf4264fffb9e6eff6031c5b6884d61c
97102
https://conda.anaconda.org/conda-forge/osx-64/clangxx-16.0.6-default_h7151d67_5.conda#8c3fb5d2005174683f3958383643e335
98103
https://conda.anaconda.org/conda-forge/osx-64/libcblas-3.9.0-20_osx64_mkl.conda#51089a4865eb4aec2bc5c7468bd07f9f
99104
https://conda.anaconda.org/conda-forge/osx-64/liblapack-3.9.0-20_osx64_mkl.conda#58f08e12ad487fac4a08f90ff0b87aec
105+
https://conda.anaconda.org/conda-forge/noarch/meson-python-0.15.0-pyh0c530f3_0.conda#3bc64565ca78ce3bb80248d09926d8f9
100106
https://conda.anaconda.org/conda-forge/noarch/pytest-cov-4.1.0-pyhd8ed1ab_0.conda#06eb685a3a0b146347a58dda979485da
101107
https://conda.anaconda.org/conda-forge/noarch/pytest-xdist-3.5.0-pyhd8ed1ab_0.conda#d5f595da2daead898ca958ac62f0307b
102108
https://conda.anaconda.org/conda-forge/noarch/compiler-rt_osx-64-16.0.6-ha38d28d_2.conda#7a46507edc35c6c8818db0adaf8d787f

build_tools/azure/pylatest_conda_forge_mkl_osx-64_environment.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ dependencies:
1414
- matplotlib
1515
- pandas
1616
- pyamg
17-
- pytest
17+
- pytest<8
1818
- pytest-xdist
1919
- pillow
20-
- setuptools
20+
- pip
21+
- ninja
22+
- meson-python
2123
- pytest-cov
2224
- coverage
2325
- ccache

0 commit comments

Comments
 (0)