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:
- the standard docs for distutils. These are a good start, as they outlines the basics of
distutils
as it currently stands, without any of the various PEPs that have been discussed/proposed. - the API reference, since it helps cover the numerous keyword arguments to the
setup
function. - the list of classifiers at PyPI; this is handy to make sure you're using actual classifiers that other Python developers are likely to understand instead of ones you just make up
- this
distutils
tutorial on the Python wiki - the Distutils Cookbook; I particularly enjoy the AutoPackageDiscovery recipe
Miscellaneous
One thing to remember: the package_data
and data_files
keyword arguments to setup
in setup.py tell the installer what to install, MANIFEST.in 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 setup.py install using the distribution you build using python setup.py sdist.
Testing It All Out
After you package up your program, you can see if your setup.py is correct by doing a test install in a virtualenv
. This let's you make sure you can python setup.py 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...