Skip to content

Commit 86a0d62

Browse files
committed
Merging main
Signed-off-by: Adam Li <adam2392@gmail.com>
2 parents 9a1d4b4 + 5bc86b8 commit 86a0d62

File tree

129 files changed

+1589
-4455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1589
-4455
lines changed

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions as recommended in SPEC8:
4+
# https://github.com/scientific-python/specs/pull/325
5+
# At the time of writing, release critical workflows such as
6+
# pypa/gh-action-pypi-publish should use hash-based versioning for security
7+
# reasons. This strategy may be generalized to all other github actions
8+
# in the future.
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "monthly"
13+
groups:
14+
actions:
15+
patterns:
16+
- "*"
17+
labels:
18+
- "Build / CI"
19+
- "dependencies"
20+
reviewers:
21+
- "scikit-learn/core-devs"

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CUDA GPU
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr_id:
6+
description: Test the contents of this Pull Request
7+
required: true
8+
9+
permissions: read-all
10+
11+
jobs:
12+
tests:
13+
runs-on:
14+
group: cuda-gpu-runner-group
15+
name: Run Array API unit tests
16+
steps:
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.12'
20+
- name: Checkout main repository
21+
uses: actions/checkout@v4
22+
- run: |
23+
git fetch origin +refs/pull/${{ inputs.pr_id }}/head:pr-${{ inputs.pr_id }}
24+
git checkout pr-${{ inputs.pr_id }}
25+
echo "Checked out commit $(git rev-parse HEAD)"
26+
- name: Cache conda environment
27+
id: cache-conda
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/conda
31+
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') }}
32+
- name: Install miniforge
33+
if: ${{ steps.cache-conda.outputs.cache-hit != 'true' }}
34+
run: bash build_tools/github/create_gpu_environment.sh
35+
- name: Install scikit-learn
36+
run: |
37+
source "${HOME}/conda/etc/profile.d/conda.sh"
38+
conda activate sklearn
39+
pip install --verbose --no-build-isolation --config-settings editable-verbose=true --editable .
40+
- name: Run array API tests
41+
run: |
42+
source "${HOME}/conda/etc/profile.d/conda.sh"
43+
conda activate sklearn
44+
pytest -k 'array_api'

.github/workflows/publish_pypi.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ jobs:
3939
run: |
4040
python build_tools/github/check_wheels.py
4141
- name: Publish package to TestPyPI
42-
uses: pypa/gh-action-pypi-publish@v1.8.5
42+
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
4343
with:
44-
repository_url: https://test.pypi.org/legacy/
44+
repository-url: https://test.pypi.org/legacy/
45+
print-hash: true
4546
if: ${{ github.event.inputs.pypi_repo == 'testpypi' }}
4647
- name: Publish package to PyPI
47-
uses: pypa/gh-action-pypi-publish@v1.8.5
48+
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
4849
if: ${{ github.event.inputs.pypi_repo == 'pypi' }}
50+
with:
51+
print-hash: true

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
schedule:
77
- cron: '0 5 * * 1'
88

9+
# XXX Set the right permissions, per step??
10+
# Can we set read only at the global level here and then elevate to write for some steps?
11+
#permissions: read-all
12+
913
jobs:
1014
update_lock_files:
1115
if: github.repository == 'scikit-learn/scikit-learn'
@@ -25,9 +29,8 @@ jobs:
2529
- name: cirrus-arm
2630
update_script_args: "--select-tag arm"
2731
additional_commit_message: "[cirrus arm]"
28-
- name: pypy
29-
update_script_args: "--select-tag pypy"
30-
additional_commit_message: "[pypy]"
32+
- name: array-api
33+
update_script_args: "--select-tag cuda"
3134

3235
steps:
3336
- uses: actions/checkout@v4
@@ -59,6 +62,14 @@ jobs:
5962
### Note
6063
If the CI tasks fail, create a new branch based on this PR and add the required fixes to that branch.
6164
65+
# The CUDA workflow needs to be triggered explicitly as it uses an expensive runner
66+
- name: Trigger additional tests
67+
if: steps.cpr.outputs.pull-request-number != '' && matrix.name == 'array-api'
68+
env:
69+
GH_TOKEN: ${{ github.token }}
70+
run: |
71+
gh workflow run .github/workflows/cuda-gpu-ci.yml -f pr_id=${{steps.cpr.outputs.pull-request-number}}
72+
6273
- name: Check Pull Request
6374
if: steps.cpr.outputs.pull-request-number != ''
6475
run: |

Makefile

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
PYTHON ?= python
66
CYTHON ?= cython
77
PYTEST ?= pytest
8-
CTAGS ?= ctags
98

109
# skip doctests on 32bit python
1110
BITS := $(shell python -c 'import struct; print(8 * struct.calcsize("P"))')
1211

1312
all: clean inplace test
1413

15-
clean-ctags:
16-
rm -f tags
17-
18-
clean: clean-ctags
14+
clean:
1915
$(PYTHON) setup.py clean
2016
rm -rf dist
2117

@@ -24,7 +20,7 @@ inplace:
2420
$(PYTHON) setup.py build_ext -i
2521

