Skip to content

Bump Python version requirement to 3.12.#12195

Merged
trivialfis merged 15 commits into
dmlc:masterfrom
trivialfis:bump-py312
May 5, 2026
Merged

Bump Python version requirement to 3.12.#12195
trivialfis merged 15 commits into
dmlc:masterfrom
trivialfis:bump-py312

Conversation

@trivialfis
Copy link
Copy Markdown
Member

@trivialfis trivialfis commented Apr 30, 2026

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:

  • Update requirement to Python 3.12.
  • Raise a warning about the changed behavior from arrow.
  • Typing updates.
  • Fix a race in tracker initialization.

Breaking:

  • Drop pandas sparse array support for column split.

todos

  • Revert image tag.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-python to >=3.12 and update Python version pins across CI / conda envs / RTD.
  • Remove legacy Python-3.10 compatibility branches (e.g., hashlib.file_digest gating; custom cd() 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.

Comment thread ops/pipeline/get-image-tag.sh Outdated
Comment thread python-package/xgboost/_data_utils.py Outdated
@trivialfis trivialfis requested a review from RAMitchell April 30, 2026 18:11
@trivialfis trivialfis changed the title [wip] Bump Python version requirement to 3.12. Bump Python version requirement to 3.12. Apr 30, 2026
@trivialfis
Copy link
Copy Markdown
Member Author

Friendly ping @RAMitchell

@trivialfis trivialfis marked this pull request as ready for review May 5, 2026 02:18
@trivialfis trivialfis merged commit c78f8f6 into dmlc:master May 5, 2026
82 of 83 checks passed
@trivialfis trivialfis deleted the bump-py312 branch May 5, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump python requirement to 3.12.

3 participants