[Distutils] Including package_data in a source distribution

Phillip J. Eby pje at telecommunity.com
Fri Nov 25 15:20:03 CET 2005


At 11:35 AM 11/25/2005 +0000, Noel O'Boyle wrote:
>I have been trying to use either distutils or setuptools to include some
>package data in a source distribution ("python setup.py sdist") using
>the package_data option. It *is* included if I use "python setup.py
>bdist_egg".
>
>Can someone explain to me whether this is a feature or a bug? The
>documentation led me to expect that this would work, but it does not. I
>am using the example on
>http://www.python.org/dev/doc/devel/dist/node12.html.

Actually, if you look at the documentation for the "sdist" command, you'll 
see that it does not support automatically including package_data in source 
distributions; you have to add it to the MANIFEST.in.

If you are using the latest Subversion revision of setuptools, you can 
specify 'include_package_data=True' instead of listing individual package 
data files, and any data files under CVS or SVN source control will 
automatically be added to the package data for you.  If you are not using 
CVS or SVN, you can instead add the files to your MANIFEST.in, and then 
setuptools will pick them up from there.

If you're using an older version of setuptools, you can use the 
package_data form, and if the data files are under CVS or SVN control, 
they'll be included in your source distribution.

If you're using distutils, you'll have to duplicate the info in MANIFEST.in.



More information about the Distutils-SIG mailing list