Project

General

Profile

Hacking Python SDK » History » Revision 6

Revision 5 (Tom Clegg, 07/04/2014 01:12 PM) → Revision 6/25 (Brett Smith, 07/18/2014 09:41 AM)

h1. Hacking Python SDK 

 {{toc}} 

 

 h2. Prerequisites 

 The <pre> 
 sudo apt-get install python python-pip python-dev python-virtualenv libyaml-dev 
 </pre> 

 Additional prerequisites for FUSE driver requires associated libraries to build: driver: 

 <pre> 
 sudo apt-get install libattr1-dev libfuse-dev pkg-config fuse 
 sudo adduser "$USER" fuse 
 sudo chmod g+rw /dev/fuse 
 sudo chown root:fuse /dev/fuse 
 </pre> 

 After installing @fuse@ and adding yourself to the @fuse@ group, you need to start a new login session. Make sure the @groups@ command reports that you're in the @fuse@ group. 

 



 h2. Get the source code 

 <pre> 
 cd 
 git clone https://github.com/curoverse/arvados.git 
 </pre> 

 h2. virtualenv 

 virtualenv helps you isolate the dependencies for a specific package or environment, much like Bundler does for our Rails applications.    The recommended way to deploy is to build a virtualenv for Arvados development. 

 To build the virtualenv, run: 

 <pre> 
 $ virtualenv --setuptools VENVDIR 
 </pre> 

 (@VENVDIR@ can be a directory anywhere you like, although best practice is to keep it outside your source directory.) 

 To set up the shell to use the isolated virtualenv environment, run: 

 <pre> 
 $ source VENVDIR/bin/activate 
 </pre> 

 To learn more about using and configuring virtualenv, read the "virtualenv usage documentation":https://virtualenv.pypa.io/en/latest/virtualenv.html#usage. 

 h2. Run tests 

 Strategy: 
 # Set up the environment Install your local (possibly modified) client library to use a dedicated virtualenv 
 # Run the client library test suite 
 # Build a client library package and install it to the virtualenv 
 # Install your local (possibly modified) FUSE driver to the same virtualenv 
 # Run the FUSE driver test suite 
 # Build a FUSE driver package and install it to the virtualenv 

 Note: The test suite brings up a Keep server and an API server to run tests against. For best results: 
 * Try [[Hacking Keep]] and [[Hacking API Server]] to make sure you have all the right dependencies for running the Keep and API servers. 
 * Make sure you have a blob_signing_key in services/api/config/application.yml 

 Script (make sure to edit the first line to refer to your virtualenv): Script: 

 <pre> 
 source VENVDIR/bin/activate VENVDIR=$(mktemp -d) 
 virtualenv --setuptools --system-site-packages "$VENVDIR" 

 cd ~/arvados/sdk/python 
 "$VENVDIR/bin/pip" install -r requirements.txt 
 "$VENVDIR/bin/pip" install -e . 
 GOPATH="$HOME/gocode" python "$VENVDIR/bin/python" -m unittest discover tests 

 "$VENVDIR/bin/python" setup.py test 
 python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 
 pip "$VENVDIR/bin/pip" install dist/arvados-python-client-0.1.*.tar.gz 

 cd ~/arvados/services/fuse 
 "$VENVDIR/bin/pip" install -r requirements.txt 
 "$VENVDIR/bin/pip" install -e . 
 GOPATH="$HOME/gocode" python "$VENVDIR/bin/python" -m unittest discover tests 

 "$VENVDIR/bin/python" setup.py test 
 python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 
 pip "$VENVDIR/bin/pip" install dist/arvados_fuse-0.1.*.tar.gz 
 </pre>