Skip to content

Commit

Permalink
MAINT update the python version supported (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
glemaitre committed Mar 31, 2024
1 parent cad2943 commit 2671568
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
8 changes: 7 additions & 1 deletion doc/whats_new/v0.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ Compatibility
.............

- Do not use `distutils` in tests due to deprecation.
:pr:`1065` by :user:`Michael R. Crusoe <mr-c>`
:pr:`1065` by :user:`Michael R. Crusoe <mr-c>`.

- Fix the scikit-learn import in tests to be compatible with version 1.4.1.post1.
:pr:`1073` by :user:`Guillaume Lemaitre <glemaitre>`.

- Fix test to be compatible with Python 3.13.
:pr:`1073` by :user:`Guillaume Lemaitre <glemaitre>`.

Version 0.12.0
==============
Expand Down
17 changes: 17 additions & 0 deletions imblearn/utils/tests/test_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# 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
Expand Down Expand Up @@ -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)]
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],)
Expand Down

0 comments on commit 2671568

Please sign in to comment.