This release is a pre-release and may not be stable for production use.
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,添加返回值类型),有兴趣的小伙伴可以一起来参与呀~
Release files for paddlepaddle-stubs 3.0.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| paddlepaddle_stubs-3.0.0a1.tar.gz | 151.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| paddlepaddle_stubs-3.0.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 497.9 kB
Release files / paddlepaddle_stubs-3.0.0a1.tar.gz
| Download URL | paddlepaddle_stubs-3.0.0a1.tar.gz |
|---|---|
| Size | 151.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa0582c58585c0f5312cde1a639851171a9cbc82f2568a26af8f60da37b91304
|
|
BLAKE2b-256 checksum How to use checksums |
7771976fae6e2959b182d68d6904ae47709c517220fe7db91703e92c46850bb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / paddlepaddle_stubs-3.0.0a1-py3-none-any.whl
| Download URL | paddlepaddle_stubs-3.0.0a1-py3-none-any.whl |
|---|---|
| Size | 346.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cbd5728da68baf3e92340bc8a8c2b2b43c88b2553f471f2f24c4651abbe607d
|
|
BLAKE2b-256 checksum How to use checksums |
34bad79ca4489d9b59fb8cf50af8504b549c5cd08ec7538e95451379a245977f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|