cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

Avoid relying on `typing.TYPE_CHECKING` to the maximum possible extent

Open leofang opened this issue 8 months ago • 0 comments

During investigation of #454 and related doc rendering issues, it has come to my attention that the type checking detection logic does not work well with Sphinx (ex: https://github.com/sphinx-doc/sphinx/issues/13137, https://github.com/sphinx-doc/sphinx/issues/11225).

Independently, Ralf has pointed out that it makes code debugging harder (https://github.com/NVIDIA/cuda-python/pull/463#discussion_r1967029167).

The idea of having a if TYPE_CHECKING: check is to avoid unnecessary imports or circular imports. If such issues do not exist, we should avoid using it.

leofang avatar Feb 24 '25 14:02 leofang