sdist not including all files

Setuptools has many silent failure modes. One of them is failure to include all files in sdist release (well not exactly a failure, you could RTFM, but the default behavior is unexpected). This post will serve as a google-yourself-answer for this problem, until we get new, shinier, Distribute solving all of our problems.

I b0rked the release for plonetheme.twinapex. Version 1.0 package didn’t include media assets and ZCML configuration files. Luckily Python community reacted quickly and I got advised how to fix it.

By default, setuptools include only *.py files. You need to explicitly declare support for other filetypes in file.

Example (plonetheme, built in PyDev):

recursive-include plonetheme *
recursive-include docs *
global-exclude *pyc
global-exclude .project
global-exclude .pydevproject

About the author Mikko Ohtamaa

5 thoughts on “ sdist not including all files

  1. Hi Mikko,

    An alternative to building a manifest is to build the sdist from within an svn checkout. Everything under version control will be included automatically.

    Of course, then there are all the problems with and newer versions of svn….


  2. That silent failure mode is actually inherited from the distutils, btw. Setuptools simply doesn’t fix it.

  3. If you don’t use SVN, but something else (anything, actually), then you can maybe coerce setuptools to respect that other SCM, or be screwed. Found it out the hard way, too. 😐

  4. Thank you for everyone for very constructive comments.

    I was indeed using SVN so I was bitten by the version bug.

    For ordinal users, it is very hard to distinguish between setuptools and distutils. is the only interface they see and the only interface they should interact with (…because it’s the only one they see)

    In the future versions I hope setuptools/distutils/distribute/whatever will simply have a statement


    where x could be

    1) version control system name which is used to get the included file list. Possible options svn1.4, svn1.5, hg, git, so on

    2) regexp patterns which are used to include files (current content)

    Because the option is in it would be clearly visible and self-explaining for everyone.

Leave a Reply

Your email address will not be published. Required fields are marked *