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

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 38c34af

Browse files
cmarmojjerphanthomasjpfan
authored
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 3e6a39a commit 38c34af

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
@@ -57,63 +57,65 @@ jobs:
5757
# https://github.com/scikit-learn/scikit-learn/issues/22530
5858
- os: windows-2019
5959
python: 38
60-
bitness: 64
6160
platform_id: win_amd64
6261
- os: windows-latest
6362
python: 39
64-
bitness: 64
6563
platform_id: win_amd64
6664
- os: windows-latest
6765
python: 310
68-
bitness: 64
66+
platform_id: win_amd64
67+
- os: windows-latest
68+
python: 311
6969
platform_id: win_amd64
7070

7171
# Linux 64 bit manylinux2014
7272
- os: ubuntu-latest
7373
python: 38
74-
bitness: 64
7574
platform_id: manylinux_x86_64
7675
manylinux_image: manylinux2014
7776
- os: ubuntu-latest
7877
python: 39
79-
bitness: 64
8078
platform_id: manylinux_x86_64
8179
manylinux_image: manylinux2014
8280

8381
# NumPy on Python 3.10 only supports 64bit and is only available with manylinux2014
8482
- os: ubuntu-latest
8583
python: 310
86-
bitness: 64
84+
platform_id: manylinux_x86_64
85+
manylinux_image: manylinux2014
86+
87+
- os: ubuntu-latest
88+
python: 311
8789
platform_id: manylinux_x86_64
8890
manylinux_image: manylinux2014
8991

9092
# MacOS x86_64
9193
- os: macos-latest
92-
bitness: 64
9394
python: 38
9495
platform_id: macosx_x86_64
9596
- os: macos-latest
96-
bitness: 64
9797
python: 39
9898
platform_id: macosx_x86_64
9999
- os: macos-latest
100-
bitness: 64
101100
python: 310
102101
platform_id: macosx_x86_64
102+
- os: macos-latest
103+
python: 311
104+
platform_id: macosx_x86_64
103105

104106
# MacOS arm64
105107
- os: macos-latest
106-
bitness: 64
107108
python: 38
108109
platform_id: macosx_arm64
109110
- os: macos-latest
110-
bitness: 64
111111
python: 39
112112
platform_id: macosx_arm64
113113
- os: macos-latest
114-
bitness: 64
115114
python: 310
116115
platform_id: macosx_arm64
116+
- os: macos-latest
117+
python: 311
118+
platform_id: macosx_arm64
117119

118120
steps:
119121
- name: Checkout scikit-learn
@@ -137,11 +139,11 @@ jobs:
137139
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
138140
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
139141
CIBW_TEST_SKIP: "*-macosx_arm64"
140-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }}
141-
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }}
142+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
143+
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }}
142144
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl
143145
CIBW_TEST_COMMAND: bash {project}/build_tools/github/test_wheels.sh
144-
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} ${{ matrix.bitness }}
146+
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }}
145147
CIBW_BUILD_VERBOSITY: 1
146148

147149
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
docker container run \
109
--rm scikit-learn/minimal-windows \

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-
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