python bindings for libassuan

Brian Minton brian at minton.name
Fri May 8 21:58:13 CEST 2015


https://docs.python.org/2/library/ctypes.html#callback-functions
Looks like  calling a Python function from a C callback is possible.

On Fri, May 8, 2015 at 3:25 PM, Daniel Kahn Gillmor
<dkg at fifthhorseman.net> wrote:
> On Fri 2015-05-08 14:57:48 -0400, Ben McGinnes wrote:
>> I strongly suspect that wiping the slate clean and writing a "proper"
>> Python driven API, as Werner suggested, would've had to be done
>> anyway.  Doing all that as C-API modules, however, is a ridiculously
>> mammoth undertaking, so in that case something which lends itself a
>> little more towards a reasonable development timeframe is far more
>> likely.
>
> As you've seen, the approach i took was to make a plausible stab at a
> python mapping to the underlying C library via the C-API, and then write
> a bit more sensible/pythonic type stuff in python around that core.
>
>> The two options currently under consideration are Cython and CFFI,
>> even though neither are part of the standard library.
>
> I don't know anytihng about these approaches, i'm afraid i'm a bit of a
> python newbie.
>
> I've looked at SWIG, and agree that the interfaces it produces by
> default look scary and non-pythonic for libraries like libassuan.
>
>> At this point I think Python should be well on the way to getting most
>> people away from 2.7 and really leaving it just to those few legacy
>> deployments that can't shift for whatever reason.  The rest of us can
>> enjoy the 21st century.
>
> :)
>
>> I also have your first patch for you if there's somewhere I can push
>> it to.  It's not much, just a more pythonic way of specifying the
>> homedir in assuan/gnupg.py.  The relevant bits are attached.
>
> Thanks, applied and pushed.
>
> If you send your patches as produced via "git format-patch" (or even
> easier, sent via "git send-email") then they're easier for me to apply
> directly, rather than sending the log and the patch as separate
> attachments.
>
> Regards,
>
>         --dkg
>
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel



More information about the Gnupg-devel mailing list