python-snap7
python-snap7 copied to clipboard
switch to CFFI
CFFI is an easier method to create bindings.
It also simplifies the binary wheels creation process, greatly simplifying the installation procedure.
https://cffi.readthedocs.io/en/latest/
Snap7 is written in C++ and not C, this may not work.
From the CFFI Goals:
" There is no C++ support. Sometimes, it is reasonable to write a C wrapper around the C++ code and then call this C API with CFFI. Otherwise, look at other projects. I would recommend cppyy, which has got some similarities (and also works efficiently on both CPython and PyPy)."
I tried out pybind11. I made a small demo and built packages for all platforms (except Windows) using cibuildwheel. You can find the packages here. There are difficulties with the tests, but I think they can be solved. If you find pybind11 suitable, we can try it for the version 2.0.
cool, cool, what do you think yourself? do you find it more suitable than the normal ctypes layer?
Pybind11 + cibuildwheel greatly simplifies packaging workflow. But it requires experience in C++. I have no such experience, so I don't know what pitfalls to expect.
i had good experiences with CFFI, didn't try out pybind11+ yet, so not sure how they compare. I know it is a header-only solution.
We can also try to write a prototype for both with just 2 or 3 basic functions and see how they compare.