Skip to content

Commit 74b2e69

Browse files
committed
Merging main
Signed-off-by: Adam Li <adam2392@gmail.com>
2 parents 86a0d62 + 7e8ad63 commit 74b2e69

38 files changed

+301
-270
lines changed

.github/workflows/check-changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
run: |
1717
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
1818
echo "TAGGED_MILESTONE=${{ github.event.pull_request.milestone.title }}" >> $GITHUB_ENV
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: '0'
2222
- name: Check the changelog entry

.github/workflows/check-sdist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- uses: actions/setup-python@v5
1616
with:
1717
python-version: '3.9'

.github/workflows/cuda-gpu-ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ jobs:
1414
group: cuda-gpu-runner-group
1515
name: Run Array API unit tests
1616
steps:
17-
- uses: actions/setup-python@v4
17+
- uses: actions/setup-python@v5
1818
with:
19-
python-version: '3.12'
19+
# XXX: The 3.12.4 release of Python on GitHub Actions is corrupted:
20+
# https://github.com/actions/setup-python/issues/886
21+
python-version: '3.12.3'
2022
- name: Checkout main repository
2123
uses: actions/checkout@v4
2224
- run: |
@@ -25,7 +27,7 @@ jobs:
2527
echo "Checked out commit $(git rev-parse HEAD)"
2628
- name: Cache conda environment
2729
id: cache-conda
28-
uses: actions/cache@v3
30+
uses: actions/cache@v4
2931
with:
3032
path: ~/conda
3133
key: ${{ runner.os }}-build-${{ hashFiles('build_tools/github/create_gpu_environment.sh') }}-${{ hashFiles('build_tools/github/pylatest_conda_forge_cuda_array-api_linux-64_conda.lock') }}

.github/workflows/labeler-title-regex.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
labeler:
1616
runs-on: ubuntu-20.04
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: actions/setup-python@v5
2020
with:
2121
python-version: '3.9'

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
ref: ${{ github.event.pull_request.head.sha }}
2626

@@ -52,7 +52,7 @@ jobs:
5252
5353
- name: Upload Artifact
5454
if: always()
55-
uses: actions/upload-artifact@v3
55+
uses: actions/upload-artifact@v4
5656
with:
5757
name: lint-log
5858
path: |
@@ -72,7 +72,7 @@ jobs:
7272

7373
steps:
7474
- name: Checkout code
75-
uses: actions/checkout@v3
75+
uses: actions/checkout@v4
7676

7777
- name: Set up Python
7878
uses: actions/setup-python@v5
@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: Download artifact
8686
id: download-artifact
87-
uses: actions/download-artifact@v3
87+
uses: actions/download-artifact@v4
8888
with:
8989
name: lint-log
9090

.github/workflows/publish_pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# IMPORTANT: this permission is mandatory for trusted publishing
1919
id-token: write
2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- uses: actions/setup-python@v5
2323
with:
2424
python-version: '3.8'

.github/workflows/update-lock-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
4747
- name: Create Pull Request
4848
id: cpr
49-
uses: peter-evans/create-pull-request@v5
49+
uses: peter-evans/create-pull-request@v6
5050
with:
5151
token: ${{ secrets.BOT_GITHUB_TOKEN }}
5252
push-to-fork: scikit-learn-bot/scikit-learn

.github/workflows/update_tracking_issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
if: github.repository == 'scikit-learn/scikit-learn' && github.event_name == 'schedule'
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030
- uses: actions/setup-python@v5
3131
with:
3232
python-version: '3.9'

.github/workflows/wheels.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Checkout scikit-learn
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636
with:
3737
ref: ${{ github.event.pull_request.head.sha }}
3838

@@ -117,7 +117,7 @@ jobs:
117117

118118
steps:
119119
- name: Checkout scikit-learn
120-
uses: actions/checkout@v3
120+
uses: actions/checkout@v4
121121

122122
- name: Setup Python
123123
uses: actions/setup-python@v5
@@ -175,8 +175,9 @@ jobs:
175175
run: bash build_tools/wheels/build_wheels.sh
176176

