与安装相比,车轮生成不一致

Wheel generated inconsistently compared to installation

我有以下文件:

setup.py
problems/
    __init__.py
    sometimes_included/
        file.txt

__init__.py 仅包含:

import os
with open(os.path.join(os.path.join(os.path.dirname(__file__), "sometimes_included"), "file.txt")) as f:
    print(f.read())

file.txt 只是一些虚拟文本。

该文件位于 https://github.com/ysangkok/packaging-problems

的存储库中

当我pip3 install https://github.com/ysangkok/packaging-problems/archive/master.zip

然后 python3 -c 'import problems' 它不起作用,(未安装 txt 文件)。

但如果我克隆 git 存储库和 python3 setup.py install --user,它就可以工作。

如何在不将 problems/sometimes_included 列为 setup.py 中的包的情况下实现一致的行为。这个目录不是一个包,它不应该需要 __init__.py。鉴于它在不使用轮子时也能正常工作,我想知道是否有办法。

使用 include problems/sometimes_included/file.txt

创建文件 MANIFEST.in