Skip to content

Commit

Permalink
Python 3.13 support (uxlfoundation#2176)
Browse files Browse the repository at this point in the history
* Update class doc in n_jobs support for py313

* Add py313 jobs in CondaRecipe CI

* Add Python 3.13 to CondaEnv CI matrix

* Revert "Add py313 jobs in CondaRecipe CI"

This reverts commit 38c175e.
  • Loading branch information
Alexsandruss authored Nov 21, 2024
1 parent 08e375a commit f3d754d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ jobs:
Python3.12_Sklearn1.4:
PYTHON_VERSION: '3.12'
SKLEARN_VERSION: '1.4'
Python3.12_Sklearn1.5:
PYTHON_VERSION: '3.12'
Python3.13_Sklearn1.5:
PYTHON_VERSION: '3.13'
SKLEARN_VERSION: '1.5'
pool:
vmImage: 'ubuntu-22.04'
Expand All @@ -158,8 +158,8 @@ jobs:
Python3.12_Sklearn1.4:
PYTHON_VERSION: '3.12'
SKLEARN_VERSION: '1.4'
Python3.12_Sklearn1.5:
PYTHON_VERSION: '3.12'
Python3.13_Sklearn1.5:
PYTHON_VERSION: '3.13'
SKLEARN_VERSION: '1.5'
pool:
vmImage: 'windows-2022'
Expand Down
19 changes: 11 additions & 8 deletions daal4py/sklearn/_n_jobs_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ==============================================================================

import logging
import sys
import threading
from functools import wraps
from inspect import Parameter, signature
Expand Down Expand Up @@ -212,14 +213,16 @@ def init_with_n_jobs(self, *args, n_jobs=None, **kwargs):
and isinstance(original_class.__doc__, str)
and "n_jobs : int" not in original_class.__doc__
):
parameters_doc_tail = "\n Attributes"
n_jobs_doc = """
n_jobs : int, default=None
The number of jobs to use in parallel for the computation.
``None`` means using all physical cores
unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all logical cores.
See :term:`Glossary <n_jobs>` for more details.
# Python 3.13 removed extra tab in class doc string
tab = " " if sys.version_info.minor < 13 else ""
parameters_doc_tail = f"\n{tab}Attributes"
n_jobs_doc = f"""
{tab}n_jobs : int, default=None
{tab} The number of jobs to use in parallel for the computation.
{tab} ``None`` means using all physical cores
{tab} unless in a :obj:`joblib.parallel_backend` context.
{tab} ``-1`` means using all logical cores.
{tab} See :term:`Glossary <n_jobs>` for more details.
"""
original_class.__doc__ = original_class.__doc__.replace(
parameters_doc_tail, n_jobs_doc + parameters_doc_tail
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ pandas==2.2.3 ; python_version >= '3.11'
xgboost==2.1.2
lightgbm==4.5.0
catboost==1.2.7 ; python_version < '3.11' # TODO: Remove 3.11 condition when catboost supports numpy 2.0
shap==0.46.0
shap==0.46.0 ; python_version < '3.13'
array-api-compat==1.9.1
array-api-strict==2.2

0 comments on commit f3d754d

Please sign in to comment.