Skip to content

Commit 5498042

Browse files
committed
Init release
1 parent facc6e9 commit 5498042

19 files changed

Lines changed: 1034 additions & 31 deletions

.github/workflows/wheels.yml

Lines changed: 243 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828

2929
jobs:
3030
build_wheels:
31-
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
31+
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}
3232
if: github.repository == 'scikit-learn/scikit-learn-release'
3333
runs-on: ${{ matrix.os }}
3434
defaults:
@@ -39,58 +39,270 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
include:
42+
# Window 64 bit
43+
- os: windows-latest
44+
python: 311
45+
platform_id: win_amd64
46+
- os: windows-latest
47+
python: 312
48+
platform_id: win_amd64
49+
- os: windows-latest
50+
python: 313
51+
platform_id: win_amd64
52+
- os: windows-latest
53+
python: 314
54+
platform_id: win_amd64
55+
- os: windows-latest
56+
python: 314t
57+
platform_id: win_amd64
58+
59+
# Windows on ARM64 (WoA)
60+
- os: windows-11-arm
61+
python: 311
62+
platform_id: win_arm64
63+
- os: windows-11-arm
64+
python: 312
65+
platform_id: win_arm64
66+
- os: windows-11-arm
67+
python: 313
68+
platform_id: win_arm64
69+
- os: windows-11-arm
70+
python: 314
71+
platform_id: win_arm64
72+
- os: windows-11-arm
73+
python: 314t
74+
platform_id: win_arm64
4275

43-
# Linux
76+
# Linux
77+
- os: ubuntu-latest
78+
python: 311
79+
platform_id: manylinux_x86_64
80+
- os: ubuntu-latest
81+
python: 312
82+
platform_id: manylinux_x86_64
83+
- os: ubuntu-latest
84+
python: 313
85+
platform_id: manylinux_x86_64
86+
- os: ubuntu-latest
87+
python: 314
88+
platform_id: manylinux_x86_64
4489
- os: ubuntu-latest
4590
python: 314t
4691
platform_id: manylinux_x86_64
47-
manylinux_image: manylinux_2_28
92+
93+
# Linux arm
94+
- os: ubuntu-24.04-arm
95+
python: 311
96+
platform_id: manylinux_aarch64
97+
- os: ubuntu-24.04-arm
98+
python: 312
99+
platform_id: manylinux_aarch64
100+
- os: ubuntu-24.04-arm
101+
python: 313
102+
platform_id: manylinux_aarch64
103+
- os: ubuntu-24.04-arm
104+
python: 314
105+
platform_id: manylinux_aarch64
106+
- os: ubuntu-24.04-arm
107+
python: 314t
108+
platform_id: manylinux_aarch64
109+
110+
# MacOS x86_64
111+
- os: macos-15-intel
112+
python: 311
113+
platform_id: macosx_x86_64
114+
- os: macos-15-intel
115+
python: 312
116+
platform_id: macosx_x86_64
117+
- os: macos-15-intel
118+
python: 313
119+
platform_id: macosx_x86_64
120+
- os: macos-15-intel
121+
python: 314
122+
platform_id: macosx_x86_64
123+
- os: macos-15-intel
124+
python: 314t
125+
platform_id: macosx_x86_64
126+
127+
# MacOS arm64
128+
- os: macos-14
129+
python: 311
130+
platform_id: macosx_arm64
131+
- os: macos-14
132+
python: 312
133+
platform_id: macosx_arm64
134+
- os: macos-14
135+
python: 313
136+
platform_id: macosx_arm64
137+
- os: macos-14
138+
python: 314
139+
platform_id: macosx_arm64
140+
- os: macos-14
141+
python: 314t
142+
platform_id: macosx_arm64
48143

49144
steps:
50145
- name: Checkout scikit-learn-release
51146
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
52147
with:
53148
persist-credentials: false
54149

55-
- name: Checkout scikit-learn-release
150+
- name: Checkout scikit-learn
56151
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
57152
with:
58153
repository: scikit-learn/scikit-learn
59154
ref: ${{ env.SOURCE_REF_TO_BUILD }}
60155
path: scikit-learn-src
61156
persist-credentials: false
62157