2622
dev-meson:
27-
pip install --verbose --no-build-isolation --editable . --config-settings editable-verbose=true
23+
pip install --verbose --no-build-isolation --editable . --check-build-dependencies --config-settings editable-verbose=true
2824

2925
clean-meson:
3026
pip uninstall -y scikit-learn
@@ -49,25 +45,11 @@ test-coverage-parallel:
4945

5046
test: test-code test-sphinxext test-doc
5147

52-
trailing-spaces:
53-
find sklearn -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
54-
5548
cython:
5649
python setup.py build_src
5750

58-
ctags:
59-
# make tags for symbol based navigation in emacs and vim
60-
# Install with: sudo apt-get install exuberant-ctags
61-
$(CTAGS) --python-kinds=-i -R sklearn
62-
6351
doc: inplace
6452
$(MAKE) -C doc html
6553

6654
doc-noplot: inplace
6755
$(MAKE) -C doc html-noplot
68-
69-
code-analysis:
70-
build_tools/linting.sh
71-
72-
build-dev:
73-
pip install --verbose --no-build-isolation --editable .

azure-pipelines.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,37 +98,16 @@ jobs:
9898
LOCK_FILE: './build_tools/azure/python_nogil_lock.txt'
9999
COVERAGE: 'false'
100100

101-
- template: build_tools/azure/posix-docker.yml
102-
parameters:
103-
name: Linux_Nightly_PyPy
104-
vmImage: ubuntu-20.04
105-
dependsOn: [linting, git_commit]
106-
condition: |
107-
and(
108-
succeeded(),
109-
not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')),
110-
or(
111-
eq(variables['Build.Reason'], 'Schedule'),
112-
contains(dependencies['git_commit']['outputs']['commit.message'], '[pypy]')
113-
)
114-
)
115-
matrix:
116-
pypy3:
117-
DOCKER_CONTAINER: 'condaforge/miniforge3:4.10.3-5'
118-
DISTRIB: 'conda-pypy3'
119-
LOCK_FILE: './build_tools/azure/pypy3_linux-64_conda.lock'
120-
121-
122101
- job: Linux_Nightly_Pyodide
123102
pool:
124103
vmImage: ubuntu-22.04
125104
variables:
126105
# Need to match Python version and Emscripten version for the correct
127106
# Pyodide version. For example, for Pyodide version 0.25.1, see
128107
# https://github.com/pyodide/pyodide/blob/0.25.1/Makefile.envs
129-
PYODIDE_VERSION: '0.25.1'
130-
EMSCRIPTEN_VERSION: '3.1.46'
131-
PYTHON_VERSION: '3.11.3'
108+
PYODIDE_VERSION: '0.26.0'
109+
EMSCRIPTEN_VERSION: '3.1.58'
110+
PYTHON_VERSION: '3.12.1'
132111

133112
dependsOn: [git_commit, linting]
134113
condition: |

build_tools/azure/debian_atlas_32bit_lock.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
#
77
attrs==23.2.0
88
# via pytest
9-
coverage==7.5.1
9+
coverage==7.5.3
1010
# via pytest-cov
1111
cython==3.0.10
1212
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
1313
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
17+
meson==1.4.1
1818
# via meson-python
1919
meson-python==0.16.0
2020
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt

build_tools/azure/install.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ 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-
elif [[ "$DISTRIB" == "conda-pypy3" ]]; then
43-
# need compilers
44-
apt-get -yq update
45-
apt-get -yq install build-essential
4641
fi
47-
4842
}
4943

5044
check_packages_dev_version() {
@@ -59,12 +53,7 @@ check_packages_dev_version() {
5953

6054
python_environment_install_and_activate() {
6155
if [[ "$DISTRIB" == "conda"* ]]; then
62-
# Install/update conda with the libmamba solver because the legacy
63-
# solver can be slow at installing a specific version of conda-lock.
64-
conda install -n base conda conda-libmamba-solver -y
65-
conda config --set solver libmamba
66-
conda install -c conda-forge "$(get_dep conda-lock min)" -y
67-
conda-lock install --name $VIRTUALENV $LOCK_FILE
56+
create_conda_environment_from_lock_file $VIRTUALENV $LOCK_FILE
6857
source activate $VIRTUALENV
6958

7059
elif [[ "$DISTRIB" == "ubuntu" || "$DISTRIB" == "debian-32" ]]; then
@@ -140,6 +129,12 @@ scikit_learn_install() {
140129
# toolchain
141130
ADDITIONAL_PIP_OPTIONS='-Csetup-args=--vsenv'
142131
fi
132+
# TODO Always add --check-build-dependencies when all CI builds have
133+
# pip >= 22.1.1. At the time of writing, two CI builds (debian32_atlas and
134+
# ubuntu_atlas) have an older pip
135+
if pip install --help | grep check-build-dependencies; then
136+
ADDITIONAL_PIP_OPTIONS="$ADDITIONAL_PIP_OPTIONS --check-build-dependencies"
137+
fi
143138
# Use the pre-installed build dependencies and build directly in the
144139
# current environment.
145140
pip install --verbose --no-build-isolation --editable . $ADDITIONAL_PIP_OPTIONS

0 commit comments

Comments
 (0)