诗歌包括轮子中的附加数据文件

Ste*_*ter 11 python python-wheel python-poetry

我有一个简单的 python 包,我们称之为my_package

\n

它的文件位于src/python/my_package.\n此外,存储库根目录中有一个data文件夹,该文件夹应包含在my_package.

\n
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 python\n        \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 my_package\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 data\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 stuff.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pyproject.toml\n
Run Code Online (Sandbox Code Playgroud)\n

我没有找到任何方法来配置诗歌,它data以正确的方式包含附加文件夹。

\n

这是我的pyproject.toml

\n
[tool.poetry]\nname = "my-package"\nversion = "2.10.0" \n\npackages = [\n    { include = "my_package", from = "src/python" }\n]\n\n# This does not work! It puts the `data` folder into site-packages/data instead of site-packages/my_package/data\ninclude = [\n    { path = "data", format = ["sdist", "wheel"] }\n]\n\n[build-system]\nrequires = ["poetry-core>=1.0.0"]\nbuild-backend = "poetry.core.masonry.api"\n
Run Code Online (Sandbox Code Playgroud)\n

我还使用预构建脚本找到了以下解决方案:\n https://github.com/python-poetry/poetry/issues/5539#issuecomment-1126818974

\n

问题:它改变了轮子,不再纯粹了,而是依赖于CPython。

\n

还尝试使用符号链接,但这不起作用:How to include symlinks and the linked file in a python wheel using Poetry?

\n

问题:\n使用诗歌在 python 轮中包含附加资源文件的正确方法是什么?

\n