158+
- uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
159+
if: ${{ startsWith(matrix.platform_id, 'macosx') }}
160+
with:
161+
micromamba-version: '2.8.1-0'
162+
163+
- name: Set-up macOS
164+
if: ${{ startsWith(matrix.platform_id, 'macosx') }}
165+
run: bash tools/configure_macos_env.sh
166+
167+
- name: Set SOURCE_DATE_EPOCH from source commit
168+
run: |
169+
echo "SOURCE_DATE_EPOCH=$(git -C scikit-learn-src log -1 --pretty=%ct)" >> "$GITHUB_ENV"
170+
63171
- name: Build and test wheels
172+
uses: pypa/cibuildwheel@f03ac7617d6cff873ccf24cc0d567ef5ba5a9e6d # v4.0.0
64173
env:
65-
CIBW_ENVIRONMENT: SKLEARN_SKIP_NETWORK_TESTS=1
66174
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
67-
CIBW_ARCHS: all
68-
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
69-
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
70-
# Needed on Windows CI to compile with Visual Studio compiler
71-
# otherwise Meson detects a MINGW64 platform and use MINGW64
72-
# toolchain
73-
# CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
74-
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
75-
# CIBW_BEFORE_BUILD: bash {project}/build_tools/wheels/cibw_before_build.sh {project}
76-
# CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{matrix.platform_id}}
77-
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
78-
# TODO Put back pandas when there is a pandas release with Python 3.14 wheels
79-
# CIBW_TEST_REQUIRES: ${{ contains(matrix.python, '314') && 'pytest' || 'pytest pandas' }} scipy
80-
# On Windows, we use a custom Docker image and CIBW_TEST_REQUIRES_WINDOWS
81-
# does not make sense because it would install dependencies in the host
82-
# rather than inside the Docker image
83-
CIBW_TEST_REQUIRES_WINDOWS: ""
84-
# CIBW_TEST_COMMAND: bash {project}/build_tools/wheels/test_wheels.sh {project}
85-
# CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }} {project} ${{matrix.platform_id}}
86-
CIBW_BUILD_VERBOSITY: 1
87-
run: |
88-
cd scikit-learn-src
89-
python -m pip install cibuildwheel
90-
python -m cibuildwheel --output-dir wheelhouse
175+
CIBW_BEFORE_TEST_WINDOWS: bash tools/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.platform_id }}
176+
CIBW_TEST_COMMAND_WINDOWS: bash {project}/tools/test_windows_wheels.sh ${{ matrix.python }} {project} ${{ matrix.platform_id }}
177+
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
178+
PYTHONHASHSEED: "0"
179+
CIBW_ENVIRONMENT_PASS_LINUX: SOURCE_DATE_EPOCH PYTHONHASHSEED RUNNER_OS
180+
with:
181+
package-dir: scikit-learn-src
182+
output-dir: dist
183+
config-file: cibuildwheel.toml
91184

