Installation

This part of the documentation covers the installation of the relayr library. If you are an experienced Python user or developer you will likely already be familiar with much of the information below and may want to skip this section. In case you are new to Python you may find the below information useful.

Installing the installer

The recommended installation tool for Python packages today is pip. If it is not already installed on your machine you can do so easily as follows:

$ wget https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py

Using easy_install from setuptools is deprecated for various reasons. You can find more about packaging in the Python Packaging User Guide.

Creating a virtual environment

In order not to risk your existing Python installation it is recommended to create a virtual Python environment (short: a virtualenv), in which you can install the relayr library and its dependencies. To do that in Python 2.x you need to have a package named virtualenv installed (a simple pip install virtualenv will do):

$ virtualenv rvenv
New python executable in rvenv/bin/python
Installing setuptools, pip...done.
$

In Python 3.3 and higher a tool named pyvenv is part of the standard Python installation:

$ pyvenv rvenv
$

In both cases the above lines will create a subfolder named rvenv containing a separate Python installation, plus additional tools like pip. You can activate and deactivate this environment using the following commands in a terminal:

$ source rvenv/bin/activate
(rvenv) $ # do some work... download, test, install, use...
(rvenv) $ deactivate
$

Installing a release

You can install a release of the relayr library from PyPI with a single pip command. Inside a virtual Python environment this should be done after activating that environment first (at the point of # do some work... in the previous section above). This will install the latest version from PyPI:

$ pip install relayr

You can also run a source distribution of a release from PyPI if you want to run the test suite and/or generate the documentation yourself (more about this option below). Just download a tarball of the sources and unpack as follows:

$ wget https://pypi.python.org/packages/source/r/relayr/relayr-0.3.0.tar.gz
$ tar xfz relayr-0.3.0.tar.gz
$ cd relayr-0.3.0
$ python setup.py install

Installing a development version

The relayr library is hosted and developed on GitHub. If you wish to work with the development version of relayr, you have two options (again, both recommended for a virtual environment):

1. Checking out from the repository with git

You can operate on a git checkout. This will pull in the dependencies and activate the git head as the current version inside the virtualenv. Then all you have to do is run git pull origin to update to the latest version, before installing the package itself:

$ git clone http://github.com/relayr/python-sdk.git
Cloning into 'python-sdk'...
[...]
$ cd python-sdk
$ git pull origin
$ python setup.py install

2. Downloading the repository with pip

You could also let pip itself pull in the development version without git:

$ pip install git+git://github.com/relayr/python-sdk.git
[...]
Cleaning up...
$ python setup.py install

If you want to create the local documentation using Sphinx and/or run the test suite using pytest please read the respective sections, Documentation and Testing.