How do control what files are included in a wheel? It appears MANIFEST.in
isn\'t used by python setup.py bdist_wheel
.
UPDATE
Before you make any changes in MANIFEST.in
or setup.py
you must remove old output directories. Setuptools is caching some of the data and this can lead to unexpected results.
rm -rf build *.egg-info
If you don't do this, expect nothing to work correctly.
Now that is out of the way.
If you are building a source distribution (sdist
) then you can use any method below.
If you are building a wheel (bdist_wheel
), then include_package_data
and MANIFEST.in
are ignored and you must use package_data
and data_files
.
This is a good option, but bdist_wheel
does not honor it.
setup(
...
include_package_data=True
)
# MANIFEST.in
include package/data.json
This is most flexible option because you can add any file from your repo to a sdist
or bdist_wheel
setup(
....
data_files=[
('output_dir',['conf/data.json']),
]
# For sdist, output_dir is ignored!
#
# For bdist_wheel, data.json from conf dir in root of your repo
# and stored at `output_dir/` inside of the sdist package.
)
Similar to above, but for a bdist_wheel
let's you put your data files inside of the package. It is identical for sdist
but has more limitations than data_files
because files can only source from your package subdir.
setup(
...
package_data={'package':'data.json'},
# data.json must be inside of your actual package
)