Feature #1245

Envelope task #424: === PythonAPI ===

Investigate alternative Python API generation (for c++11)

Added by herck over 4 years ago. Updated almost 4 years ago.

Status:ArchivedStart date:11 Nov 2015
Priority:NormalDue date:
Assignee:jmfisher% Done:

0%

Category:-
Target version:Sprint 31

Description

The current implementation of the Python bindings does not allow us to use many c++11 features, as these cannot be interpreted by gccxml.
One of the alternatives might be pybind11, a lightweight replacement of Boost Python, in combination with a code generator.

History

#1 Updated by wuttke over 4 years ago

  • Parent task set to #1285

#2 Updated by pospelov over 4 years ago

  • Status changed from Backlog to Sprint
  • Target version set to Sprint 31

#3 Updated by jmfisher over 4 years ago

Created new branch "swig-bindings" off 1.5 release, replacing Py++ by SWIG. Functional tests are at 98% pass, with only 3 tests which fail. I expect to be able to fix the remaining failures within a day or two. I have created many examples of SWIG usage in the sc-intern repository, under technologies/python-bindings/swig directory.

#4 Updated by herck over 4 years ago

  • Assignee set to jmfisher

#5 Updated by jmfisher over 4 years ago

Latest commit to branch "swig-bindings" now has 100% success rate for 'make check', using SWIG-generated bindings. There is no remaining Py++ generated code. Next step is to investigate Python 3 compatibility.

#6 Updated by jmfisher over 4 years ago

"swig-bindings" branch now uses Python 3. It should be backwards compatible with Python 2.7, but this hasn't been fully automated yet (it requires some manual tweaking of the cmake scripts).

#7 Updated by jmfisher over 4 years ago

cmake script now defaults to Python 2.7, unless BORNAGAIN_USE_PYTHON3 is defined TRUE, in which case it will look for Python 3.5. This works fine under Linux (at least on my machine), but is probably broken on Windows and MacOS without some additional tweaking to the cmake scripts. All of the scripts in the functional tests have been edited to be simultaneously compatible with both Python 2.7 and Python 3.5, using the future module. The swig-bindings branch is now completely independent of boost::python, except for GUI/externals/qt-manhattan-style/module2.cpp

#8 Updated by jmfisher about 4 years ago

boost::python is now completely eliminated from the code. SWIG bindings now incorporate doxygen comments automatically.

#9 Updated by wuttke about 4 years ago

  • Parent task deleted (#1285)

When new solution is stable, then please update or replace the wiki page http://apps.jcns.fz-juelich.de/redmine/projects/bornagain/wiki/Python_bindings

#10 Updated by wuttke about 4 years ago

  • Parent task set to #424

#11 Updated by jmfisher about 4 years ago

swig-bindings has been merged into develop. Seems to be working fine under Linux (even with Python 3 support) but the build will probably fail under Mac/Windows without additional modification to cmake scripts.

#12 Updated by jmfisher about 4 years ago

Updated the wiki with instructions for generating Swig bindings and adding new classes to the Python modules. Also included some tips and comments regarding the most common problems I encountered while working on the Swig interface files.

#13 Updated by jmfisher about 4 years ago

  • Status changed from Sprint to Resolved

#14 Updated by herck almost 4 years ago

  • Status changed from Resolved to Archived

Also available in: Atom PDF