From 5243f367a3da1687a88e253c80fa83f416bcdc7a Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Sun, 31 Mar 2024 18:22:19 +0200 Subject: [PATCH 1/2] MAINT update the python version supported --- doc/whats_new/v0.12.rst | 8 +++++++- imblearn/utils/tests/test_docstring.py | 17 +++++++++++++++++ setup.py | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/whats_new/v0.12.rst b/doc/whats_new/v0.12.rst index bc707ae8c..d6386d03f 100644 --- a/doc/whats_new/v0.12.rst +++ b/doc/whats_new/v0.12.rst @@ -19,7 +19,13 @@ Compatibility ............. - Do not use `distutils` in tests due to deprecation. - :pr:`1065` by :user:`Michael R. Crusoe ` + :pr:`1065` by :user:`Michael R. Crusoe `. + +- Fix the scikit-learn import in tests to be compatible with version 1.4.1.post1. + :pr:`xxx` by :user:`Guillaume Lemaitre `. + +- Fix test to be compatible with Python 3.13. + :pr:`xxx` by :user:`Guillaume Lemaitre `. Version 0.12.0 ============== diff --git a/imblearn/utils/tests/test_docstring.py b/imblearn/utils/tests/test_docstring.py index 0109fdb31..133701f8d 100644 --- a/imblearn/utils/tests/test_docstring.py +++ b/imblearn/utils/tests/test_docstring.py @@ -3,11 +3,23 @@ # Authors: Guillaume Lemaitre # License: MIT +import sys +import textwrap + import pytest from imblearn.utils import Substitution from imblearn.utils._docstring import _n_jobs_docstring, _random_state_docstring + +def _dedent_docstring(docstring): + """Compatibility with Python 3.13+. + + xref: https://github.com/python/cpython/issues/81283 + """ + return "\n".join([textwrap.dedent(line) for line in docstring.split("\n")]) + + func_docstring = """A function. Parameters @@ -55,6 +67,11 @@ def __init__(self, param_1, param_2): self.param_2 = param_2 +if sys.version_info.minor == "13": + func_docstring = _dedent_docstring(func_docstring) + cls_docstring = _dedent_docstring(cls_docstring) + + @pytest.mark.parametrize( "obj, obj_docstring", [(func, func_docstring), (cls, cls_docstring)] ) diff --git a/setup.py b/setup.py index f7856666a..5e26c3480 100755 --- a/setup.py +++ b/setup.py @@ -49,10 +49,10 @@ "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] PYTHON_REQUIRES = ">=3.8" INSTALL_REQUIRES = (min_deps.tag_to_packages["install"],) From f3fbb1e4aa2a59e548936b15d720d14e98d354e7 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Sun, 31 Mar 2024 18:23:40 +0200 Subject: [PATCH 2/2] update changelog --- doc/whats_new/v0.12.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/whats_new/v0.12.rst b/doc/whats_new/v0.12.rst index d6386d03f..741b9173e 100644 --- a/doc/whats_new/v0.12.rst +++ b/doc/whats_new/v0.12.rst @@ -22,10 +22,10 @@ Compatibility :pr:`1065` by :user:`Michael R. Crusoe `. - Fix the scikit-learn import in tests to be compatible with version 1.4.1.post1. - :pr:`xxx` by :user:`Guillaume Lemaitre `. + :pr:`1073` by :user:`Guillaume Lemaitre `. - Fix test to be compatible with Python 3.13. - :pr:`xxx` by :user:`Guillaume Lemaitre `. + :pr:`1073` by :user:`Guillaume Lemaitre `. Version 0.12.0 ==============