diff --git a/pandas/util/_print_versions.py b/pandas/util/_print_versions.py index 2526fafe5851f..e3cd3a3f227a2 100644 --- a/pandas/util/_print_versions.py +++ b/pandas/util/_print_versions.py @@ -7,8 +7,11 @@ import platform import struct import sys +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from pandas._typing import JSONSerializable -from pandas._typing import JSONSerializable from pandas.compat._optional import ( VERSIONS, get_version, diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index dfe48d994cb0e..c0d1e5147bb8c 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -26,14 +26,18 @@ def test_foo(): from __future__ import annotations import locale -from typing import Callable +from typing import ( + TYPE_CHECKING, + Callable, +) import numpy as np import pytest from pandas._config import get_option -from pandas._typing import F +if TYPE_CHECKING: + from pandas._typing import F from pandas.compat import ( IS64, is_platform_windows, diff --git a/pyproject.toml b/pyproject.toml index c5c9cd702a380..8fff3e6990470 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -295,7 +295,6 @@ exclude = [ # TCH to be enabled gradually "pandas/core/arrays/*" = ["TCH"] "pandas/core/nanops.py" = ["TCH"] -"pandas/util/*" = ["TCH"] "pandas/_libs/*" = ["TCH"] # Keep this one enabled "pandas/_typing.py" = ["TCH"]