+Distribute, Virtualenv, PIP et al
+This is a short tutorial about some popular techniques in the Python world. It cannot cover everything completely, but will give you some literature to read on.
+`Distribute <http://pypi.python.org/pypi/distribute>`_ is a fork of the popular distutils and has some important features:
+- Download and install packages.
+- Resolving dependencies
+- Upload to PyPI, the Python Package Index.
+- Help with development.
+To install distribute, open a shell and execute as root::
+ $ wget http://python-distribute.org/distribute_setup.py
+ $ python distribute_setup.py
+This removes the old and stinky `setuptools` and installs the new and modern `distribute`.
+`PIP <http://pypi.python.org/pypi/pip>`_ is the replacement for `easy_install`, it stands for "Python Installs Packages". It's full of cool features, just as
+- Removement of packages
+- Installing from a distributed SCM repository.
+- Install from a list of packages.
+To install pip, open a shell and execute as root::
+From now on forget `easy_install` and just use `pip`!
+There are some usefull commands that ease a lot of work:
+ Search the Python Package Index for a given keyword.
+ Prints out a list of all installed packages.
+completion --bash >>~/.profile
+ Adds some commands to *.profile* to enable tab command completion.
+For more commands and options, please read `pip`'s manpage.
+To create modern-style packages without a lot of pain, just install `modern-package-template <http://pypi.python.org/pypi/modern-package-template>`_ as root::
+ $ pip install modern-package-template
+To create a modern package, just execute::
+ $ paster create -t modern_package testpackage
+This creates a directory *testpackage*. Just browse around in it, the most important file is the *setup.py*. For more information about it, read the documentation. Be careful, it's very large!
+Now you can create a package and register and upload it. For registration, just type::
+ $ python setup.py register
+If not done, create a PyPI-Account before on the website. With::
+ $ python setup.py sdist upload
+You create a new version of your package and upload it to PyPI. It can be installed now with `pip install *packagename*`. Congrats!
+As you might have noticed, every package you've installed was installed with root-privileges. Additionally, you can only install each package once on your system. What if two projects need different versions of python or package *xyz*? No problem, here we go with `virtualenv <http://pypi.python.org/pypi/virtualenv>`_ which creates virtual python environments on your system. Just run as root::
+ $ pip install virtualenv
+Now you can create a virtual environment with a minimal package list including distribute::
+ $ virtualenv testenv --no-site-packages --distribute
+Switch to the created directory and activate the virtualenv::
+Let's print a list with the installed packages::
+You should see a list containing *wsgiref* and *distribute*.
+To deactivate the *testenv*, just type
+There's a `wrapper <http://pypi.python.org/pypi/virtualenvwrapper>`_ written around virtualenv, which adds some convenience functions.
+ $ pip install virtualenvwrapper
+Second, create a hidden directory for your virtualenvs. It may be anywhere on your filesystem, hence the directories in it are just **virtual**. After all, you shouldn't care where they are and how many you have::
+Third, create a var WORKON_HOME::
+ $ export WORKON_HOME=$HOME/.virtualenvs
+ $ source /usr/local/bin/virtualenvwrapper.sh
+You can add these two lines to your *~/.bashrc*, so they are executed every time you log in to your computer.
+Now some commands are enabled::
+ $ mkvirtualenv --no-site-packages --distribute testenv
+This creates a virtualenv *testenv* in your virtualenv directory (in this example, it's *~/.virtualenvs*).
+To switch the directory to ~/.virtualenvs/testenv, there's a command:
+You can now install packages to that virtualenv without being root::
+Now list the packages in your local sitepackages directory::
+Or switch to your sitepackages directory::
+If you want to install the testpackage from before to your virtualenv, one way to do it is::
+ (testenv)$ cd /path/to/testpackage
+ (testenv)$ python setup.py develop
+Now every change made to testpackage is taken over by the installation in the *testenv*.
+To deactivate the *testenv*, just type::
+To (re)activate it, just type::
+To remove it, just type::
+Thanks to `Markus Zapke a.k.a. keimlink <http://www.keimlink.de/>`_, which made a great session about distribute, pip and virtualenv at the Python Usergroup Leipzig. A great guide to packaging is `The Hitchhiker’s Guide to Packaging <http://guide.python-distribute.org/>`_.