Skip to content

Commit 9f1af05

Browse files
[python-package] support Python 3.13 (#6668)
* [python-package] support Python 3.13 * update everything in the base conda environment, not just conda * python packages now use 'cp' instead of 'cpython' * fix python_package * get more logs * try to force a better solver error * merge latest * use build= explicitly * restore all CI, revert debugging changes * Update .ci/test.sh * empty commit to re-trigger CI * update docs conda env * pin to specific OS and mambaforge * Update .github/workflows/python_package.yml Co-authored-by: Nikita Titov <nekit94-08@mail.ru> * update default Python version in .vsts-ci.yml * remove upper-version pins * update RTD image --------- Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
1 parent 3aac25a commit 9f1af05

11 files changed

+59
-50
lines changed

.ci/test-windows.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if ($env:TASK -eq "swig") {
6666
conda init powershell
6767
conda activate
6868
conda config --set always_yes yes --set changeps1 no
69-
conda update -q -y conda "python=$env:PYTHON_VERSION[build=*cpython]"
69+
conda update -q -y conda "python=$env:PYTHON_VERSION[build=*_cp*]"
7070

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

.ci/test.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ if [[ "$TASK" == "cpp-tests" ]]; then
6464
exit 0
6565
fi
6666

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

7071
if [[ $TASK == "if-else" ]]; then
7172
conda create -q -y -n "${CONDA_ENV}" "${CONDA_PYTHON_REQUIREMENT}" numpy

.github/workflows/cuda.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ jobs:
8181
include:
8282
- method: wheel
8383
compiler: gcc
84-
python_version: "3.10"
84+
python_version: "3.11"
8585
cuda_version: "12.6.1"
8686
linux_version: "ubuntu22.04"
8787
task: cuda
8888
- method: source
8989
compiler: gcc
90-
python_version: "3.12"
90+
python_version: "3.13"
9191
cuda_version: "12.2.2"
9292
linux_version: "ubuntu22.04"
9393
task: cuda
9494
- method: pip
9595
compiler: clang
96-
python_version: "3.11"
96+
python_version: "3.12"
9797
cuda_version: "11.8.0"
9898
linux_version: "ubuntu20.04"
9999
task: cuda

.github/workflows/linkchecker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
COMPILER: gcc
1212
OS_NAME: 'linux'
13-
PYTHON_VERSION: '3.12'
13+
PYTHON_VERSION: '3.13'
1414
TASK: 'check-links'
1515

1616
jobs:

.github/workflows/python_package.yml

+19-12
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,32 @@ jobs:
2828
include:
2929
- os: macos-13
3030
task: regular
31-
python_version: '3.10'
31+
python_version: '3.11'
3232
- os: macos-13
3333
task: sdist
34-
python_version: '3.11'
34+
python_version: '3.12'
3535
- os: macos-13
3636
task: bdist
37-
python_version: '3.8'
37+
python_version: '3.9'
3838
- os: macos-13
3939
task: if-else
40-
python_version: '3.9'
40+
python_version: '3.10'
4141
- os: macos-14
4242
task: bdist
4343
method: wheel
44-
python_version: '3.10'
44+
python_version: '3.11'
4545
- os: macos-13
4646
task: mpi
4747
method: source
48-
python_version: '3.11'
48+
python_version: '3.12'
4949
- os: macos-13
5050
task: mpi
5151
method: pip
52-
python_version: '3.12'
52+
python_version: '3.13'
5353
- os: macos-13
5454
task: mpi
5555
method: wheel
56-
python_version: '3.9'
56+
python_version: '3.10'
5757
steps:
5858
- name: Checkout repository
5959
uses: actions/checkout@v4
@@ -113,12 +113,19 @@ jobs:
113113
--rm \
114114
-v $(pwd):/opt/lgb-build \
115115
-w /opt/lgb-build \
116-
python:3.12 \
116+
python:3.13 \
117117
/bin/bash ./.ci/test-python-latest.sh
118-
test-oldest-versions:
118+
test-old-versions:
119119
name: Python - oldest supported versions (ubuntu-latest)
120120
runs-on: ubuntu-latest
121121
timeout-minutes: 60
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
# end-of-life Python versions
126+
python_version:
127+
- '3.7'
128+
- '3.8'
122129
steps:
123130
- name: Checkout repository
124131
uses: actions/checkout@v4
@@ -140,12 +147,12 @@ jobs:
140147
--rm \
141148
-v $(pwd):/opt/lgb-build \
142149
-w /opt/lgb-build \
143-
python:3.7 \
150+
python:${{ matrix.python_version }} \
144151
/bin/bash ./.ci/test-python-oldest.sh
145152
all-python-package-jobs-successful:
146153
if: always()
147154
runs-on: ubuntu-latest
148-
needs: [test, test-latest-versions, test-oldest-versions]
155+
needs: [test, test-latest-versions, test-old-versions]
149156
steps:
150157
- name: Note that all tests succeeded
151158
uses: re-actors/alls-green@v1.2.2

.github/workflows/static_analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
COMPILER: 'gcc'
2020
MAKEFLAGS: '-j4'
2121
OS_NAME: 'linux'
22-
PYTHON_VERSION: '3.12'
22+
PYTHON_VERSION: '3.13'
2323

2424
jobs:
2525
test:

.readthedocs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
build:
3-
os: "ubuntu-20.04"
3+
os: "ubuntu-24.04"
44
tools:
5-
python: "miniconda3-4.7"
5+
python: "mambaforge-23.11"
66
conda:
77
environment: docs/env.yml
88
formats:

.vsts-ci.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pr:
1010
variables:
1111
AZURE: 'true'
1212
CMAKE_BUILD_PARALLEL_LEVEL: 4
13-
PYTHON_VERSION: '3.12'
13+
PYTHON_VERSION: '3.13'
1414
runCodesignValidationInjection: false
1515
skipComponentGovernanceDetection: true
1616
Codeql.Enabled: false
@@ -96,19 +96,19 @@ jobs:
9696
matrix:
9797
regular:
9898
TASK: regular
99-
PYTHON_VERSION: '3.10'
99+
PYTHON_VERSION: '3.11'
100100
sdist:
101101
TASK: sdist
102-
PYTHON_VERSION: '3.8'
102+
PYTHON_VERSION: '3.9'
103103
bdist:
104104
TASK: bdist
105-
PYTHON_VERSION: '3.9'
105+
PYTHON_VERSION: '3.10'
106106
inference:
107107
TASK: if-else
108108
mpi_source:
109109
TASK: mpi
110110
METHOD: source
111-
PYTHON_VERSION: '3.9'
111+
PYTHON_VERSION: '3.10'
112112
gpu_source:
113113
TASK: gpu
114114
METHOD: source
@@ -162,7 +162,7 @@ jobs:
162162
TASK: sdist
163163
bdist:
164164
TASK: bdist
165-
PYTHON_VERSION: '3.10'
165+
PYTHON_VERSION: '3.11'
166166
inference:
167167
TASK: if-else
168168
mpi_source:
@@ -171,23 +171,23 @@ jobs:
171171
mpi_pip:
172172
TASK: mpi
173173
METHOD: pip
174-
PYTHON_VERSION: '3.11'
174+
PYTHON_VERSION: '3.12'
175175
mpi_wheel:
176176
TASK: mpi
177177
METHOD: wheel
178-
PYTHON_VERSION: '3.9'
178+
PYTHON_VERSION: '3.10'
179179
gpu_source:
180180
TASK: gpu
181181
METHOD: source
182-
PYTHON_VERSION: '3.11'
182+
PYTHON_VERSION: '3.12'
183183
gpu_pip:
184184
TASK: gpu
185185
METHOD: pip
186-
PYTHON_VERSION: '3.10'
186+
PYTHON_VERSION: '3.11'
187187
gpu_wheel:
188188
TASK: gpu
189189
METHOD: wheel
190-
PYTHON_VERSION: '3.9'
190+
PYTHON_VERSION: '3.10'
191191
cpp_tests:
192192
TASK: cpp-tests
193193
METHOD: with-sanitizers
@@ -298,10 +298,10 @@ jobs:
298298
matrix:
299299
regular:
300300
TASK: regular
301-
PYTHON_VERSION: '3.10'
301+
PYTHON_VERSION: '3.11'
302302
sdist:
303303
TASK: sdist
304-
PYTHON_VERSION: '3.9'
304+
PYTHON_VERSION: '3.10'
305305
bdist:
306306
TASK: bdist
307307
swig:
@@ -347,10 +347,10 @@ jobs:
347347
matrix:
348348
regular:
349349
TASK: regular
350-
PYTHON_VERSION: '3.10'
350+
PYTHON_VERSION: '3.11'
351351
sdist:
352352
TASK: sdist
353-
PYTHON_VERSION: '3.9'
353+
PYTHON_VERSION: '3.10'
354354
bdist:
355355
TASK: bdist
356356
swig:

docs/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Run the following from the root of this repository to pull the relevant image an
3535
--env READTHEDOCS=true \
3636
--workdir=/opt/LightGBM/docs \
3737
--entrypoint="" \
38-
readthedocs/build:ubuntu-20.04-2021.09.23 \
38+
readthedocs/build:ubuntu-24.04-2024.06.17 \
3939
/bin/bash build-docs.sh
4040
4141
When that code completes, open ``docs/_build/html/index.html`` in your browser.

docs/env.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ channels:
44
- conda-forge
55
dependencies:
66
- breathe>=4.35
7-
- python=3.10
8-
- r-base=4.3.2
9-
- r-data.table=1.14.10
10-
- r-jsonlite=1.8.8
11-
- r-knitr=1.45
12-
- r-markdown=1.12
13-
- r-matrix=1.6_4
14-
- r-pkgdown=2.0.7
7+
- python=3.12
8+
- r-base>=4.3.3
9+
- r-data.table=1.16.4
10+
- r-jsonlite=1.8.9
11+
- r-knitr=1.49
12+
- r-markdown=1.13
13+
- r-matrix=1.6_5
14+
- r-pkgdown=2.1.1
1515
- r-roxygen2=7.3.2
16-
- scikit-learn>=1.4.0
17-
- sphinx>=6.0
18-
- sphinx_rtd_theme>=2.0
16+
- scikit-learn>=1.6.1
17+
- sphinx>=8.1.3
18+
- sphinx_rtd_theme>=3.0.1

python-package/pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ classifiers = [
1616
"Programming Language :: Python :: 3.10",
1717
"Programming Language :: Python :: 3.11",
1818
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
1920
"Topic :: Scientific/Engineering :: Artificial Intelligence"
2021
]
2122
dependencies = [

0 commit comments

Comments
 (0)