Skip to content
Mayeul d'Avezac edited this page Jun 14, 2013 · 22 revisions

The following is in features/python branch for now

  • The bindings are generated by SWIG
  • Testing is done by behave

SWIG was chosen because it is a fairly popular wrapper language for C/C++. It less verbose than bare-metal C API, and less painful to install than boost::python. Furthermore, it could be used to generate bindings to other languages as well (R, for instance). The interface files will reside in likelihood/python/. It seems CMake has difficulty generating dependency graphs for this tool, so it might mean we must stick to a single file.

behave provides a Behavior Driven Development interface for python. Since python is likely to provide the glue between mechanisms, likelihood, and optimizers, it makes sense to use this " Given A, When B happens, Then C results " testing framework. Currently, features are located in likelihood/python/features, and feature implementations in likelihood/python/features/steps. It is not yet in the cmake testing framework. It needs to be run from the commandline after installation.

> behave /path/to/dcprogs/likelihood/python/features/ 

Python bindings on Windows

As usual, it is a bit more difficult than strictly necessary. I'm currently working with anaconda. CMake has to be told explicitly where to find python:

> cmake -DPYTHON_LIBRARY="C:\Anaconda\python33.dll" `      
>>>     -DPYTHON_EXECUTABLE="C:\Anaconda\python.exe" `
>>>     -DPYTHON_INCLUDE_DIR="C:\Anaconda\include

Or, after installing python 3 with conda:

> cmake -DPYTHON_LIBRARY="C:\Anaconda\envs\py3k\python33.dll" `      
>>>     -DPYTHON_EXECUTABLE="C:\Anaconda\envs\py3k\python.exe" `
>>>     -DPYTHON_INCLUDE_DIR="C:\Anaconda\envs\py3k\include

The above works in the powershell.

Clone this wiki locally