Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BLD: Build scikit-learn nightlies using NumPy nightlies #27735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions build_tools/cirrus/arm_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ wheels_upload_task:
upload_script: |
conda install curl unzip -y

if [[ "$CIRRUS_CRON" == "nightly" ]]; then
export GITHUB_EVENT_NAME="schedule"
fi

# Download and show wheels
curl https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/wheels.zip --output wheels.zip
unzip wheels.zip
Expand Down
3 changes: 2 additions & 1 deletion build_tools/github/upload_anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -e
set -x

if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then
# Note: build_wheels.sh has the same branch (only for NumPy 2.0 transition)
if [ "$GITHUB_EVENT_NAME" == "schedule" || "$CIRRUS_CRON" == "nightly" ]; then
ANACONDA_ORG="scientific-python-nightly-wheels"
ANACONDA_TOKEN="$SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN"
else
Expand Down
10 changes: 10 additions & 0 deletions build_tools/wheels/build_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ if [[ $(uname) == "Darwin" ]]; then
fi
fi


if [[ "$GITHUB_EVENT_NAME" == "schedule" || "$CIRRUS_CRON" == "nightly" ]]; then
# Nightly build: See also `../github/upload_anaconda.sh` (same branching).
# To help with NumPy 2.0 transition, ensure that we use the NumPy 2.0
# nightlies. This lives on the edge and opts-in to all pre-releases.
# That could be an issue, in which case no-build-isolation and a targeted
# NumPy install may be necessary, instead.
export CIBW_BUILD_FRONTEND='pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"'
fi

# The version of the built dependencies are specified
# in the pyproject.toml file, while the tests are run
# against the most recent version of the dependencies
Expand Down
15 changes: 5 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ requires = [
"wheel",
"Cython>=0.29.33",

# use oldest-supported-numpy which provides the oldest numpy version with
# wheels on PyPI
#
# see: https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg
"oldest-supported-numpy; python_version!='3.10' or platform_system!='Windows' or platform_python_implementation=='PyPy'",
# For CPython 3.10 under Windows, SciPy requires NumPy 1.22.3 while the
# oldest supported NumPy is defined as 1.21.6. We therefore need to force
# it for this specific configuration. For details, see
# https://github.com/scipy/scipy/blob/c58b608c83d30800aceee6a4dab5c3464cb1de7d/pyproject.toml#L38-L41
"numpy==1.22.3; python_version=='3.10' and platform_system=='Windows' and platform_python_implementation != 'PyPy'",
# Starting with NumPy 1.25, NumPy is (by default) as far back compatible
# as oldest-support-numpy was (customizable with a NPY_TARGET_VERSION
# define). For older Python versions continue using oldest-support-numpy.
"numpy>=1.25; python_version>='3.9'",
"oldest-supported-numpy; python_version<'3.9'",

"scipy>=1.5.0",
]
Expand Down
5 changes: 4 additions & 1 deletion sklearn/tests/test_min_dependencies_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ def test_min_dependencies_pyproject_toml():
pyproject_build_min_versions = {}
for requirement in build_requirements:
if ">=" in requirement:
# Don't check NumPy: this requirement is only build time.
if "numpy>=1.25" in requirement:
continue
package, version = requirement.split(">=")
package = package.lower()
pyproject_build_min_versions[package] = version

# Only scipy and cython are listed in pyproject.toml
# NumPy is more complex using oldest-supported-numpy.
# NumPy is more complex using oldest-supported-numpy or >=1.25.
assert set(["scipy", "cython"]) == set(pyproject_build_min_versions)

for package, version in pyproject_build_min_versions.items():
Expand Down