I have a simple python package, let's call it my_package
.
Its files are located in src/python/my_package
.
In addition, there is a data
folder in the repository root, which should be included in the resulting python wheel within the my_package
.
.
├── src
└── python
└── my_package
├── data
└── stuff.json
├── pyproject.toml
I did not find any way to configure poetry that it includes the additional data
folder in the correct way.
Here is my pyproject.toml
[tool.poetry]
name = "my-package"
version = "2.10.0"
packages = [
{ include = "my_package", from = "src/python" }
]
# This does not work! It puts the `data` folder into site-packages/data instead of site-packages/my_package/data
include = [
{ path = "data", format = ["sdist", "wheel"] }
]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
I also found the following solution, using a pre-build script: https://github.com/python-poetry/poetry/issues/5539#issuecomment-1126818974
Problem: it changes the wheel that it is not pure anymore, but depends on CPython.
Also tried with symlink, but that does not work: How to include symlinks and the linked file in a python wheel using Poetry?
Question: What is the correct way to include additional resource files in a python wheel using poetry?