Skip to content
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

WIP: [python-package] support Python 3.13 #6668

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .ci/conda-envs/ci-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ joblib>=1.3.2
matplotlib-base>=3.7.3
numpy>=1.24.4
pandas>2.0
pyarrow-core>=6.0
pyarrow-core>=16.0
python-graphviz>=0.20.3
scikit-learn>=1.3.2
scipy>=1.1
Expand Down
4 changes: 2 additions & 2 deletions .ci/test-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if ($env:TASK -eq "swig") {
conda init powershell
conda activate
conda config --set always_yes yes --set changeps1 no
conda update -q -y conda "python=$env:PYTHON_VERSION[build=*cpython]"
conda update -q -y conda "python=$env:PYTHON_VERSION=*_cp*"

if ($env:PYTHON_VERSION -eq "3.7") {
$env:CONDA_REQUIREMENT_FILE = "$env:BUILD_SOURCESDIRECTORY/.ci/conda-envs/ci-core-py37.txt"
Expand All @@ -80,7 +80,7 @@ $condaParams = @(
"-y",
"-n", "$env:CONDA_ENV",
"--file", "$env:CONDA_REQUIREMENT_FILE",
"python=$env:PYTHON_VERSION[build=*cpython]"
"python=$env:PYTHON_VERSION[build=*_cp*]"
)
conda create @condaParams ; Assert-Output $?

Expand Down
8 changes: 6 additions & 2 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -e -E -o -u pipefail

# TODO(jameslamb): revert before merging
set -x

# defaults
CONDA_ENV="test-env"
IN_UBUNTU_BASE_CONTAINER=${IN_UBUNTU_BASE_CONTAINER:-"false"}
Expand Down Expand Up @@ -64,8 +67,9 @@ if [[ "$TASK" == "cpp-tests" ]]; then
exit 0
fi

# including python=version[build=*cpython] to ensure that conda doesn't fall back to pypy
CONDA_PYTHON_REQUIREMENT="python=${PYTHON_VERSION}[build=*cpython]"
# including python=version=*_cp* to ensure that conda prefers CPython and doesn't fall back to
# other implementations like pypy
CONDA_PYTHON_REQUIREMENT="python=${PYTHON_VERSION}=*_cp*"

if [[ $TASK == "if-else" ]]; then
conda create -q -y -n "${CONDA_ENV}" "${CONDA_PYTHON_REQUIREMENT}" numpy
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ jobs:
include:
- method: wheel
compiler: gcc
python_version: "3.10"
python_version: "3.11"
cuda_version: "12.6.1"
linux_version: "ubuntu22.04"
task: cuda
- method: source
compiler: gcc
python_version: "3.12"
python_version: "3.13"
cuda_version: "12.2.2"
linux_version: "ubuntu22.04"
task: cuda
- method: pip
compiler: clang
python_version: "3.11"
python_version: "3.12"
cuda_version: "11.8.0"
linux_version: "ubuntu20.04"
task: cuda
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
env:
COMPILER: gcc
OS_NAME: 'linux'
PYTHON_VERSION: '3.12'
PYTHON_VERSION: '3.13'
TASK: 'check-links'

jobs:
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@ jobs:
include:
- os: macos-13
task: regular
python_version: '3.10'
python_version: '3.11'
- os: macos-13
task: sdist
python_version: '3.11'
python_version: '3.12'
- os: macos-13
task: bdist
python_version: '3.8'
python_version: '3.9'
- os: macos-13
task: if-else
python_version: '3.9'
python_version: '3.10'
- os: macos-14
task: bdist
method: wheel
python_version: '3.10'
python_version: '3.11'
- os: macos-13
task: mpi
method: source
python_version: '3.11'
python_version: '3.12'
- os: macos-13
task: mpi
method: pip
python_version: '3.12'
python_version: '3.13'
- os: macos-13
task: mpi
method: wheel
python_version: '3.9'
python_version: '3.10'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -113,12 +113,19 @@ jobs:
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.12 \
python:3.13 \
/bin/bash ./.ci/test-python-latest.sh
test-oldest-versions:
test-old-versions:
name: Python - oldest supported versions (ubuntu-latest)
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# end-of-life Python versions
python_version:
- 3.7
- 3.8
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -140,12 +147,12 @@ jobs:
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.7 \
python:${{ matrix.python_version }} \
/bin/bash ./.ci/test-python-oldest.sh
all-python-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, test-latest-versions, test-oldest-versions]
needs: [test, test-latest-versions, test-old-versions]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
Expand Down
Loading
Loading