Mercurial python packages need a MANIFEST.inΒΆ

Tags: python

I released sdistmaker last Thursday (see your own pypi).

The original tha.sdistmaker code was in my former employee’s subversion repository. I now renamed it to sdistmaker and put it into my bitbucket account), which means I now use mercurial (hg) for it instead of subversion.

Setuptools automatically picks up all files in your python package that you put into subversion, so also files like TODO.txt. But mercurial isn’t recognized (unless you install mercurial support from hg.setuptools).

Oopsie, this meant that my TODO.txt wasn’t automatically included in the source distribution as I switched from subversion to mercurial. And my setup.py reads TODO.txt for the long description, so setup.py refused to run: sdistmaker was uninstallable...

Luckily my brother Maurits (thanks!) noticed it and pushed out a new release that fixed it temporarily.

How to really fix it: a MANIFEST.in. Setuptools/distutils/distribute picks up a lot of things by default. The setup.py, the python files in your package, a README, C source files that you build, etc. But not the rest of the .txt files, for instance. The full mechanism is described in http://docs.python.org/distutils/sourcedist.html . What I did was add a MANIFEST.in right next to my setup.py:

include *.txt
recursive-include sdistmaker *.txt *.py

The first line includes the TODO.txt, CREDITS.txt and so in the package root. The second line looks inside the sdistmaker/ directory and recursively includes everything ending in .txt and .py.

Tadaah, now you get a proper release with mercurial (or git or bazaar), too. Without needing to install setuptools add-ons on every machine where you make releases.

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):