Bump Python version requirement to 3.12.#12195
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR raises XGBoost’s minimum supported Python version to 3.12 and updates related packaging, CI, docs, and a few compatibility helpers to assume newer stdlib features.
Changes:
- Bump
requires-pythonto>=3.12and update Python version pins across CI / conda envs / RTD. - Remove legacy Python-3.10 compatibility branches (e.g.,
hashlib.file_digestgating; customcd()workaround in PEP517 backend). - Minor typing / behavior tweaks in Python utilities and docs configuration.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/python/test_model_compatibility.py |
Assume hashlib.file_digest exists (Python 3.12+). |
src/collective/tracker.cc |
Move tracker ready_ flip closer to socket watch setup. |
python-package/xgboost/compat.py |
Add explicit cast for numpy concatenate return typing. |
python-package/xgboost/_typing.py |
Expand NumpyDType to include np.dtype[Any]. |
python-package/xgboost/_data_utils.py |
Replace hard assert on embedded NUL with a warning. |
python-package/pyproject.toml.stub.in |
Set requires-python = ">=3.12" and drop 3.10/3.11 classifiers. |
python-package/pyproject.toml.in |
Set requires-python = ">=3.12" and drop 3.10/3.11 classifiers. |
python-package/pyproject.toml |
Set requires-python = ">=3.12" and drop 3.10/3.11 classifiers. |
python-package/packager/pep517.py |
Switch to contextlib.chdir (stdlib) and remove custom cd(). |
ops/pipeline/get-image-tag.sh |
Update CI image tag selection (currently hardcoded to PR tag). |
ops/pipeline/build-python-wheels-macos.sh |
Build wheels using CPython 3.12. |
ops/pipeline/build-python-wheels-cpu.sh |
Use CPython 3.12 path in manylinux image. |
ops/conda_env/win64_test.yml |
Pin Python 3.12 for Windows conda tests. |
ops/conda_env/sdist_test.yml |
Pin Python 3.12 for sdist tests. |
ops/conda_env/python_lint.yml |
Pin Python 3.12 for lint env. |
ops/conda_env/minimal.yml |
Pin Python 3.12 for minimal env. |
ops/conda_env/macos_cpu_test.yml |
Pin Python 3.12 for macOS CPU tests. |
ops/conda_env/linux_sycl_test.yml |
Pin Python 3.12 for SYCL tests. |
ops/conda_env/linux_cpu_test.yml |
Pin Python 3.12 for Linux CPU tests. |
ops/conda_env/aarch64_test.yml |
Pin Python 3.12 for aarch64 tests. |
doc/xgboost_doc.yml |
Pin Python 3.12 for docs conda env. |
doc/contrib/docs.rst |
Update docs build instructions to Python 3.12. |
doc/conf.py |
Update intersphinx Python docs to 3.12; small refactors/docstrings. |
demo/guide-python/external_memory.py |
Small cleanups/typing/import adjustments; rename args for clarity. |
.readthedocs.yaml |
Set RTD build toolchain Python to 3.12. |
.github/workflows/r_tests.yml |
Use Python 3.12 for R workflow’s Python step. |
.github/workflows/python_wheels_winarm64.yml |
Use Python 3.12 for wheel build workflow. |
.github/workflows/python_wheels_variants.yml |
Use CPython 3.12 path in manylinux container. |
.github/workflows/python_tests.yml |
Run Python tests on Python 3.12. |
.github/workflows/pre-commit.yml |
Run pre-commit with Python 3.12. |
.github/workflows/main.yml |
Use CPython 3.12 path in container jobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
Friendly ping @RAMitchell |
hcho3
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI: dmlc/xgboost-devops#88
Close #12194
After this PR, I will try to bring rapids to 26.04, and see if we can resolve the CI failure with the latest CCCL.
Changes:
Breaking:
todos