177177
- name: Store artifacts
178-
uses: actions/upload-artifact@v3
178+
uses: actions/upload-artifact@v4
179179
with:
180+
name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}
180181
path: wheelhouse/*.whl
181182

182183
update-tracker:
@@ -197,7 +198,7 @@ jobs:
197198

198199
steps:
199200
- name: Checkout scikit-learn
200-
uses: actions/checkout@v3
201+
uses: actions/checkout@v4
201202

202203
- name: Setup Python
203204
uses: actions/setup-python@v5
@@ -215,8 +216,9 @@ jobs:
215216
SKLEARN_SKIP_NETWORK_TESTS: 1
216217

217218
- name: Store artifacts
218-
uses: actions/upload-artifact@v3
219+
uses: actions/upload-artifact@v4
219220
with:
221+
name: cibw-sdist
220222
path: dist/*.tar.gz
221223

222224
# Upload the wheels and the source distribution
@@ -230,12 +232,14 @@ jobs:
230232

231233
steps:
232234
- name: Checkout scikit-learn
233-
uses: actions/checkout@v3
235+
uses: actions/checkout@v4
234236

235237
- name: Download artifacts
236-
uses: actions/download-artifact@v3
238+
uses: actions/download-artifact@v4
237239
with:
240+
pattern: cibw-*
238241
path: dist
242+
merge-multiple: true
239243

240244
- name: Setup Python
241245
uses: actions/setup-python@v5

azure-pipelines.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,40 +62,26 @@ jobs:
6262
SKLEARN_WARNINGS_AS_ERRORS: '1'
6363
CHECK_PYTEST_SOFT_DEPENDENCY: 'true'
6464

65-
- template: build_tools/azure/posix-docker.yml
66-
# Experimental CPython branch without the Global Interpreter Lock:
67-
# https://github.com/colesbury/nogil/
68-
#
69-
# The nogil build relies on a dedicated PyPI-style index to install patched
70-
# versions of NumPy, SciPy and Cython maintained by @colesbury and that
71-
# include specific fixes to make them run correctly without relying on the GIL.
72-
#
73-
# The goal of this CI entry is to make sure that we do not introduce any
74-
# dependency on the GIL in scikit-learn itself. An auxiliary goal is to early
75-
# detect any regression in the patched build dependencies to report them
76-
# upstream. The long-term goal is to be able to stop having to maintain
77-
# multiprocessing based workaround / hacks in joblib / loky to make multi-CPU
78-
# computing in scikit-learn efficient by default using regular threads.
79-
#
80-
# If this experimental entry becomes too unstable, feel free to disable it.
65+
- template: build_tools/azure/posix.yml
66+
# CPython 3.13 free-threaded build
8167
parameters:
82-
name: Linux_nogil
83-
vmImage: ubuntu-20.04
68+
name: Linux_free_threaded
69+
vmImage: ubuntu-22.04
8470
dependsOn: [git_commit, linting]
8571
condition: |
8672
and(
8773
succeeded(),
8874
not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')),
8975
or(eq(variables['Build.Reason'], 'Schedule'),
90-
contains(dependencies['git_commit']['outputs']['commit.message'], '[nogil]'
76+
contains(dependencies['git_commit']['outputs']['commit.message'], '[free-threaded]'
9177
)
9278
)
9379
)
9480
matrix:
95-
pylatest_pip_nogil:
96-
DOCKER_CONTAINER: 'nogil/python'
97-
DISTRIB: 'pip-nogil'
98-
LOCK_FILE: './build_tools/azure/python_nogil_lock.txt'
81+
pylatest_pip_free_threaded:
82+
PYTHON_GIL: '0'
83+
DISTRIB: 'pip-free-threaded'
84+
LOCK_FILE: './build_tools/azure/cpython_free_threaded_lock.txt'
9985
COVERAGE: 'false'
10086

10187
- job: Linux_Nightly_Pyodide
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --output-file=/scikit-learn/build_tools/azure/cpython_free_threaded_lock.txt /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
6+
#
7+
execnet==2.1.1
8+
# via pytest-xdist
9+
iniconfig==2.0.0
10+
# via pytest
11+
joblib==1.4.2
12+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
13+
meson==1.4.1
14+
# via meson-python
15+
meson-python==0.16.0
16+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
17+
ninja==1.11.1.1
18+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
19+
packaging==24.0
20+
# via
21+
# meson-python
22+
# pyproject-metadata
23+
# pytest
24+
pluggy==1.5.0
25+
# via pytest
26+
pyproject-metadata==0.8.0
27+
# via meson-python
28+
pytest==8.2.2
29+
# via
30+
# -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
31+
# pytest-xdist
32+
pytest-xdist==3.6.1
33+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
34+
threadpoolctl==3.5.0
35+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
36+
37+
# The following packages are considered to be unsafe in a requirements file:
38+
setuptools==70.0.0
39+
# via -r /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To generate cpython_free_threaded_lock.txt, use the following command:
2+
# docker run -v $PWD:/scikit-learn -it ubuntu bash -c 'export DEBIAN_FRONTEND=noninteractive; apt-get -yq update; apt-get install software-properties-common ccache -y; add-apt-repository --yes ppa:deadsnakes/nightly; apt-get update -y; apt-get install -y --no-install-recommends python3.13-dev python3.13-venv python3.13-nogil; python3.13t -m venv /venvs/myenv; source /venvs/myenv/bin/activate; pip install pip-tools; pip-compile --allow-unsafe /scikit-learn/build_tools/azure/cpython_free_threaded_requirements.txt -o /scikit-learn/build_tools/azure/cpython_free_threaded_lock.txt'
3+
4+
# The reason behind it is that you need python-3.13t to generate the pip lock
5+
# file. For pure Python wheel this does not really matter. But when there are
6+
# cython, numpy and scipy releases that have a CPython 3.13 free-threaded
7+
# wheel, we can add them here and this is important that the Python 3.13
8+
# free-threaded wheel is picked up in the lock-file
9+
joblib
10+
threadpoolctl
11+
pytest
12+
pytest-xdist
13+
ninja
14+
meson-python
15+
# For some reason some of our tests require setuptools.
16+
# TODO: update those tests to remove the dependency.
17+
setuptools

build_tools/azure/debian_atlas_32bit_lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ meson-python==0.16.0
2020
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
2121
ninja==1.11.1.1
2222
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
23-
packaging==24.0
23+
packaging==24.1
2424
# via
2525
# meson-python
2626
# pyproject-metadata

build_tools/azure/install.sh

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,24 @@ pre_python_environment_install() {
3838
apt-get install -y python3-dev python3-numpy python3-scipy \
3939
python3-matplotlib libatlas3-base libatlas-base-dev \
4040
python3-virtualenv python3-pandas ccache git
41+
42+
# TODO for now we use CPython 3.13 from Ubuntu deadsnakes PPA. When CPython
43+
# 3.13 is released (scheduled October 2024) we can use something more
44+
# similar to other conda+pip based builds
45+
elif [[ "$DISTRIB" == "pip-free-threaded" ]]; then
46+
sudo apt-get -yq update
47+
sudo apt-get install -yq ccache
48+
sudo apt-get install -yq software-properties-common
49+
sudo add-apt-repository --yes ppa:deadsnakes/nightly
50+
sudo apt-get update -yq
51+
sudo apt-get install -yq --no-install-recommends python3.13-dev python3.13-venv python3.13-nogil
4152
fi
4253
}
4354

4455
check_packages_dev_version() {
4556
for package in $@; do
4657
package_version=$(python -c "import $package; print($package.__version__)")
47-
if ! [[ $package_version =~ "dev" ]]; then
58+
if [[ $package_version =~ "^[.0-9]+$" ]]; then
4859
echo "$package is not a development version: $package_version"
4960
exit 1
5061
fi
@@ -61,31 +72,33 @@ python_environment_install_and_activate() {
6172
source $VIRTUALENV/bin/activate
6273
pip install -r "${LOCK_FILE}"
6374

64-
elif [[ "$DISTRIB" == "pip-nogil" ]]; then
65-
python -m venv $VIRTUALENV
75+
elif [[ "$DISTRIB" == "pip-free-threaded" ]]; then
76+
python3.13t -m venv $VIRTUALENV
6677
source $VIRTUALENV/bin/activate
6778
pip install -r "${LOCK_FILE}"
79+
# TODO for now need pip 24.1b1 to find free-threaded wheels
80+
pip install -U --pre pip
81+
# TODO When there are CPython 3.13 free-threaded wheels for numpy,
82+
# scipy and cython move them to
83+
# build_tools/azure/cpython_free_threaded_requirements.txt. For now we
84+
# install them from scientific-python-nightly-wheels
85+
dev_anaconda_url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
86+
dev_packages="numpy scipy Cython"
87+
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages
6888
fi
6989

7090
if [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then
7191
echo "Installing development dependency wheels"
7292
dev_anaconda_url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
73-
dev_packages="numpy scipy pandas"
93+
dev_packages="numpy scipy pandas Cython"
7494
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages
7595

7696
check_packages_dev_version $dev_packages
7797

78-
echo "Installing Cython from latest sources"
79-
pip install https://github.com/cython/cython/archive/master.zip
8098
echo "Installing joblib from latest sources"
8199
pip install https://github.com/joblib/joblib/archive/master.zip
82100
echo "Installing pillow from latest sources"
83101
pip install https://github.com/python-pillow/Pillow/archive/main.zip
84-
85-
elif [[ "$DISTRIB" == "pip-nogil" ]]; then
86-
apt-get -yq update
87-
apt-get install -yq ccache
88-
89102
fi
90103
}
91104

0 commit comments

Comments
 (0)