- edited description
Switch from SWIG to pybind11 for Python binding
The SWIG wrappers have become very complicated over time, and few (if any) developers understand them. They are also a barrier for new contributors. Getting the SWIG wrapping to work properly is often the hardest part of any new development. Complexity of the wrapping has also lead to interface inconsistencies because it can be difficult to get SWIG to wrap as one would like.
The SWIG wrapping is also a performance bottleneck for JIT.
A transition to using http://pybind11.readthedocs.io/ has started. pybind11 is C++ (no 3rd language to master), compact and is designed to interface with STL objects, NumPy and Eigen. Unlike SWIG, it requires hand-wrapping of functions. However, number of lines of hand-wrapped pybind11 is will be fewer than the SWIG hand-coded boilerplate.
It will be possible to build and install the Python interface using setuptools. This provides a clear separation between the DOLFIN C++ library and the Python interface, which is a simplification and has packaging advantages.
See also #859.
Comments (5)
-
reporter -
reporter - changed milestone to 2018.1
-
reporter Here's the plan:
- We shortly copy the
python/
directory in thepybind11
branch intomaster
. - We add with/without pybind11 decorators to the unit tests, and start running the unit tests with pybind11 on CircleCI (Python 3 only).
- We run the demos that work with pybind11 on CircleCI (Python 3 only)
- The owners of specialised demos, i.e. multimesh, take care of updates in the pybind11 interface.
- After the 2017.2 release, we delete the SWIG code and retire Instant.
The pybind11 interface will continue to be improved (especially error handling) and polished, but it will be helpful to merge soon into DOLFIN to avoid the tests drifting away from the DOLFIN
master
branch. - We shortly copy the
-
Hello, is this still the plan for 2018.1 and, if so, when will 2018.1 be released?
-
- changed status to resolved
In master.
- Log in to comment