Archive for the ‘TurboGears’ Category

Python: Working Environment

Friday, May 4th, 2007

I've been doing a lot of TurboGears work recently. TurboGears is an excellent framework and Python is my favorite language so I can't complain. Well of course I can!

One of the great things about python is easy_install which (as it's name suggests) installs things really easily. Want to install postgres drivers for python? Well just type

easy_install psycopg2

What could be easier then that! Well the problem is that you end up with a drive littered with old versions of modules. You'd really like to clean them up but your not sure if they are need, who put them there and sometimes what the module even is.

Step forward WorkingEnv.

WorkingEnv creates a directory structure and a source shell file for a little mini setuptools environment.

dazza@macpro:~/>workingenv tgenv
dazza@macpro:~/>source tgenv/bin/activate
(tgenv)dazza@macpro:~/>easy_install TurboGears
...

There you go... TurboGears installs, you're not shitting all over your drive and if it all goes tits up you can delete it all and start again. Note the way my shell prompt has changed to tell me I'm living the dream :-) No more complaining!

You can also setup your private working environment to match any setup an ISP may have as well which is a must for easy pain free deployment.

Anyway, I wish I'd know about this a few years ago. Enjoy.

update
cavorite added two excellent links to his reddit comment about this article that I thought I'd share here:

Thanks cavorite :-)