尽管包中包含 py.typed 标记,但存根文件未包含在分发中

Stub files are not included in the distribution despite py.typed marker included in the package

contributed stub file to ordered-set library. To include stub files I followed recommendations from MyPy and PEP-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 库中与存根文件包含相关的代码在哪里?我已经 searched 尝试调试我的问题,但没有找到任何东西。

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

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."