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

未关闭
#468 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
重构
描述清晰度
需要澄清
活跃度
冷清
技术栈
python

调研方向

首先检查 #454 涉及的 TYPE_CHECKING 使用方式以及相关的 Sphinx issue,然后确定哪些 guard 可以防止不必要的 import 或循环 import。检查这些 import 如何影响 Sphinx 渲染和调试。当不必要的 TYPE_CHECKING guard 被移除,同时保留导入安全所需的 guard 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

cuda.core documentation enhancement P1

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.

主要语言
Cython
星标
3.4k
派生
329
平均合并
1 天 21 小时
30 天内合并 PR
113

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/cuda-python 的其他 Issue

查看 NVIDIA/cuda-python 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。