Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为 Paddle 框架 API 添加类型提示(Type Hints)Tracking Issue #63597

Open
4 of 16 tasks
megemini opened this issue Apr 17, 2024 · 1 comment
Open
4 of 16 tasks
Assignees
Labels
PaddlePaddle Hackathon PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc

Comments

@megemini
Copy link
Contributor

megemini commented Apr 17, 2024

任务简介

为 Paddle 框架 API 添加类型提示(Type Hints)

Python 在 3.0 版本引入了类型提示功能,并在 PEP 484 中将其规范化。之后随着相关规范和工具的逐渐完善,类型提示逐渐成为 Python 代码中的标准实践,如今较新的主流库也基本都提供了类型提示。由于 Python 本身类型高度动态化,类型提示的存在可以帮助开发者更快地了解代码的类型信息,提高代码的可读性和可维护性,结合工具还可以提供静态类型检查,在开发阶段就能发现一些潜在的类型错误。Paddle 框架由于历史原因尚未提供类型提示,本任务希望引入尽可能多的对 Paddle 有利的类型提示。

更多信息参考 为 Paddle 框架 API 添加类型提示(Type Hints)

RFC

🏗️ 第一阶段 前置任务 (2024/04/22 ~ 2024/05/05)

  • 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
1-4 @megemini #63901
1-5 @megemini PaddlePaddle/docs#6676
1-6

🔜 第二阶段 代码标注

  • 2-1. PFCC 宣讲 Type Hints
  • 2-2. Paddle 的 docs 中引入文档《Paddle 类型提示 Q&A》,引入辅助管理文档或工具
  • 2-3. 代码标注,P1 ~ P5 (** 批量任务 **)
任务列表
任务编号 认领人 github id 任务 PR
2-1
2-2

🔜 第三阶段 补充测试 (推荐)

  • 3-1. CI 全量检查示例代码;CI 默认进行 type checking
  • 3-2. 单元测试文件,或补充测试 (_typing 模块等)
任务列表
任务编号 认领人 github id 任务 PR
3-1
3-2

🔜 第四阶段 收尾

  • 4-1. 私有 API ,如 _C_ops
  • 4-2. 查缺补漏
  • 4-3. 将 tools 中的单测统一放到 test 中进行管理
  • 4-4. 任务总结,PPT,答辩
任务列表
任务编号 认领人 github id 任务 PR
4-1
4-2
4-3
4-4

认领方式

请大家以 comment 的形式认领任务,如:

【认领】1-1

@SigureMo @zrr1999 @Asthestarsfalll @gsq7474741 @sunzhongkai588 @luotao1

请悉知~ :)

@Asthestarsfalll
Copy link
Contributor

【认领】1-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PaddlePaddle Hackathon PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc
Projects
Status: In Progress
Development

No branches or pull requests

6 participants