-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
PFCCPaddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfccPaddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfccPaddlePaddle Hackathonstatus/close已关闭已关闭
Description
任务简介
为 Paddle 框架 API 添加类型提示(Type Hints)
Python 在 3.0 版本引入了类型提示功能,并在 PEP 484 中将其规范化。之后随着相关规范和工具的逐渐完善,类型提示逐渐成为 Python 代码中的标准实践,如今较新的主流库也基本都提供了类型提示。由于 Python 本身类型高度动态化,类型提示的存在可以帮助开发者更快地了解代码的类型信息,提高代码的可读性和可维护性,结合工具还可以提供静态类型检查,在开发阶段就能发现一些潜在的类型错误。Paddle 框架由于历史原因尚未提供类型提示,本任务希望引入尽可能多的对 Paddle 有利的类型提示。
更多信息参考 为 Paddle 框架 API 添加类型提示(Type Hints)
RFC
🏗️ 第一阶段 前置任务 (2024/04/22 ~)
- 1-1. Paddle 中引入
_typing
模块 - 1-2. Paddle 中引入
Tensor
stub 和Paddle/python/paddle/py.typed
文件 - 1-3. Paddle 的 docs 中引入文档
《Paddle 中的类型提示》
- 1-4. Paddle 的 CI 中引入
mypy
对于 API 中 docstring 的示例代码
的类型检查 - 1-5. Paddle 的 docs 中正确的显示函数签名与描述的数据类型
- 1-6. Paddle 的 docs 中不渲染
# type: ignore
任务列表
任务编号 | 认领人 github id | 任务 PR |
---|---|---|
1-1 | @Asthestarsfalll @SigureMo | #63604 #63690 |
1-2 | @megemini | #63953 #64575 |
1-3 | @megemini @SigureMo | PaddlePaddle/docs#6678 PaddlePaddle/docs#6836 |
1-4 | @megemini | #63901 |
1-5 | @megemini | PaddlePaddle/docs#6676 |
1-6 | @megemini | PaddlePaddle/docs#6680 |
🔜 第二阶段 代码标注
- 2-1. PFCC 宣讲 Type Hints
- 2-2. Paddle 的 docs 中引入文档《Paddle 类型提示 Q&A》,引入辅助管理文档或工具
- 2-3. 代码标注,
P1
~P5
(** 批量任务 **)
任务列表
任务编号 | 认领人 github id | 任务 PR |
---|---|---|
2-1 | @megemini | |
2-2 | @megemini | PaddlePaddle/docs#6678 |
🔜 第三阶段 补充测试 (推荐)
- 3-1. CI 全量检查示例代码;CI 默认进行 type checking (all) ; 更新 mypy 版本
-
3-2. 单元测试文件,或补充测试 (_typing 模块等)
🔜 第四阶段 收尾
- 4-1. 私有 API ,如
_C_ops
- 4-2. 查缺补漏
- 4-3. 将 tools 中的单测统一放到 test 中进行管理
- 4-4. 任务总结,PPT,答辩
任务列表
任务编号 | 认领人 github id | 任务 PR |
---|---|---|
4-1 | @megemini | #66357 |
4-2 | @megemini | #65397 |
4-3 | @megemini | #65905 |
4-4 | @megemini | PFCCLab/blog#68 |
认领方式
请大家以 comment 的形式认领任务,如:
【认领】1-1
@SigureMo @zrr1999 @Asthestarsfalll @gsq7474741 @sunzhongkai588 @luotao1
请悉知~ :)
sunzhongkai588, gouzil and ooooo-createsunzhongkai588, gouzil and ooooo-createsunzhongkai588, gouzil and ooooo-createsunzhongkai588, gouzil and ooooo-create
Metadata
Metadata
Labels
PFCCPaddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfccPaddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfccPaddlePaddle Hackathonstatus/close已关闭已关闭
Type
Projects
Status
Done