Given this directory structure (empty __init__.py and logging.yml is fine):
foo
│ setup.py
│
└─── foo
│ __init__.py
│
└─── config
logging.yml
Here is my attempt, this setup.py:
from os import path
from setuptools import find_packages, setup
package_name = "foo"
if __name__ == "__main__":
setup(
name=package_name,
packages=find_packages(),
package_dir={package_name: package_name},
package_data={"config":[path.join(package_name, "config", "logging.yml")]},
include_package_data=True,
)
# Also tried:
# package_data={"config": [path.join("config", "logging.yml")]}
# package_data={"": [path.join("config", "logging.yml")]}
# package_data={"": [path.join(package_name, "config", "logging.yml")]}
No errors after a python setup.py install (also tried python -m pip install .), but running from my virtualenv root fd -HIFuuueyml logging returns no results and it's absent from foo.egg-info\SOURCES.txt.
PS: Testing locally with 3.13.0a5; setuptools 69.2.0; pip 24.0. But on my CI test & release to 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 across Windows, Linux and macOS.
package_dir={package_name: package_name}. See the docs at setuptools.pypa.io/en/latest/userguide/package_discovery.html . With your dir structure you don't needpackage_dirat all; my advice is to remove the line.package_data={"config":…you declare thatconfigis a package. But it isn't. So the answer for the question in the title is: no. Again, the docs: setuptools.pypa.io/en/latest/userguide/datafiles.htmlpackage_data. I'll try removingpackage_dirand see if that fixes this. EDIT: Nope, that didn't work either. Tried all permutations ofpackage_dataenumerated in my question.