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 摘要。