92185
- name: Store artifacts
93-
uses: actions/upload-artifact@v7
186+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
94187
with:
95188
name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}
96-
path: scikit-learn-src/wheelhouse/*.whl
189+
path: ./dist/*.whl
190+
191+
build_sdist:
192+
name: Source distribution
193+
runs-on: ubuntu-latest
194+
195+
steps:
196+
- name: Checkout scikit-learn-release
197+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
198+
with:
199+
persist-credentials: false
200+
201+
- name: Checkout scikit-learn
202+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
203+
with:
204+
repository: scikit-learn/scikit-learn
205+
ref: ${{ env.SOURCE_REF_TO_BUILD }}
206+
path: scikit-learn-src
207+
persist-credentials: false
208+
209+
- name: Setup Python
210+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0
211+
with:
212+
python-version: "3.12"
213+
214+
- name: Build source distribution
215+
run: bash tools/build_source.sh
216+
217+
- name: Test source distribution
218+
run: bash tools/test_source.sh
219+
220+
- name: Store artifacts
221+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
222+
with:
223+
name: cibw-sdist
224+
path: dist/*.tar.gz
225+
226+
testpypi-publish:
227+
name: Publish release to TestPyPI
228+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testpypi'
229+
runs-on: ubuntu-latest
230+
needs: [build_wheels, build_sdist]
231+
environment:
232+
name: testpypi
233+
url: https://test.pypi.org/p/scikit-learn
234+
permissions:
235+
id-token: write # mandatory for trusted publishing
236+
steps:
237+
- name: Download sdist and wheels
238+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
239+
with:
240+
path: dist
241+
merge-multiple: true
242+
243+
- name: View artifacts
244+
run: ls dist
245+
246+
# - name: Publish
247+
# uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
248+
# with:
249+
# repository-url: https://test.pypi.org/legacy/
250+
# skip-existing: true
251+
# print-hash: true
252+
# attestations: true
253+
254+
nightly_upload:
255+
name: Nightly upload
256+
if: github.repository == 'scikit-learn/scikit-learn-release' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'none'))
257+
runs-on: ubuntu-latest
258+
needs: [build_wheels]
259+
260+
steps:
261+
- name: Download sdist and wheels
262+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
263+
with:
264+
path: dist
265+
merge-multiple: true
266+
267+
- name: Install micromamba
268+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
269+
with:
270+
# For installation of anaconda-client, required for upload to anaconda.org
271+
init-shell: bash
272+
environment-name: upload-env
273+
create-args: >-
274+
anaconda-client
275+
276+
# - name: Upload to anaconda.org
277+
# shell: bash -el {0} # required for micromamba
278+
# env:
279+
# TOKEN: ${{ secrets.SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN }}
280+
# run: |
281+
# anaconda -q -t ${TOKEN} upload --force -u scientific-python-nightly-wheels ./dist/*.whl
282+
283+
pypi-publish:
284+
name: Publish release to PyPI
285+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi'
286+
runs-on: ubuntu-latest
287+
needs: [build_wheels, build_sdist]
288+
environment:
289+
name: pypi
290+
url: https://pypi.org/p/scikit-learn
291+
permissions:
292+
id-token: write # mandatory for trusted publishing
293+
steps:
294+
- name: Download sdist and wheels
295+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
296+
with:
297+
path: dist
298+
merge-multiple: true
299+
300+
- name: View artifacts
301+
run: ls dist
302+
303+
# - name: Publish
304+
# uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
305+
# with:
306+
# print-hash: true
307+
# attestations: true
308+

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2007-2026 The scikit-learn developers.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Scikit-learn wheels and release tooling
2+
3+
This repository contains what is needed to build release artifacts (wheels and
4+
sdist) for the official [Scikit-learn releases to
5+
PyPI](https://pypi.org/project/scikit-learn/) as well as nightly wheel builds which
6+
are uploaded to
7+
[anaconda.org/scientific-python-nightly-wheels/scikit-learn](https://anaconda.org/scientific-python-nightly-wheels/scikit-learn).

cibuildwheel.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[tool.cibuildwheel]
2+
build-verbosity = 1
3+
archs = ["all"]
4+
# Use the manylinux_2_28 images for the Linux wheels.
5+
manylinux-x86_64-image = "manylinux_2_28"
6+
manylinux-i686-image = "manylinux_2_28"
7+
environment = { SKLEARN_SKIP_NETWORK_TESTS = "1" }
8+
before-build = "bash {project}/tools/cibw_before_build.sh {project}"
9+
before-test = "pip install -r {project}/requirements/test_requirements.txt"
10+
test-command = "bash {project}/tools/test_wheels.sh {project}"
11+
12+
[tool.cibuildwheel.windows]
13+
# Needed on Windows CI to compile with Visual Studio compiler
14+
# otherwise Meson detects a MINGW64 platform and use MINGW64
15+
# toolchain
16+
config-settings = "setup-args=--vsenv"
17+
repair-wheel-command = "bash tools/repair_windows_wheels.sh {wheel} {dest_dir}"
18+
# On Windows, we use a custom Docker image and the test dependencies are
19+
# installed inside the Docker image rather than on the host, so there are no
20+
# test requirements to install here.
21+
test-requires = []
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
numpy==2.4.6
2+
scipy==1.17.1
3+
cython==3.2.5
4+
twine==6.2.0
5+
build==1.5.0

requirements/test_requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pytest==9.0.3
2+
scipy==1.17.1
3+
pandas==3.0.3

0 commit comments

Comments
 (0)