Python Development Tools – Part I
This time, I want to share about Python development environment setup that I use daily. I love Python programming language, because it provides simple syntax with high readibility level. Currently I am learning Django, a popular web framework powered by Python.
To set your Python development environment, you should (if not must) use these tools, known as virtualenv and pip. You can install them by using easy_install by typing this command:
$ sudo easy_install pip
$ sudo easy_install virtualenv
easy_install will install (doh) these package to system-wide Python package directory, enabling you to use pip and virtualenv in your system.
What is virtualenv? Taken from its website, virtualenv is a tool to create an isolated Python environment. You can have a package with multiple versions depending to each your application. virtualenv also keep these packages separated from system-wide Python package, which good if you are an early adopter. You can create a virtual environment for learning some new features where the stable version is not intact with the upgrade.
To start use virtualenv you can launch your Terminal application and type:
python virtualenv.py –distribute –no-site-packages
The command will set an isolated enviroment by not using any Python packages installed in your system. You can install the same package with newer version without damaging your system configuration.
I suggest you to install virtualenvwrapper, a command-line utility which provide wrapper for creating, deleting or managing your virtual environment. It is a good idea to install virtualenvwrapper as a system-wide Python package. Some very useful commands are:
lssitepackage— for listing all your virtual environmentworkon <env>— switching to anotherdeactivate— exit from current virtual environmentmkvirtualenv— wrapper for creating new virtual environmentrmvirtualenv— deleting existing virtual environment
You can find another useful commands in the documentation section.
By using virtualenv and virtualenvwrapper, you can create and manage isolated environment for your Python application. You can take it further by combining with Pythonbrew a not-so-new-but-just-found-out-about-it tool, which allows you install multiple version of Python. I will talk about it later, since I am still learning to use it.
See you in Part II