8000 Merging main · scikit-learn/scikit-learn@fcebee9 · GitHub
[go: up one dir, main page]

Skip to content

Commit fcebee9

Browse files
committed
Merging main
Signed-off-by: Adam Li <adam2392@gmail.com>
2 parents 575ee89 + f977661 commit fcebee9

File tree

499 files changed

+4743
-3169
lines changed

Some content is hidden

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

499 files changed

+4743
-3169
lines changed

.github/workflows/cuda-ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ jobs:
4242
run: |
4343
source "${HOME}/conda/etc/profile.d/conda.sh"
4444
conda activate sklearn
45-
pytest -k 'array_api'
45+
python -c "import sklearn; sklearn.show_versions()"
46+
SCIPY_ARRAY_API=1 pytest -k 'array_api'
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Workflow to update lock files in a PR, triggered by specific PR comments
2+
name: Update lock files in PR
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update-lock-files:
12+
if: >-
13+
github.event.issue.pull_request
14+
&& startsWith(github.event.comment.body, '@scikit-learn-bot update lock-files')
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# There is no direct way to get the HEAD information directly from issue_comment
19+
# event, so we use the GitHub CLI to get the PR head ref and repository
20+
- name: Get pull request HEAD information
21+
id: pr-head-info
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
pr_info=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName,headRepository,headRepositoryOwner)
26+
pr_head_ref=$(echo "$pr_info" | jq -r '.headRefName')
27+
pr_head_repository=$(echo "$pr_info" | jq -r '.headRepositoryOwner.login + "/" + .headRepository.name')
28+
echo "pr_head_ref=$pr_head_ref" >> $GITHUB_OUTPUT
29+
echo "pr_head_repository=$pr_head_repository" >> $GITHUB_OUTPUT
30+
31+
- name: Check out the PR branch
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ steps.pr-head-info.outputs.pr_head_ref }}
35+
repository: ${{ steps.pr-head-info.outputs.pr_head_repository }}
36+
37+
# We overwrite all the scripts we are going to use in this workflow with their
38+
# versions on main; since this workflow has the write permissions this is to avoid
39+
# malicious changes to these scripts in PRs to be executed
40+
- name: Download scripts from main
41+
run: |
42+
curl https://raw.githubusercontent.com/${{ github.repository }}/comment-update-lock/build_tools/shared.sh --retry 5 -o ./build_tools/shared.sh
43+
curl https://raw.githubusercontent.com/${{ github.repository }}/comment-update-lock/build_tools/update_environments_and_lock_files.py --retry 5 -o ./build_tools/update_environments_and_lock_files.py
44+
curl https://raw.githubusercontent.com/${{ github.repository }}/comment-update-lock/build_tools/on_pr_comment_update_environments_and_lock_files.py --retry 5 -o ./build_tools/on_pr_comment_update_environments_and_lock_files.py
45+
46+
- name: Update lock files
47+
env:
48+
COMMENT: ${{ github.event.comment.body }}
49+
# We download the lock files update scripts from main, since this workflow is
50+
# run from main itself
51+
run: |
52+
source build_tools/shared.sh
53+
source $CONDA/bin/activate
54+
conda install -n base conda conda-libmamba-solver -y
55+
conda config --set solver libmamba
56+
conda install -c conda-forge "$(get_dep conda-lock min)" -y
57+
58+
python build_tools/on_pr_comment_update_environments_and_lock_files.py

.github/workflows/wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ jobs:
174174
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
175175
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir}
176176
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }}
177-
CIBW_TEST_REQUIRES: pytest
178177
CIBW_BEFORE_TEST: bash {project}/build_tools/wheels/cibw_before_test.sh
178+
CIBW_TEST_REQUIRES: pytest pandas
179179
CIBW_TEST_COMMAND: bash {project}/build_tools/wheels/test_wheels.sh
180180
CIBW_TEST_COMMAND_WINDOWS: bash {project}/build_tools/github/test_windows_wheels.sh ${{ matrix.python }}
181181
CIBW_BUILD_VERBOSITY: 1

.gitignore

