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

[python-package] support Python 3.13 #6668

Merged
merged 30 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
81a2b98
[python-package] support Python 3.13
jameslamb Oct 9, 2024
9069205
Merge branch 'master' into python-3.13
jameslamb Oct 13, 2024
fda237c
Merge branch 'master' into python-3.13
jameslamb Oct 16, 2024
f3422f1
Merge branch 'master' into python-3.13
jameslamb Oct 17, 2024
d9bab62
update everything in the base conda environment, not just conda
jameslamb Oct 17, 2024
9cc314e
python packages now use 'cp' instead of 'cpython'
jameslamb Oct 18, 2024
e7256e8
merge master
jameslamb Oct 18, 2024
76f2b8d
fix python_package
jameslamb Oct 18, 2024
3889a78
Merge branch 'master' into python-3.13
jameslamb Nov 25, 2024
9f6cc8b
Merge branch 'master' into python-3.13
jameslamb Dec 15, 2024
82292d3
Merge branch 'master' into python-3.13
jameslamb Dec 28, 2024
a797f91
get more logs
jameslamb Dec 29, 2024
612e99c
Merge branch 'master' into python-3.13
jameslamb Jan 3, 2025
c1a5a72
try to force a better solver error
jameslamb Jan 3, 2025
9f3d1e5
Merge branch 'master' into python-3.13
jameslamb Jan 6, 2025
6ef9ab6
Merge branch 'master' into python-3.13
jameslamb Jan 11, 2025
89000b3
merge master
jameslamb Jan 20, 2025
47e8dbf
merge latest
jameslamb Jan 20, 2025
f471fe0
use build= explicitly
jameslamb Jan 20, 2025
0ed60e4
restore all CI, revert debugging changes
jameslamb Jan 20, 2025
e301d3f
Update .ci/test.sh
jameslamb Jan 21, 2025
bbec860
empty commit to re-trigger CI
jameslamb Jan 23, 2025
811ee8d
Merge branch 'python-3.13' of github.com:microsoft/LightGBM into pyth…
jameslamb Jan 23, 2025
0db5b2d
update docs conda env
jameslamb Jan 24, 2025
248c076
pin to specific OS and mambaforge
jameslamb Jan 26, 2025
3044b7e
Update .github/workflows/python_package.yml
jameslamb Jan 26, 2025
422be6a
update default Python version in .vsts-ci.yml
jameslamb Jan 26, 2025
a78ebbd
remove upper-version pins
jameslamb Jan 26, 2025
30d566f
Merge branch 'master' into python-3.13
jameslamb Jan 27, 2025
6af26b1
update RTD image
jameslamb Jan 27, 2025
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: 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to bump version in Appveyor?

- '3.8'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that because we use Appveyor to test such an old version of VS Code:

image: Visual Studio 2015

That it should stay frozen on an old Python version too, until supporting that older Python version on Appveyor breaks. Given that, do you think we should make increasing this version to 3.9 part of this update?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, makes sense! I don't mind leaving 3.8.

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[build=*_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
5 changes: 3 additions & 2 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,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=[build=*_cp*] to ensure that conda prefers CPython and doesn't fall back to
# other implementations like pypy
CONDA_PYTHON_REQUIREMENT="python=${PYTHON_VERSION}[build=*_cp*]"
jameslamb marked this conversation as resolved.
Show resolved Hide resolved

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
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
COMPILER: 'gcc'
MAKEFLAGS: '-j4'
OS_NAME: 'linux'
PYTHON_VERSION: '3.12'
PYTHON_VERSION: '3.13'

jobs:
test:
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2
build:
os: "ubuntu-20.04"
os: "ubuntu-24.04"
tools:
python: "miniconda3-4.7"
python: "mambaforge-23.11"
conda:
environment: docs/env.yml
formats:
Expand Down
30 changes: 15 additions & 15 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pr:
variables:
AZURE: 'true'
CMAKE_BUILD_PARALLEL_LEVEL: 4
PYTHON_VERSION: '3.12'
PYTHON_VERSION: '3.13'
runCodesignValidationInjection: false
skipComponentGovernanceDetection: true
Codeql.Enabled: false
Expand Down Expand Up @@ -96,19 +96,19 @@ jobs:
matrix:
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
regular:
TASK: regular
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
sdist:
TASK: sdist
PYTHON_VERSION: '3.8'
PYTHON_VERSION: '3.9'
bdist:
TASK: bdist
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
inference:
TASK: if-else
mpi_source:
TASK: mpi
METHOD: source
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
gpu_source:
TASK: gpu
METHOD: source
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
TASK: sdist
bdist:
TASK: bdist
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
inference:
TASK: if-else
mpi_source:
Expand All @@ -171,23 +171,23 @@ jobs:
mpi_pip:
TASK: mpi
METHOD: pip
PYTHON_VERSION: '3.11'
PYTHON_VERSION: '3.12'
mpi_wheel:
TASK: mpi
METHOD: wheel
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
gpu_source:
TASK: gpu
METHOD: source
PYTHON_VERSION: '3.11'
PYTHON_VERSION: '3.12'
gpu_pip:
TASK: gpu
METHOD: pip
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
gpu_wheel:
TASK: gpu
METHOD: wheel
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
cpp_tests:
TASK: cpp-tests
METHOD: with-sanitizers
Expand Down Expand Up @@ -298,10 +298,10 @@ jobs:
matrix:
regular:
TASK: regular
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
sdist:
TASK: sdist
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
bdist:
TASK: bdist
swig:
Expand Down Expand Up @@ -347,10 +347,10 @@ jobs:
matrix:
regular:
TASK: regular
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
sdist:
TASK: sdist
PYTHON_VERSION: '3.9'
PYTHON_VERSION: '3.10'
bdist:
TASK: bdist
swig:
Expand Down
22 changes: 11 additions & 11 deletions docs/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ channels:
- conda-forge
dependencies:
- breathe>=4.35
- python=3.10
- r-base=4.3.2
- r-data.table=1.14.10
- r-jsonlite=1.8.8
- r-knitr=1.45
- r-markdown=1.12
- r-matrix=1.6_4
- r-pkgdown=2.0.7
- python=3.12
- r-base>=4.3.3
- r-data.table=1.16.4
- r-jsonlite=1.8.9
- r-knitr=1.49
- r-markdown=1.13
- r-matrix=1.6_5
- r-pkgdown=2.1.1
- r-roxygen2=7.3.2
- scikit-learn>=1.4.0
- sphinx>=6.0
- sphinx_rtd_theme>=2.0
- scikit-learn>=1.6.1
- sphinx>=8.1.3
- sphinx_rtd_theme>=3.0.1
1 change: 1 addition & 0 deletions python-package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Artificial Intelligence"
]
dependencies = [
Expand Down
Loading