How to properly package/distribute a pure python module?

Christopher Blunck blunck at
Tue Jul 29 17:09:34 CEST 2003

MatthewS at (Matt Shomphe) wrote in message news:<5ab0af73.0307281045.6cb13cfe at>...
> Are there any guidelines for packaging a pure python module? 
> Specifically, say I have a set of 10 functions, all of varying
> behaviors (no unifying theme to bind them together into clear
> subsets), that I would like to make available to others.  What is the
> best structure for the distributed module?  A single file called
> "" that people can put in "site-packages"[1]?  A
> subdirectory called "MyFunctions" with an "" and the
> "" files[2]?  Or should the functions be broken out into
> individual files[3]?
> I'm sure it depends on some other factorsbut are there general rules
> for constructing a nice, logical package for others to use?
> [1] site-packages/ (from functions import f1)
> [2] site-packages/MyFunctions/, (from
> MyFunctions.functions import f1)
> [3] site-packages/MyFunctions/,,, (from
> MyFunctions.f1 import f1)

Do a google search for the distutils module.  For examples, look at
any python project (ZSI or SOAPpy for example), and take a look at the

The gist of it is that you define a module that defines which
modules are to be included in the distro.  A user, when they download
your tarball, goes into your directory and (as root): "python

Once you have your app in distutils compatible format, you can use
distutils to generate .exe installs, rpm installs, tarball downloads,
etc etc etc.

So definitely take a look at distutils.  :)


More information about the Python-list mailing list