Setting Up a Development Environment¶
Note
This document originates from the OpenStack Nova project. Since we also use the same toolset for testing, we can also use some of their documentaion. We have obviously made changes that only affect our project but we credit the OpenStack project for the original [1].
This page describes how to setup a working Python development environment that can be used in developing payload on Ubuntu. These instructions assume you’re already familiar with git.
Following these instructions will allow you to run the payload unit tests.
Virtual environments¶
payload development uses a set of shell scripts from OpenStack’s DevStack. Virtual enviroments with venv are also available with the source code.
Linux Systems¶
Note
This section is tested for payload on Ubuntu (12.04-64) distribution. Feel free to add notes and change according to your experiences or operating system.
Install the prerequisite packages.
On Ubuntu Precise (12.04):
sudo apt-get install python-dev python-pip git-core redis-server
Getting the code¶
Grab the code from GitHub:
git clone https://github.com/kickstandproject/payload.git
cd payload
Installing and using the virtualenv¶
To install the virtual environment you simply run the following:
python tools/install_venv.py
This will install all of the Python packages listed in the requirements.txt file into your virtualenv. There will also be some additional packages (pip, distribute, 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:
payload development environment setup is complete.
payload development uses virtualenv to track and manage Python dependencies
while in development and testing.
To activate the payload 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>
Also, make test will automatically use the virtualenv.
Running unit tests¶
The unit tests will run by default inside tox env in the .tox directory. Run the unit tests by doing:
tox
See Unit Tests for more details.
Contributing Your Work¶
Once your work is complete you may wish to contribute it to the project. Refer to HowToContribute for information. Nova uses the Gerrit code review system. For information on how to submit your branch to Gerrit, see GerritWorkflow.
Footnotes
[1] | See http://docs.openstack.org/developer/nova/devref/development.environment.html |