A stubs package as described in PEP 561 for PaddlePaddle
Project description
PaddlePaddle Stubs WIP
A stubs package as described in PEP 561 for PaddlePaddle.
目前仅针对 Pyright 进行了编写和测试,尚未支持 Mypy(Mypy 相对于 Pyright 太难用了,缺失功能太多),因此目前可能仅仅与 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
起步阶段,最低支持 Python 3.8,目前基于 PaddlePaddle 2.3.1 开发,第一个可用版本应当是 2.3.1 版本或者更晚的 2.4 版本~
Roadmap
See paddlepaddle-stubs 2.3.1 Roadmap
2.4.0 alpha
Note
此时本 repo 可 public,并发布到 PyPI
- 通过 basic mode 的类型检查
- 完善全部 P1 级别的类型信息(strict 下工作良好)
2.4.0 beta
- 完善全部 P2 级别的类型信息(strict 下工作良好)
- 官网示例高层 API 搭建 MNIST 示例代码在 strict 模式下工作良好
Future
之后应该是一边升级到新版本(2.4.0),一边继续完善 P3、P4、P5 级别的类型信息(strict 下工作良好)
要添加的还有很多,各个 API 类型信息需要仔细填写(修改自动生成的 Any
,添加返回值类型),有兴趣的小伙伴可以一起来参与呀~
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file paddlepaddle_stubs-3.0.0a1.tar.gz
.
File metadata
- Download URL: paddlepaddle_stubs-3.0.0a1.tar.gz
- Upload date:
- Size: 151.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa0582c58585c0f5312cde1a639851171a9cbc82f2568a26af8f60da37b91304 |
|
MD5 | 004df2e8fc682cc5ee71e63f5d8653e0 |
|
BLAKE2b-256 | 7771976fae6e2959b182d68d6904ae47709c517220fe7db91703e92c46850bb8 |
File details
Details for the file paddlepaddle_stubs-3.0.0a1-py3-none-any.whl
.
File metadata
- Download URL: paddlepaddle_stubs-3.0.0a1-py3-none-any.whl
- Upload date:
- Size: 346.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cbd5728da68baf3e92340bc8a8c2b2b43c88b2553f471f2f24c4651abbe607d |
|
MD5 | d91b9fb739affb3b253579849e1fd093 |
|
BLAKE2b-256 | 34bad79ca4489d9b59fb8cf50af8504b549c5cd08ec7538e95451379a245977f |