python / python/typeshed

Decouple collections.abc types from typing aliases

未关闭
#6,257 11 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stubs: improvement
主要语言
Python
星标
5.1k
派生
2.1k
平均合并
1 天 19 小时
30 天内合并 PR
82

描述

At the moment, collections.abc types are strict aliases for their typing counterparts. This can make it difficult for intellisense providers to distinguish them and suggest the correct one. @erictraut mentioned that for pyright: https://github.com/microsoft/pylance-release/issues/1001#issuecomment-787475406.

Although this would likely be a lot of code duplication in the short term, I propose to copy the type definitions to the _collections_abc.pyi module guarded by sys.version_info >= (3, 9).

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先阅读现有的 collections.abc 和 typing 存根定义,尤其是 _collections_abc.pyi 以及相关别名。检查其他地方如何使用 sys.version_info >= (3, 9) 守卫,并查看链接的 pyright 讨论。完成的标准是 collections.abc 类型具有各自独立的复制定义,而不是严格的 typing 别名。

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

评估

技术栈
python
领域
devtools
Issue 类型
重构
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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