存根文件不包括在发行版中,尽管py.类型化包装中包含标记

2024-05-23 21:07:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我已将contributed存根文件保存到ordered-set库中。包括存根文件Ifollowed来自MyPyPEP-561的建议。但是当我python setup.py sdist时,我得到的是没有ordered_set.pyi文件的分发:

$ tar -tvf dist/ordered-set-*.tar.gz --wildcards '*pyi'
tar: *pyi: Not found in archive
tar: Exiting with failure status due to previous errors

我做错什么了?在

另外,与存根文件包含相关的代码在distutils库中的何处?我已经让它尝试调试我的问题,但没有找到任何结果。在


Tags: 文件pysetuptar建议sdistpep存根
1条回答
网友
1楼 · 发布于 2024-05-23 21:07:45

Robyn Speer(图书馆的作者)找到了答案:

Oh, I figured it out. py.typed is something that's supposed to go in the package, and technically, ordered_set doesn't have any packages. It has a module.

In PEP 561, I found: "This PEP does not support distributing typing information as part of module-only distributions. The code should be refactored into a package-based distribution and indicate that the package supports typing as described above."

相关问题 更多 >