Timur Izhbulatov — Independent Electronic Music

Application components under shared namespace

Tue, 24 Aug 2010 21:50:00 in Tech stuff | permalink

paste python setuptools turbogears

It is often desirbale to decompose an application into several components. Perhaps one of the most common approaches is separating a model component that is responsible for data repesenataion and interaction with the database and then use it from other components. For instance, one of the other components can provide a sofisticated web-based UI to the model while another one implements a bare command-line interface.

In this situation each component is a subproject that is distributed as a separate package, in the setuptools' sense. And view each component has its corresponding directory in the project's VCS repository which contains a everything that is typicaly necessary to build an .egg, setup.py and whatever else the developer finds approprate.

A component, or subproject, usualy includes a number of modules which are organized inside a Python package. While it is possible to name the components' packages like yourappmodel, yourappweband yourappcli, The Zen of Python says:

Namespaces are one honking great idea -- let's do more of those!

And applying to our example that means the packages should be named like yourapp.model, yourapp.web and yourapp.cli.

Here I'm going to show how I work with a project that uses setuptools' namespace packages.

(Read more...)

Home-based installation of Python libraries

Wed, 30 Jan 2008 11:38:00 in Tech stuff | permalink

linux python setuptools

Many popular Python libraries are available in various Linux distributions. However, it is not always possible and/or desirable to install them from packages. For instance, sometimes you don't have root access to the target machine or just want to have other vesrion of some library isolated under your home directory.

I've been successfully using this approach on my laptop and several development and production sites for about two years so far.

(Read more...)