Real Ultimate Programming

The Home for People Who Like to Flip Out and Write Code

Getting Started With Distutils

If you’ve seen some of the discussions surrounding Distribute (a fork of PJE’s Setuptools), you may be wondering about distutils, the backbone of both Distribute and Setuptools. If you are, then you may have noticed that it’s easier to find details on the various tools built on top of it than it is to find info on the basics, even though distutils is in the standard library.

Helpful Resources

Here are some of the resources I found useful:


One thing to remember: the package_data and data_files keyword arguments to setup in tell the installer what to install, tells the packager what to include in the distribution file. Even if it seems duplicative, you need to make sure your resources show up in both places if you want to be able to use python install using the distribution you build using python sdist.

Testing It All Out

After you package up your program, you can see if your is correct by doing a test install in a virtualenv. This let’s you make sure you can python install etc. without contaminating your global site packages. If you haven’t heard about virtualenv, I recommend reading up on it; it’s really handy. The first page of Google results is a good starting point.

Back to flipping out…