begging for pyme name change

Justus Winter justus at g10code.com
Thu Oct 20 09:54:12 CEST 2016


Hello,

Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:
> On Wed 2016-10-19 06:36:37 -0400, James Henstridge wrote:
>> If you do want to reuse the "gpgme" package name, I would appreciate
>> if you could maintain API compatibility to avoid breaking code using
>> my module.
>
> this makes complete sense.

Let's see.  This is pygpgme:

    plaintext = BytesIO(b'Hello World\n')
    ciphertext = BytesIO()
    ctx = gpgme.Context()
    recipient = ctx.get_key('93C2240D6B8AA10AB28F701D2CF46B7FC97E6B0F')
    ctx.encrypt([recipient], gpgme.ENCRYPT_ALWAYS_TRUST,
                plaintext, ciphertext)

This is pyme2:

    c = core.Context()
    c.set_armor(True)
    source = core.Data("Hallo Leute\n")
    sink = core.Data()
    keys = []
    keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
    keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
    c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink)

So the API of gpgme's .encrypt looks very similar to the .op_encrypt one
From pyme2.  With pyme3 I added automatic wrapping of data, so any
object implementing the buffer protocol can be used anywhere libgpgme
expects a gpgme_data_t object.  That should cover BytesIO iirc, and if
it doesn't fit, we could fix that.

Now comes the tricky part.  Pyme2's interface was deemed too unpythonic,
so I created a new interface on top of the old one that was quite
faithful to the C API.  In particular, the 'op_' prefix was perceived as
ugly.  This is how the pyme3 shim looks:

    with pyme.Context(armor=True) as c:
        ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(),
                                     recipients=keys,
                                     sign=False,
                                     always_trust=True)

I don't see how we could make that compatible with pygpgme's .encrypt.

We could ship a 'gpgme' Python module that provides a pygpgme-compatible
API on top of pyme, and keep our 'pyme' Python module where we can
introduce new features.  But maintaining two APIs and shipping two
Python modules in order to take over the name does not make sense.  Even
less so since we still couldn't use the 'gpgme' Python module for the
interface that we want to develop and promote for new users.

I'm not convinced it is worth the effort.

Cheers,
Justus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: </pipermail/attachments/20161020/47ce941f/attachment.sig>


More information about the Gnupg-devel mailing list