8000 CI Add wheel builds for Python 3.11 (#24446) · scikit-learn/scikit-learn@e022654 · GitHub
[go: up one dir, main page]

Skip to content

Commit e022654

Browse files
cmarmojjerphanthomasjpfan
authored andcommitted
CI Add wheel builds for Python 3.11 (#24446)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent c01919b commit e022654

File tree

7 files changed

+55
-48
lines changed

7 files changed

+55
-48
lines changed

.github/workflows/wheels.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ jobs:
5353
# https://github.com/scikit-learn/scikit-learn/issues/22530
5454
- os: windows-2019
5555
python: 38
56-
bitness: 64
5756
platform_id: win_amd64
5857
- os: windows-latest
5958
python: 39
60-
bitness: 64
6159
platform_id: win_amd64
6260
- os: windows-latest
6361
python: 310
64-
bitness: 64
62+
platform_id: win_amd64
63+
- os: windows-latest
64+
python: 311
6565
platform_id: win_amd64
6666

6767
# Window 32 bit
@@ -77,49 +77,51 @@ jobs:
7777
# Linux 64 bit manylinux2014
7878
- os: ubuntu-latest
7979
python: 38
80-
bitness: 64
8180
platform_id: manylinux_x86_64
8281
manylinux_image: manylinux2014
8382
- os: ubuntu-latest
8483
python: 39
85-
bitness: 64
8684
platform_id: manylinux_x86_64
8785
manylinux_image: manylinux2014
8886

8987
# NumPy on Python 3.10 only supports 64bit and is only available with manylinux2014
9088
- os: ubuntu-latest
9189
python: 310
92-
bitness: 64
90+
platform_id: manylinux_x86_64
91+
manylinux_image: manylinux2014
92+
93+
- os: ubuntu-latest
94+
python: 311
9395
platform_id: manylinux_x86_64
9496
manylinux_image: manylinux2014
9597

9698
# MacOS x86_64
9799
- os: macos-latest
98-
bitness: 64
99100
python: 38
100101
platform_id: macosx_x86_64
101102
- os: macos-latest
102-
bitness: 64
103103
python: 39
104104
platform_id: macosx_x86_64
105105
- os: macos-latest
106-
bitness: 64
107106
python: 310
108107
platform_id: macosx_x86_64
108+
- os: macos-latest
109+
python: 311
110+
platform_id: macosx_x86_64
109111

110112
# MacOS arm64
111113
- os: macos-latest
112-
bitness: 64
113114
python: 38
114115
platform_id: macosx_arm64
115116
- os: macos-latest
116-
bitness: 64
117117
python: 39
118118
platform_id: macosx_arm64
119119
- os: macos-latest
120-
bitness: 64
121120
python: 310
122121
platform_id: macosx_arm64
122+
- os: macos-latest
123+
python: 311
124+
platform_id: macosx_arm64
123125

124126
steps:
125127
- name: Checkout scikit-learn
@@ -143,11 +145,11 @@ jobs:
143145
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
144146
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
145147
CIBW_TEST_SKIP: "*-macosx_arm64"
146-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }}
147-
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }}
148+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
149+
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }}
148150
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl
149151
CIBW_TEST_COMMAND: bash {project}/build_tools/github/test_wheels.sh
150-
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} ${{ matrix.bitness }}
152+
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }}
151153
CIBW_BUILD_VERBOSITY: 1
152154

153155
run: bash build_tools/github/build_wheels.sh

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ jobs:
7070
- CIBW_BUILD=cp310-manylinux_aarch64
7171
- BUILD_WHEEL=true
7272

73+
- os: linux
74+
arch: arm64-graviton2
75+
dist: focal
76+
virt: vm
77+
group: edge
78+
if: type = cron or commit_message =~ /\[cd build\]/
79+
env:
80+
- CIBW_BUILD=cp311-manylinux_aarch64
81+
- BUILD_WHEEL=true
82+
7383
install: source build_tools/travis/install.sh || travis_terminate 1
7484
script: source build_tools/travis/script.sh || travis_terminate 1
7585
after_success: source build_tools/travis/after_success.sh || travis_terminate 1

build_tools/github/build_minimal_windows_image.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ set -e
44
set -x
55

66
PYTHON_VERSION=$1
7-
BITNESS=$2
8-
9-
if [[ "$BITNESS" == "32" ]]; then
10-
# 32-bit architectures are not supported
11-
# by the official Docker images: Tests will just be run
12-
# on the host (instead of the minimal Docker container).
13-
exit 0
14-
fi
157

