From f3d754d0b20777f792b30f8ed586f1ede257efed Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Thu, 21 Nov 2024 17:16:56 +0300 Subject: [PATCH] Python 3.13 support (#2176) * 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 38c175e052143417fff07f9bc714a26e9c872eb5. --- .ci/pipeline/ci.yml | 8 ++++---- daal4py/sklearn/_n_jobs_support.py | 19 +++++++++++-------- requirements-test.txt | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.ci/pipeline/ci.yml b/.ci/pipeline/ci.yml index 826389b0a7..09499563d4 100644 --- a/.ci/pipeline/ci.yml +++ b/.ci/pipeline/ci.yml @@ -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' @@ -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' diff --git a/daal4py/sklearn/_n_jobs_support.py b/daal4py/sklearn/_n_jobs_support.py index c31101d895..d67a3a56bf 100644 --- a/daal4py/sklearn/_n_jobs_support.py +++ b/daal4py/sklearn/_n_jobs_support.py @@ -15,6 +15,7 @@ # ============================================================================== import logging +import sys import threading from functools import wraps from inspect import Parameter, signature @@ -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 ` 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 ` for more details. """ original_class.__doc__ = original_class.__doc__.replace( parameters_doc_tail, n_jobs_doc + parameters_doc_tail diff --git a/requirements-test.txt b/requirements-test.txt index 797fceb428..52a95f12e8 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -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