-
Notifications
You must be signed in to change notification settings - Fork 7
Generating Python Bindings
Python bindings are distributed on GitHub/SynBioDex in the PySBOL repository. Users can install the package by cloning the repo and running the setup script, which requires setuptools and installs a Python egg locally, or users can uses pip to install Python wheels.
Python bindings are built by compiling libSBOL with CMake flags SBOL_BUILD_PYTHON2 or SBOL_BUILD_PYTHON3 set to TRUE. A project folder specific to a certain platform and architecture is generated in the libSBOL release directory (e.g., Win_64_2 or Mac_64_2). This project folder matches exactly the folder structure in the pySBOL repository. Simply copy this entire folder over into the pySBOL repository. Double-check that version number is updated in libsbol/wrapper/init.py before building a bunch of distributions!
Generating Python bindings are explained elsewhere in the user documentation. However, one thing to look out for on MacOSX is inadvertently linking non-system libraries. On MacOSX, it is not unusual for many different versions of a library to reside in different folders of your machine. This is because other packages such as Anaconda may include their own copies of these libraries. The CMake modules which automatically locate dependencies are not always smart about how they locate these dependencies. For example, sometimes they locate a library in one directory while locating the header files for a completely different version of the library elsewhere on the machine. To prevent this, you may need to explicitly specify the location of the default system libraries. For example:
cmake -DSBOL_BUILD_PYTHON3=TRUE -DCURL_LIBRARY=/usr/lib/libcurl.dylib -DCURL_INCLUDE_DIR=/usr/lib/curl -DLIBXSLT_LIBRARIES=/usr/lib/libxslt.dylib -DLIBXSLT_INCLUDE_DIR=/usr/lib/libxslt
cmake -DSBOL_BUILD_PYTHON3=TRUE -DCURL_LIBRARY=/usr/lib/libcurl.dylib -DCURL_INCLUDE_DIR=/usr/lib/curl -DLIBXSLT_LIBRARIES=/usr/lib/libxslt.dylib -DLIBXSLT_INCLUDE_DIR=/usr/lib/libxslt -DPYTHON_LIBRARY=/Users/bryan/anaconda/lib/libpython3.5m.dylib -DPYTHON_INCLUDE_DIR=/Users/bryan/anaconda/include/python3.5m