typing docs: Use soft deprecation
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
A while ago we introduced the concept of "soft deprecation" in PEP 387 (https://peps.python.org/pep-0387/#soft-deprecation): for things that we no longer recommend using, but which we aren't planning to remove in the near future.
The typing docs already list four classes of objects that are deprecated without a scheduled removal (https://docs.python.org/3.14/library/typing.html#deprecation-timeline-of-major-features):
- Pre-PEP-585 generic aliases (e.g.
List) TextHashableandSizedTypeAlias
I'd like to also soft-deprecate the following:
Optional(obviated by PEP-604)NoReturn(preferNever)typing.ForwardRef(deprecated alias forannotationlib.ForwardRef)types.UnionType(deprecated alias fortyping.Union)- Creating a
Unionusing subscripting (Union[A, B]instead ofA | B) (PEP-604) - Creating a
TypeVar,ParamSpec, orTypeVarTupleusing the constructor directly (PEP-695) - Directly inheriting from
Generic(PEP-695)
None of those will be removable for many years if ever, but I think it's useful to have a clear statement in the docs that the newer syntax is preferred.
Linked PRs
- gh-154480
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从所链接的 Python 文档页面中标题为“Deprecation timeline of major features”的 typing 文档部分开始,并将其中现有的条目与所请求的 soft deprecations 进行比较。当文档清楚地标识出列出的旧形式并推荐其更新的替代形式时,即视为完成;请先查看链接的 PR gh-154480,因为相关工作已经与它关联。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 30/100