0

I have a Python package with the following directory structure:

project_root_dir/
├── config/
│   └── (config files)
├── src/
│   ├── sophios/
│   │   └── (source files)
├── setup.py
├── MANIFEST.in

I want to create a wheel that packages files from the config directory also.

In the setup.py file, I have the following:

from setuptools import setup, find_packages

setup(
    name="sophios",
    version="0.1.0",
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    include_package_data=True,
    package_data={
        "sophios": ["../config/*"], 
    },
)

And my MANIFEST.IN file is like this:

include config/*

But, this does not add files from the config directory to the wheel. How can I modify this to make sure files from the config directory are added to the wheel?

3
  • Possible duplicate of stackoverflow.com/questions/24347450/… Commented Aug 10, 2024 at 12:03
  • I am not sure they are similar. My main issue is that some of my files are outside of the package dir and I am trying to find a way to include them without copying them inside the package dir. Commented Aug 10, 2024 at 13:04
  • 1
    For package data files to be installed they have to be part of an importable package. So what you could do is to aim for the package data files to be installed as sophios/config/some-data-file.data. For this you need to tell setuptools that /config should be installed as sophios/config, this can be done with package_dir and you should also make sure that sophios.config is listed in the packages list.. Commented Aug 10, 2024 at 17:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.