2. Mamba installation guide¶
Mamba is written in the Python programming language and supports only version 2.7 of the language (some Mamba components do not support Python 3.x yet). Mamba also need a database server (SQLite, MySQL, MariaDB or PostgreSQL are currently supported) in order to create and use schemas through Storm ORM. For HTML rendering, Mamba uses the Jinja2 templating system.
In order to execute Mamba tests suite doublex and PyHamcrest are required.
To build the documentation, Fabric must be installed on the system.
2.1. Installation Step¶
2.2. Dependencies¶
These are the Mamba framework dependencies
2.2.1. Mandatory Dependencies¶
The following dependencies must be satisfied to install mamba.
- Python, version >= 2.7 <= 2.7.5 (3.x is not supported)
- Twisted, version >= 10.2.0
- |mamba-storm|_, version >= 0.19
- zope.component
- transaction
- Jinja2, version >= 2.4
Is pretty possible that you also need a database manager and the corresponding Python bindings for it. The database can be either SQLite, MySQL, MariaDB (recommended) or PostgreSQL (recommended).
2.2.1.1. For SQLite database¶
As you’re using Python 2.7, SQLite should be already built in. This may not be true if you compiled Python interpreter yourself, in that case make sure you compile it with –enable-loadable-sqlite-extensions option.
If you are using PyPy, SQLite should be always compiled and present in your installation.
2.2.1.2. For MySQL and MariaDB databases¶
The MySQLdb driver should do the work for both database managers.
2.2.1.3. For PostgreSQL database¶
The psycopg2 driver is our target for PostgreSQL databases if we are using the CPython interpreter
If you are using PyPy as your interpreter you need to install psycopg2ct instead. Psycopg2ct is a psycopg2 implementation that uses ctypes and is just what we want to do the job in PyPy.
Warning
Versions of psycopg2 (CPython) higher than 2.4.6 doesn’t work with Storm so you have to be sure to install a version lower than 2.5 that is the current version as May 2013
2.2.2. Optional Dependencies¶
The following dependencies must be satisfied if we are planning on running Mamba tests, building the documentation yourself or contributing with the Mamba project
- doublex, version >= 1.5.1
- PyHamcrest
- Sphinx, version >= 1.1.3
- Fabric
- virtualenv
- pyflakes
- PEP-8
2.3. Installing Mamba¶
There are three ways to install mamba in your system.
The first one is install all the Mamba dependencies like any other software: downloading it from sources, precompiled binaries or using your distribution package manager.
The second one is using pip
or easy_install
as:
$ sudo pip install mamba-framework
2.3.1. The easy way and recommended way: PyPI - the Python Package Index¶
The third one is using virtualenv to create a virtual environment for your Mamba framework installation and then using pip
on it:
$ virtualenv --no-site-packages -p /usr/bin/python --prompt='(mamba-python2.7) ' mamba-python2.7
$ source mamba-python2.7/bin/activate
$ pip install mamba-framework
$ pip install MySQL-Python
Or if you prefer to use virtualenvwrapper
:
$ mkvirtualenv --no-site-packages -p /usr/bin/python --prompt='(mamba-python2.7) ' mamba-python2.7
$ pip install mamba-framework
$ pip install MySQL-Python
We recommend the use of virtualenvwrapper
in development environments as it is cleaner and easier to maintain.
2.3.2. Living on the edge¶
If you like to live in the edge you can clone Mamba’s GitHub repository and use the setup.py
script to install it yourself:
$ git clone https://github.com/PyMamba/mamba-framework.git
$ cd mamba-framework
$ mkvirtualenv --no-site-packages -p /usr/bin/pypy --prompt='(mamba-dev-pypy) ' mamba-dev-pypy
$ pip install -r requirements.txt
$ ./tests
$ python setup.py install
Warning
The Mamba GitHub repository is under heavy development, we do not guarantee the stability of the Mamba in-development version.
2.4. Using Mamba¶
Once you have Mamba installed in your system, you should be able to generate a new project using the mamba-admin
command line tool.
Enjoy it!