How do control what files are included in a wheel? It appears MANIFEST.in isn\'t used by python setup.py bdist_wheel.
UPDATE
include_package_data is the way to go, and it works for sdist and wheels.
However you have to do it right, and it took me months to figure this out, so here is what I learned.
The trick is essentially given in the name of the option include_PACKAGE_data: The data files need to be in a package subfolder
If and only if
include_package_data is TrueMANIFEST.in (*see also my note at the end about setuptools_scm)then the data files will be included.
Given the project has the following structure and files:
|- MANIFEST.in
|- setup.cfg
|- setup.py
|
\---foo
|- __init__.py
|
\---data
- example.png
And the following configuration:
Manifest.in:
recursive-include foo/data *
setup.py
import setuptools
setuptools.setup()
setup.cfg
[metadata]
name = wheel-data-files-example
url = www.example.com
maintainer = None
maintainer_email = none@example.com
[options]
packages =
foo
include_package_data = True
sdist packages and your wheels you build will contain the example.png datafile as well.
(of course, instead of setup.cfg the config can also be directly specified in setup.py. But this is not relevant for the example.)
This should also work for projects that use a src layout, looking like this:
|- MANIFEST.in
|- setup.cfg
|- setup.py
|
\---src
|
\---foo
|- __init__.py
|
\---data
- example.png
To make it work, tell setuptools about the src directory using package_dir:
setup.cfg
[metadata]
name = wheel-data-files-example
url = www.example.com
maintainer = None
maintainer_email = none@example.com
[options]
packages =
foo
include_package_data = True
package_dir =
=src
And in the manifest adjust the path:
Manifest.in:
recursive-include src/foo/data *
setuptools_scmIf you happen to use setuptools and add the setuptools_scm plugin (on pypi), then you don't need to manage a Manifest.in file. Instead setuptools_scm will take care that all files that are tracked by git are added in the package.
So for this case the rule for if or if not a file is added to the sdist/wheel is: If and only if
include_package_data is Truethen the data files will be included.