Packaging programs with setuptools

Python has an in-build module called distutils that provides tools to distribute Python applications. It provides the following:

1. Skeleton for standard metadata fields like “Author name” and “Source License type”.

2. Helpers – that are programs which know how to build the Python package. They create a set of pre-compiled Python files or a Windows installer.

However distutils is limited to the package itself. It cannot resolve any dependencies – other packages on which your code depends. 

setuptools adds a basic dependency resolution system, along with a way to automatically find and download the necessary packages for your code to compile.

It is good practice to write a setuptools wrapper before distributing you source.

Setuptools can be obtained with easy_install

wget http://peak.telecommunity.com/dist/ez_setup.py

sudo python ez_setup.py setuptools

This will add a new command called easy_install. Packages can now be installed with 

sudo easy_install Package_name

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: