Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

cattidea/paddlepaddle-stubs

Repository files navigation

PaddlePaddle Stubs WIP

A stubs package as described in PEP 561 for PaddlePaddle.

Tip

PaddlePaddle will provide official type hints in 3.0.0, so this project has been suspended. Please use the official type hints after 3.0.0.

PyPI - Python Version pypi PyPI - Downloads LICENSE ruff Gitmoji

目前仅针对 Pyright 进行了编写和测试,尚未对 Mypy 进行专门测试,因此目前可能仅仅与 VS Code 的 Pylance 扩展一起工作良好~

Note

本 repo 非运行时库,因此本 repo 中所有示例和单测可能在运行时并不能正常运行,仅仅是为了更加全面和方便对类型进行检查而已。

Usage

pip install paddlepaddle-stubs --pre

此时再打开编辑器,查看编辑器的类型提示~~~

VS Code 推荐配置:

{
   "python.languageServer": "Pylance",
   // 现在有一些类型在 strict mode 工作的并不是很好,推荐先使用 basic mode
   "python.analysis.typeCheckingMode": "basic",
   "python.analysis.inlayHints.functionReturnTypes": true,
   "python.analysis.inlayHints.variableTypes": true,
}

Status

本项目将会作为 【Hackathon 6th】Fundable Project 任务一 —— 为 Paddle 框架 API 添加类型提示(Type Hints)的参考项目,不再单独维护。