[ 
https://issues.apache.org/jira/browse/PROTON-2095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17037814#comment-17037814
 ] 

Omer Katz commented on PROTON-2095:
-----------------------------------

Because CFFI works better with PyPy. See 
[https://doc.pypy.org/en/latest/extending.html#cffi] and 
[https://morepypy.blogspot.com/2018/09/inside-cpyext-why-emulating-cpython-c.html].

In the future, the [HPy 
project|[https://morepypy.blogspot.com/2019/12/hpy-kick-off-sprint-report.html]]
 will allow writing C extensions for both CPython & PyPy. It is possible that 
Cython will be able to emit such API calls as well.

However, we can't rely on future promises and more importantly it doesn't seem 
we have a lot of custom C code for the binding and we're simply calling the C 
library so there's no reason to use something as complicated as Cython or 
pybind11.

 

CFFI is good enough and will be easy to use which reduces contribution friction.

> Move away from SWIG to CFFI
> ---------------------------
>
>                 Key: PROTON-2095
>                 URL: https://issues.apache.org/jira/browse/PROTON-2095
>             Project: Qpid Proton
>          Issue Type: Wish
>          Components: python-binding
>    Affects Versions: proton-c-0.29.0, proton-c-future
>            Reporter: Omer Katz
>            Priority: Major
>             Fix For: proton-c-future
>
>
> SWIG is fine but we're not using it for anything other than exporting all of 
> proton-c's API as is.
> Unfortunately SWIG only generates CPython extension bindings. This may be a 
> problem on PyPy where CPython extensions are either slow or simply won't 
> compile.
> Unlike SWIG, CFFI is portable both on CPython and PyPy.
> It also satisfies the same requirements as SWIG currently does.
> In addition, calls to CFFI simply release the GIL which will help 
> parallelizing Python applications using threads.
> By using CFFI we can also get rid of all of our setup.py code and simply use 
> it to build the extension. We will also no longer have problems building 
> wheels.
> The newest version of CFFI supports pkg-config so we can use that to find 
> proton-c easily.
> I'm willing to help with the refactor but I'll need a mentor since I'm not 
> familiar with the code base.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to