尽管包中包含 py.typed 标记,但发行版中不包含存根文件

rom*_*inf 5 python distutils type-hinting python-3.x

我已经向有序集贡献了存根文件。为了包含存根文件,我遵循MyPyPEP-561 的建议。但是当我这样做时,我得到了没有文件的分发:python setup.py sdistordered_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
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

另外,distutils库中与存根文件包含相关的代码在哪里?我已经搜索它以尝试调试我的问题,但没有找到任何东西。

rom*_*inf 6

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

哦,我明白了。py.typed是应该放在包中的东西,从技术上讲,ordered_set没有任何包。它有一个模块。

在 PEP 561 中,我发现:“此 PEP 不支持将打字信息作为仅模块发行版的一部分进行分发。代码应重构为基于包的发行版,并表明该包支持如上所述的打字。”