Psychopy

We'll be working with PsychoPy and interested students from our events to create an easy-to-follow installation guide for the project. In the meantime, here is the text of an email from one of the maintainers with an overview of setup:

A dev environment installation guide would be a very nice contribution to the documentation! I think for people with .edu email addresses it is quite straightforward, because Enthought Canopy python is available for free. This is what I use and am familiar with, and mostly on mac (although I have installed on Win 7 and ubuntu as well). Unfortunately, I am not familiar with doing things other ways, and this might be where OpenHatch contributors need more guidance.

Some documentation for prospective PsychoPy developers is online here: http://psychopy.org/developers/developers.html

In general, regardless of platform you'll want to have a) a non-default version of python (some OS'es come with python, but its best not to use that for dev work), b) git, and a github account with a fork of psychopy, and a local copy (clone) of your fork, c) a code editor with syntax highlighting, and d) some ease-of-use things. At times its useful to have e) tools for compiling some of the dependencies (like pyo, for sound, which has a lot of C code).

a) Python: version 2.7.x, 32-bit (not 64-bit due to incompatibilities with some of the libraries; not python 3.x). Its useful to have a separate python installation (not the default one that comes with Mac or linux).

a.1: If you have an email address that ends in .edu, its free to get the full featured version packaged by Enthought, as Enthought Canopy. Try to get full version, not the "free" version. (I have not tried the "free" version, maybe it would work maybe not, would be good to know if it does in fact work, or if it can work but requires a manual install of other packages, e.g., using pip). They do make you hunt around a bit for the full academic version (some documentation here would be nice). You do want to upgrade most packages but not wx. Stay at wx 2.8.10 or 2.8.11. I use the Canopy GUI to upgrade many things at once. I use the "enpkg" command line tool to get individual packages (its like pip but tuned for Canopy). Using pip with Canopy seems to work fine.

On mac at least, if you install Canopy and type "python" you'll get the Canopy version of python (the "%" just means the command line prompt).

There are probably 1-2 packages that Canopy does not have that you'll need for PsychoPy. Just install them using pip if enpkg does not work. If you want to use pyo for sound, you'll need to download it from http://code.google.com/p/pyo/

a.2: Non-Enthought version of python: not sure, never done it. If you go this route, you'll need to install quite a few dependencies not just python itself, including numpy, matplotlib, wx, and so on. See dependencies here: http://psychopy.org/installation.html#dependencies

b) git: Any recent version of git should be fine, from http://git-scm.com/downloads I use gitgui a lot as part of my workflow. It nicely highlights all code changes project-wide for review prior to making a commit. Very handy.

Making a github account should be well documented on github. Forking PsychoPy within github is easy, something like clicking a button. Then working on your laptop, make a clone using the git@github format (otherwise I think you get a read-only clone, and can't push your changes back to github).

I have a directory /Users/jgray/code/ and keep various projects in here. Inside code/, in a terminal window:

Now in this new local repo (on your laptop), its nice to tell it to consider github's psychopy/psychopy as being upstream. There are a couple ways to do this, I think one is to somehow use a -u option the first time you push to your origin. But there's another way if you forget to use -u, and I always forget the second way. Actually, it might be possible to edit your .git/config file so that it has this--I've never tried editing directly to look like this:

Optional configuration:

I have a shell alias to make it easier to view log info from the command line. I only use it once in a while but its handy:

And somehow I set it up so that if I type "git mergetool" it will launch opendiff to help resolve a merge conflict. Its really nice to have a big graphical display for wrangling merge conflicts.

c) Code editors. There are lots! spyder is good, comes with Canopy I am pretty sure.

d) Ease of use:

d.1: make an alias for starting your dev version of PsychoPy. I define an alias in my .login file (tcsh) or .bash_ profile, so that I can just type "pp" and launch the app:

d.2: Tell your new python where to find your new local dev version of psychopy.

Copy and paste the first part, so you can cd to the Current directory:

Then go to site-packages:

And make a .pth file for the cloned version of PsychoPy, which for me looks like this:

d.3:

For making small commits, typically its fine to commit them to your master branch locally, push your local master to your origin master (git push origin master), and then submit a pull request. Advanced usage: If you are doing several conceptually different commits within a short time frame (i.e., faster than Jon can review and pull them in), its probably a good idea to work in separate branches (= as recommended by github), and when ready, request that the branch be pulled into psychopy master. This keeps things tidier, and easier for Jon to work with.

Probably most people don't need this, at least not to get started, but in the interests of having a dev guide we might as well include this:

e) Being able to compile C / C++ code:

Linux: it might be as easy as "sudo apt-get install gcc" (for debian based) or "sudo yum install gcc" (for RHEL), but there might be more to it. I seem to recall that you might need to also install the kernel headers?

Mac: first install XQuartz: http://xquartz.macosforge.org/landing/ Then through App store, install Xcode. From within Xcode, go to preferences > download > and install the command line tools. (This last step gives you gcc, and also svn and some other things, but not git.)

Finally, making the following hardlink let me compile some things that otherwise would not compile:

Windows: no idea, sorry!