setuptools provides a package_data keyword argument in its setup() function for users to include package data for deployment and installation. But this keyword argument is not very convenient: You need to specify files to be included with glob patterns. Glob patterns suck when files are nested deeply.

What you want is to specify the root dir and let the tools recursively find all files there for you. For this purpose, forget package_data and use include_package_data instead. include_package_data is a bool variable. If set to True, setuptools will automatically include any data files it finds inside your package directories and also specified by MANIFEST.in. Luckily, there is a directive recursive-include which you can use in MANIFEST.in to recursively include files. So things finally work out as follows:

1. In MANIFEST.in:

recursive-include mypackage/data *

2. In setup.py:

setup(
...
include_package_data = True,
...
)


Note that both need to be done. If you don’t set include_package_data to True, then the files will be included for packaging but not for installation.