Python Language Purpose of


The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. It's purpose is the correct installation of the software.

If all you want to do is distribute a module called foo, contained in a file, then your setup script can be as simple as this:

from distutils.core import setup


To create a source distribution for this module, you would create a setup script,, containing the above code, and run this command from a terminal:

python sdist

sdist will create an archive file (e.g., tarball on Unix, ZIP file on Windows) containing your setup script, and your module The archive file will be named foo-1.0.tar.gz (or .zip), and will unpack into a directory foo-1.0.

If an end-user wishes to install your foo module, all she has to do is download foo-1.0.tar.gz (or .zip), unpack it, and—from the foo-1.0 directory—run

python install