0

I have some data and config file in the project root folder(same as setup.py) and I want to add them to the wheel build as package data. So my setup.py looks like below:

from setuptools import find_packages, setup

setup(
    name="dbx_test",
    packages=find_packages(exclude=["tests", "tests.*"]),
    include_package_data=True,
    package_data={
        "": ["config.yaml",
            "secrets.txt"
          
            
        ]
    },
    setup_requires=["wheel"],
    
    entry_points={
        "console_scripts": [
            "main = src.main:main",
        ],
    },
    version="0.0.1",
    description="",
    author="",
)

But, the wheel build is not able to pick up the secrets and config file from the root. How would I be able to do that?

Tarique
  • 463
  • 3
  • 16
  • Does this answer your question? [How do you add additional files to a wheel?](https://stackoverflow.com/questions/24347450/how-do-you-add-additional-files-to-a-wheel) Specifically, the 'DATA_FILES' section of [this answer](https://stackoverflow.com/a/49501350/6340496). – S3DEV Mar 28 '23 at 14:48
  • I would recommend against going the *data files* route, I am not even sure it would solve your issue. -- Your issue from what I understand, is that if your files are not in an importable package, then they are not package data. So can you move those files into (one of) the importable package(s) of your project, or not? – sinoroc Mar 28 '23 at 15:22
  • I can move them into importable package but that sort of changes the repo structure. – Tarique Mar 28 '23 at 15:25
  • @S3DEV I tried the manifest file but it didn't work – Tarique Mar 28 '23 at 15:26
  • 1
    From my point of view, if you can move the files into the importable package you absolutely should. This will make so many things so much easier. For example, how will you access those files? How will you find their location on disk? If the files are part of an importable package, then it is super easy to find and access those files thanks to [`importlib.resources`](https://docs.python.org/3/library/importlib.resources.html). If not, then it will be a struggle to find the files once they are installed. – sinoroc Mar 28 '23 at 15:36

0 Answers0