168
TEMP_FOLDER="$HOME/AppData/Local/Temp"
179
WHEEL_PATH=$(ls -d $TEMP_FOLDER/**/*/repaired_wheel/*)
@@ -22,6 +14,12 @@ cp $WHEEL_PATH $WHEEL_NAME
2214
# Dot the Python version for identyfing the base Docker image
2315
PYTHON_VERSION=$(echo ${PYTHON_VERSION:0:1}.${PYTHON_VERSION:1:2})
2416

17+
# TODO: Remove when 3.11 images will be available for
18+
# windows (for now the docker image is tagged as 3.11-rc)
19+
if [[ "$PYTHON_VERSION" == "3.11" ]]; then
20+
PYTHON_VERSION=$(echo ${PYTHON_VERSION}-rc)
21+
fi
22+
2523
# Build a minimal Windows Docker image for testing the wheels
2624
docker build --build-arg PYTHON_VERSION=$PYTHON_VERSION \
2725
--build-arg WHEEL_NAME=$WHEEL_NAME \

build_tools/github/build_wheels.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ if [[ "$RUNNER_OS" == "macOS" ]]; then
3131
export CFLAGS="$CFLAGS -I$PREFIX/include"
3232
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
3333
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"
34+
# Disable the use of setuptools's vendored copy distutils when invoking setuptools
35+
# See: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
36+
# TODO: remove the definition of this environment variable when no
37+
# reference to distutils exist in the code-base for building scikit-learn.
38+
export SETUPTOOLS_USE_DISTUTILS=stdlib
3439
fi
3540

3641
# The version of the built dependencies are specified

build_tools/github/repair_windows_wheels.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ set -x
55

66
WHEEL=$1
77
DEST_DIR=$2
8-
BITNESS=$3
98

109
# By default, the Windows wheels are not repaired.
1110
# In this case, we need to vendor VCRUNTIME140.dll
1211
wheel unpack "$WHEEL"
1312
WHEEL_DIRNAME=$(ls -d scikit_learn-*)
14-
python build_tools/github/vendor.py "$WHEEL_DIRNAME" "$BITNESS"
13+
python build_tools/github/vendor.py "$WHEEL_DIRNAME"
1514
wheel pack "$WHEEL_DIRNAME" -d "$DEST_DIR"
1615
rm -rf "$WHEEL_DIRNAME"

build_tools/github/test_windows_wheels.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -e
44
set -x
55

66
PYTHON_VERSION=$1
7-
BITNESS=$2
87

98
if [[ "$BITNESS" == "32" ]]; then
109
# 32-bit architectures use the regular

build_tools/github/vendor.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ def make_distributor_init_64_bits(
114114
)
115115

116116

117-
def main(wheel_dirname, bitness):
117+
def main(wheel_dirname):
118118
"""Embed vcomp140.dll, vcruntime140.dll and vcruntime140_1.dll."""
119119
if not op.exists(VCOMP140_SRC_PATH):
120120
raise ValueError(f"Could not find {VCOMP140_SRC_PATH}.")
121121

122122
if not op.exists(VCRUNTIME140_SRC_PATH):
123123
raise ValueError(f"Could not find {VCRUNTIME140_SRC_PATH}.")
124124

125-
if not op.exists(VCRUNTIME140_1_SRC_PATH) and bitness == "64":
125+
if not op.exists(VCRUNTIME140_1_SRC_PATH):
126126
raise ValueError(f"Could not find {VCRUNTIME140_1_SRC_PATH}.")
127127

128-
if not op.exists(MSVCP140_SRC_PATH) and bitness == "64":
128+
if not op.exists(MSVCP140_SRC_PATH):
129129
raise ValueError(f"Could not find {MSVCP140_SRC_PATH}.")
130130

131131
if not op.isdir(wheel_dirname):
@@ -149,29 +149,23 @@ def main(wheel_dirname, bitness):
149149
print(f"Copying {VCRUNTIME140_SRC_PATH} to {target_folder}.")
150150
shutil.copy2(VCRUNTIME140_SRC_PATH, target_folder)
151151

152-
if bitness == "64":
153-
print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.")
154-
shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder)
152+
print(f"Copying {VCRUNTIME140_1_SRC_PATH} to {target_folder}.")
153+
shutil.copy2(VCRUNTIME140_1_SRC_PATH, target_folder)
155154

156-
print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.")
157-
shutil.copy2(MSVCP140_SRC_PATH, target_folder)
155+
print(f"Copying {MSVCP140_SRC_PATH} to {target_folder}.")
156+
shutil.copy2(MSVCP140_SRC_PATH, target_folder)
158157

159158
# Generate the _distributor_init file in the source tree
160159
print("Generating the '_distributor_init.py' file.")
161-
if bitness == "32":
162-
make_distributor_init_32_bits(
163-
distributor_init, vcomp140_dll_filename, vcruntime140_dll_filename
164-
)
165-
else:
166-
make_distributor_init_64_bits(
167-
distributor_init,
168-
1CF5 vcomp140_dll_filename,
169-
vcruntime140_dll_filename,
170-
vcruntime140_1_dll_filename,
171-
msvcp140_dll_filename,
172-
)
160+
make_distributor_init_64_bits(
161+
distributor_init,
162+
vcomp140_dll_filename,
163+
vcruntime140_dll_filename,
164+
vcruntime140_1_dll_filename,
165+
msvcp140_dll_filename,
166+
)
173167

174168

175169
if __name__ == "__main__":
176-
_, wheel_file, bitness = sys.argv
177-
main(wheel_file, bitness)
170+
_, wheel_file = sys.argv
171+
main(wheel_file)

0 commit comments

Comments
 (0)
0