Jump to: navigation, search

Difference between revisions of "MagnetoDB/DeveloperGuide"

(Created page with "== Setting Up a Development Environment == This page describes how to setup a working Python development environment that can be used in developing MagnetoDB on Ubuntu. These...")
 
(Setting Up a Development Environment)
Line 44: Line 44:
 
=== Contributing Your Work ===
 
=== Contributing Your Work ===
 
Once your work is complete you may wish to contribute it to the project. Refer to [https://wiki.openstack.org/wiki/MagnetoDB#Improve_MagnetoDB Improve MagnetoDB] for information. MagnetoDB uses the Gerrit code review system. For information on how to submit your branch to Gerrit, see [https://wiki.openstack.org/wiki/MagnetoDB#How_to_contribute.3F HowToContribute].
 
Once your work is complete you may wish to contribute it to the project. Refer to [https://wiki.openstack.org/wiki/MagnetoDB#Improve_MagnetoDB Improve MagnetoDB] for information. MagnetoDB uses the Gerrit code review system. For information on how to submit your branch to Gerrit, see [https://wiki.openstack.org/wiki/MagnetoDB#How_to_contribute.3F HowToContribute].
 +
 +
== Unit Tests ==

Revision as of 15:47, 29 April 2014

Setting Up a Development Environment

This page describes how to setup a working Python development environment that can be used in developing MagnetoDB on Ubuntu. These instructions assume you’re already familiar with git. Following these instructions will allow you to run the MagnetoDB unit tests. If you want to be able to run MagnetoDB, you will also need to install Cassandra and Devstack.

Virtual environments

The easiest way to build a fully functional development environment is with DevStack. Create a machine (such as a VM or Vagrant box) running a distribution supported by DevStack and install DevStack there. For example, there is a Vagrant script for DevStack at https://github.com/jogo/DevstackUp.

NOTE: If you prefer not to use devstack, you can still check out source code on your local machine and develop from there.

Linux Systems

NOTE: This section is tested for MagnetoDB on Ubuntu (12.04-64) distribution. Feel free to add notes and change according to your experiences or operating system.

Install the prerequisite packages.

sudo apt-get install python-dev python-pip git-core

Getting the code

Grab the code from GitHub:

git clone https://github.com/stackforge/magnetodb.git
cd magnetodb

Running unit tests

The unit tests will run by default inside a virtualenv in the .venv directory. Run the unit tests by doing:

./run_tests.sh

The first time you run them, you will be asked if you want to create a virtual environment (hit “y”):

No virtual environment found...create one? (Y/n)

See Unit Tests for more details.

Manually installing and using the virtualenv

You can manually install the virtual environment instead of having run_tests.sh do it for you:

python tools/install_venv.py

This will install all of the Python packages listed in the requirements.txt file and also those listed in the test-requirements.txt file into your virtualenv. There will also be some additional packages (pip, setuptools, greenlet) that are installed by the tools/install_venv.py file into the virutalenv.

If all goes well, you should get a message something like this:

MagnetoDB development environment setup is complete.

To activate the MagnetoDB virtualenv for the extent of your current shell session you can run:

$ source .venv/bin/activate

Or, if you prefer, you can run commands in the virtualenv on a case by case basis by running:

$ tools/with_venv.sh <your command>

Remote development

Some modern IDE such as PyCharm (commercial/open source) support remote developing. Some useful links:
Configuring Remote Interpreters via SSH
How PyCharm helps you with remote development
Configuring to work on a VM

Also, watch this video setting up dev enviroment for cases when MagnetoDB installed on the separate machines with Devstack:
MagnetoDB dev env configuration

Contributing Your Work

Once your work is complete you may wish to contribute it to the project. Refer to Improve MagnetoDB for information. MagnetoDB uses the Gerrit code review system. For information on how to submit your branch to Gerrit, see HowToContribute.

Unit Tests