Closed bast closed 4 years ago
i can look into that. if possible, it would be good to have a single framework for all dftlibs projects, so @bast are you sticking to cffi for numgrid ?
I vote for pybind11.
On Dec 19, 2017 16:09, "Andre Gomes" notifications@github.com wrote:
i can look into that. if possible, it would be good to have a single framework for all dftlibs projects, so @bast https://github.com/bast are you sticking to cffi for numgrid ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dftlibs/xcfun/issues/44#issuecomment-352786271, or mute the thread https://github.com/notifications/unsubscribe-auth/ADiXEb5HzA9kYxN1LByifP4WHWim1eA2ks5tB9GvgaJpZM4RHFz7 .
thanks for speaking out @robertodr . @bast @chjacob-tubs and others interested in python bindings, can you speak your mind ?
To motivate a bit. In my opinion (and I've mentioned this to @bast before) CFFI really shines when you have a C or Fortran code that you want to expose to Python. Since XCFun is C++, I think it's more appropriate and beneficial to jump to C++11 (required by pybind11) and base the Python API on the C++ API, rather than on the C flattening of it. Advantages of pybind11 are:
So, to conclude: I think the code should have a main C++ API to which the API for other languages are bound and modelled on. The C API should be the trampoline for a native Fortran API, not the main gig.
On Dec 19, 2017 16:28, "Andre Gomes" notifications@github.com wrote:
thanks for speaking out @robertodr https://github.com/robertodr . @bast https://github.com/bast @chjacob-tubs https://github.com/chjacob-tubs and others interested in python bindings, can you speak your mind ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dftlibs/xcfun/issues/44#issuecomment-352792121, or mute the thread https://github.com/notifications/unsubscribe-auth/ADiXEa8DitC2mOsHG5PiSNFAMvNVQuPnks5tB9YRgaJpZM4RHFz7 .
I agree that here pybind11 is probably the best way. I like CFFI for projects that use a C interface. The question for me boils down to whether we wish to expose a C++ interface. If yes, then pybind11. If not, then CFFI. But before we do anything we need to reactivate the current Python interface and add tests to it (#43).
Don't know whether you plan to port xcfun to PyPI. If so, CFFI is probably better. The pybind11 dependence is quite difficult to solve.
My plan is to distribute the code also via PyPI. Why is the pybind11 dependence a problem? [I have never tried to distribute pybind11 code via PyPI]
I may be wrong. pybind11 is available on PyPI. Just a suggestion to consider before choosing the technique.
I am happy with everything, just keep me in the loop so I can test it with PyADF / PyEmbed
Closing, as we moved to pybind11 with #96 The deployment to PyPI is still not a thing, but I have been looking at deploying on Anaconda cloud (conda-forge/staged-recipes#10347) with mixed success, so far.
In my opinion SWIG is not the optimal framework. CFFI and pybind11 are more lightweight IMO.