+1-26
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ doc/css/*
2121
!doc/css/.gitkeep
2222
doc/modules/generated/
2323
doc/datasets/generated/
24+
doc/developers/maintainer.rst
2425
doc/index.rst
2526
doc/min_dependency_table.rst
2627
doc/min_dependency_substitutions.rst
@@ -87,31 +88,5 @@ _configtest.o.d
8788
# virtualenv from advanced installation guide
8889
sklearn-env/
8990

90-
# files generated from a template
91-
sklearn/_loss/_loss.pyx
92-
sklearn/utils/_seq_dataset.pyx
93-
sklearn/utils/_seq_dataset.pxd
94-
sklearn/utils/_weight_vector.pyx
95-
sklearn/utils/_weight_vector.pxd
96-
sklearn/linear_model/_sag_fast.pyx
97-
sklearn/linear_model/_sgd_fast.pyx
98-
sklearn/metrics/_dist_metrics.pyx
99-
sklearn/metrics/_dist_metrics.pxd
100-
sklearn/metrics/_pairwise_distances_reduction/_argkmin.pxd
101-
sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx
102-
sklearn/metrics/_pairwise_distances_reduction/_argkmin_classmode.pyx
103-
sklearn/metrics/_pairwise_distances_reduction/_base.pxd
104-
sklearn/metrics/_pairwise_distances_reduction/_base.pyx
105-
sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pxd
106-
sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pyx
107-
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pxd
108-
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx
109-
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pxd
110-
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx
111-
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors_classmode.pyx
112-
sklearn/neighbors/_ball_tree.pyx
113-
sklearn/neighbors/_binary_tree.pxi
114-
sklearn/neighbors/_kd_tree.pyx
115-
11691
# Default 10000 JupyterLite content
11792
jupyterlite_contents

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88
- repo: https://github.com/astral-sh/ruff-pre-commit
99
# Ruff version.
10-
rev: v0.2.1
10+
rev: v0.5.1
1111
hooks:
1212
- id: ruff
1313
args: ["--fix", "--output-format=full"]

.spin/cmds.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import shutil
2+
import sys
3+
4+
import click
5+
from spin.cmds import util
6+
7+
8+
@click.command()
9+
def clean():
10+
"""🪥 Clean build folder.
11+
12+
Very rarely needed since meson-python recompiles as needed when sklearn is
13+
imported.
14+
15+
One known use case where "spin clean" is useful: avoid compilation errors
16+
when switching from numpy<2 to numpy>=2 in the same conda environment or
17+
virtualenv.
18+
"""
19+
util.run([sys.executable, "-m", "pip", "uninstall", "scikit-learn", "-y"])
20+
default_meson_build_dir = (
21+
f"build/cp{sys.version_info.major}{sys.version_info.minor}"
22+
)
23+
click.secho(
24+
f"removing default Meson build dir: {default_meson_build_dir}",
25+
bold=True,
26+
fg="bright_blue",
27+
)
28+
29+
shutil.rmtree(default_meson_build_dir, ignore_errors=True)

CITATION.cff

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
cff-version: 1.2.0
2+
title: scikit-learn
3+
type: software
4+
authors:
5+
- name: "The scikit-learn developers"
6+
message: "If you use scikit-learn in a scientific publication, we would appreciate citations to the following paper:"
7+
preferred-citation:
8+
type: article
9+
title: "Scikit-learn: Machine Learning in Python"
10+
authors:
11+
- family-names: "Pedregosa"
12+
given-names: "Fabian"
13+
- family-names: "Varoquaux"
14+
given-names: "Gaël"
15+
- family-names: "Gramfort"
16+
given-names: "Alexandre"
17+
- family-names: "Michel"
18+
given-names: "Vincent"
19+
- family-names: "Thirion"
20+
given-names: "Bertrand"
21+
- family-names: "Grisel"
22+
given-names: "Olivier"
23+
- family-names: "Blondel"
24+
given-names: "Mathieu"
25+
- family-names: "Prettenhofer"
26+
given-names: "Peter"
27+
- family-names: "Weiss"
28+
given-names: "Ron"
29+
- family-names: "Dubourg"
30+
given-names: "Vincent"
31+
- family-names: "Vanderplas"
32+
given-names: "Jake"
33+
- family-names: "Passos"
34+
given-names: "Alexandre"
35+
- family-names: "Cournapeau"
36+
given-names: "David"
37+
- family-names: "Brucher"
38+
given-names: "Matthieu"
39+
- family-names: "Perrot"
40+
given-names: "Matthieu"
41+
- family-names: "Duchesnay"
42+
given-names: "Édouard"
43+
journal: "Journal of Machine Learning Research"
44+
volume: 12
45+
start: 2825
46+
end: 2830
47+
year: 2011
48+
url: "https://jmlr.csail.mit.edu/papers/v12/pedregosa11a.html"

azure-pipelines.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ jobs:
138138
# Here we make sure, that they are still run on a regular basis.
139139
${{ if eq(variables['Build.Reason'], 'Schedule') }}:
140140
SKLEARN_SKIP_NETWORK_TESTS: '0'
141+
SCIPY_ARRAY_API: '1'
141142

142143
# Check compilation with Ubuntu 22.04 LTS (Jammy Jellyfish) and scipy from conda-forge
143144
# By default the CI is sequential, where `Ubuntu_Jammy_Jellyfish` runs first and
@@ -197,10 +198,10 @@ jobs:
197198
not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]'))
198199
)
199200
matrix:
200-
# Linux + Python 3.9 build with OpenBLAS and without pandas
201-
pymin_conda_defaults_openblas:
201+
# Linux + Python 3.9 build with minimum supported version of dependencies
202+
pymin_conda_forge_openblas_min_dependencies:
202203
DISTRIB: 'conda'
203-
LOCK_FILE: './build_tools/azure/pymin_conda_defaults_openblas_linux-64_conda.lock'
204+
LOCK_FILE: './build_tools/azure/pymin_conda_forge_openblas_min_dependencies_linux-64_conda.lock'
204205
# Enable debug Cython directives to capture IndexError exceptions in
205206
# combination with the -Werror::pytest.PytestUnraisableExceptionWarning
206207
# flag for pytest.
@@ -221,6 +222,7 @@ jobs:
221222
# makes sure that they are single threaded in each xdist subprocess.
222223
PYTEST_XDIST_VERSION: 'none'
223224
PIP_BUILD_ISOLATION: 'true'
225+
SCIPY_ARRAY_API: '1'
224226

225227
- template: build_tools/azure/posix-docker.yml
226228
parameters:
@@ -259,6 +261,7 @@ jobs:
259261
DISTRIB: 'conda'
260262
LOCK_FILE: './build_tools/azure/pylatest_conda_forge_mkl_osx-64_conda.lock'
261263
SKLEARN_TESTS_GLOBAL_RANDOM_SEED: '5' # non-default seed
264+
SCIPY_ARRAY_API: '1'
262265
pylatest_conda_mkl_no_openmp:
263266
DISTRIB: 'conda'
264267
LOCK_FILE: './build_tools/azure/pylatest_conda_mkl_no_openmp_osx-64_conda.lock'

benchmarks/bench_kernel_pca_solvers_time_vs_n_components.py

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
of components (this takes more time).
3737
"""
3838

39-
# Authors: Sylvain MARIE, Schneider Electric
40-
4139
import time
4240

4341
import matplotlib.pyplot as plt

benchmarks/bench_plot_parallel_pairwise.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Authors: The scikit-learn developers
22
# SPDX-License-Identifier: BSD-3-Clause
3+
34
import time
45

56
import matplotlib.pyplot as plt

build_tools/azure/debian_atlas_32bit_lock.txt

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.9
2+
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
55
# pip-compile --output-file=build_tools/azure/debian_atlas_32bit_lock.txt build_tools/azure/debian_atlas_32bit_requirements.txt
66
#
7-
attrs==23.2.0
7+
attrs==24.2.0
88
# via pytest
9-
coverage==7.5.4
9+
coverage==7.6.1
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.1
17+
meson==1.5.1
1818
# via meson-python
1919
meson-python==0.16.0
2020
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
@@ -40,6 +40,4 @@ pytest-cov==2.9.0
4040
threadpoolctl==3.1.0
4141
# via -r build_tools/azure/debian_atlas_32bit_requirements.txt
4242
tomli==2.0.1
43-
# via
44-
# meson-python
45-
# pytest
43+
# via pytest

build_tools/azure/install.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ python_environment_install_and_activate() {
8585
# install them from scientific-python-nightly-wheels
8686
dev_anaconda_url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
8787
dev_packages="numpy scipy Cython"
88-
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages
88+
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages --only-binary :all:
8989
fi
9090

9191
if [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then
9292
echo "Installing development dependency wheels"
9393
dev_anaconda_url=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
9494
dev_packages="numpy scipy pandas Cython"
95-
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages
95+
pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url $dev_packages --only-binary :all:
9696

9797
check_packages_dev_version $dev_packages
9898

0 commit comments

Comments
 (0)
0