[Distutils] Including package_data in a source distribution

Noel O'Boyle no228 at cam.ac.uk
Fri Nov 25 15:34:23 CET 2005


On Fri, 2005-11-25 at 09:20 -0500, Phillip J. Eby wrote:
> 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.

Thank you for the pointer. However this means that earlier pages are
misleading. It would be useful if the documentation on package_data and
data_files made it clear that it doesn't work for sdist, and gave a link
to the sdist page with its completely different method. Maybe I'm an
idiot, but I spent quite some time trying every possible combination of
package_data and data_files, while sdist ignored them silently.

> 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.

Thanks again,
Noel



More information about the Distutils-SIG mailing list