1 Return-Path: <bgamari@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 5A154431FBC
\r
6 for <notmuch@notmuchmail.org>; Wed, 30 Dec 2009 08:10:40 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id 3TuFB+uMXKvA for <notmuch@notmuchmail.org>;
\r
11 Wed, 30 Dec 2009 08:10:39 -0800 (PST)
\r
12 Received: from qw-out-1920.google.com (qw-out-1920.google.com [74.125.92.149])
\r
13 by olra.theworths.org (Postfix) with ESMTP id 419A6431FAE
\r
14 for <notmuch@notmuchmail.org>; Wed, 30 Dec 2009 08:10:39 -0800 (PST)
\r
15 Received: by qw-out-1920.google.com with SMTP id 5so2079109qwc.32
\r
16 for <notmuch@notmuchmail.org>; Wed, 30 Dec 2009 08:10:35 -0800 (PST)
\r
17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
18 h=domainkey-signature:received:received:content-type:subject:from:to
\r
19 :in-reply-to:references:date:message-id:user-agent
\r
20 :content-transfer-encoding;
\r
21 bh=MvpQ/MeNo7Irv5MeYzTEXHmbI8Vv79zq2121dCgIQcc=;
\r
22 b=M4dJtNKkTtcCPrtcl7aoJx4S3jd66/T8klY4zLCsHOIozfeKCuX4vkHRIz/g3y8SLA
\r
23 H/j1AXXDgOKNHT1Lyc1YxpxN8zsG1LzpRxKg8JXWGaZHJzcXVfL1rbd0D+EFke9NEzdA
\r
24 ycD4vKcgEJO1zGrwDwu6BLplpkDAgmr8xu3Ps=
\r
25 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
26 h=content-type:subject:from:to:in-reply-to:references:date:message-id
\r
27 :user-agent:content-transfer-encoding;
\r
28 b=t5S04f//g+RGJIuIlfu39h/htW/o+dw4i7QAcGjnqK2qB/iSwsGj1Jtsg+1rYtSfF/
\r
29 yh6TSHGNPdPRm18pMagsb31MHmzHWxm4ujt7rFYfROmoF14YyuhL9dckQUCA47ySwt6O
\r
30 76tE7BlfWLrnYH26ZHB+Rwg4XLpKAEh/zPhRw=
\r
31 Received: by 10.224.87.197 with SMTP id x5mr8763448qal.272.1262189435127;
\r
32 Wed, 30 Dec 2009 08:10:35 -0800 (PST)
\r
33 Received: from localhost (c-24-61-223-13.hsd1.nh.comcast.net [24.61.223.13])
\r
34 by mx.google.com with ESMTPS id 21sm12233142qyk.12.2009.12.30.08.10.33
\r
35 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
36 Wed, 30 Dec 2009 08:10:33 -0800 (PST)
\r
37 Content-Type: text/plain; charset=UTF-8
\r
38 From: Ben Gamari <bgamari@gmail.com>
\r
39 To: notmuch <notmuch@notmuchmail.org>
\r
40 In-reply-to: <20091230115223.1b3472a1@hikari>
\r
41 References: <1262078148-sup-7891@ben-laptop> <20091230115223.1b3472a1@hikari>
\r
42 Date: Wed, 30 Dec 2009 11:10:31 -0500
\r
43 Message-Id: <1262188858-sup-2372@ben-laptop>
\r
45 Content-Transfer-Encoding: 8bit
\r
46 Subject: Re: [notmuch] SWIG (and particularly Python) bindings
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.12
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Wed, 30 Dec 2009 16:10:40 -0000
\r
61 Excerpts from Adrian Perez de Castro's message of Wed Dec 30 05:52:23 -0500 2009:
\r
62 > On Tue, 29 Dec 2009 04:16:43 -0500, Ben wrote:
\r
64 > > Regardless, I thought it might be nice to have access to the notmuch
\r
65 > > backend from a language other than C (preferably my high-level language
\r
66 > > of choice, python) [...]
\r
68 > Funny, I was just doing the same: a Python binding. Haha, so now we have
\r
69 > two just-backed Python bindings. What should we do?
\r
71 Heh, it's a small world, eh?
\r
74 > > [...] To this end, I took a few hours today acquainting
\r
75 > > myself with SWIG and produced these bindings for Python. Unfortunately,
\r
76 > > it doesn't appear that SWIG has particularly good support for
\r
77 > > object-oriented C [...]
\r
79 > I already used SWIG sometimes in the past (and did not like it a lot), so
\r
80 > my binding is using Cython [*] (which is exactly like Pyrex plus some extra
\r
81 > features), so the binding is partly manual.
\r
83 I liked that SWIG would give us coverage for a multitude of languages
\r
84 with little work. Unfortunately, getting an object oriented interface
\r
85 requires wrapping the functions exposed by SWIG. Nevertheless, I think
\r
86 being able to generically hide the ugliness of the binding glue itself
\r
87 is quite nice. Moveover, there's effectively no SWIG interface code to
\r
88 maintain. It's literally just a [#%]include "notmuch.h". The rest is
\r
89 all the Python wrapper. This seems like a nice binding model, short of
\r
90 SWIG doing everything (the developers at some point might add support
\r
91 for proper wrapping of object-oriented C code).
\r
93 > > While the bindings are currently in the form of a patch to notmuch
\r
94 > > (creating a top-level swig directory in the source tree), they could
\r
95 > > certainly be moved out-of-tree if the powers that be don't feel it
\r
96 > > appropriate to include them. [...]
\r
98 > Same here, see attached patch. It is currently unfinished, and I was just
\r
99 > about to add support for iterating notmuch_threads_t and other similar
\r
100 > structures. I can also publish a Git repo with the entire branch, just
\r
101 > drop me a line if you want me to do that.
\r
103 In my approach, I just used the iterator protocol.
\r
105 > > [...] Unfortunately, the build system is currently almost entirely
\r
106 > > independent from the notmuch build system. If these are to be
\r
107 > > included in-tree, I would be curious to hear people have
\r
108 > > to say about how we might integrate it into the sup build system.
\r
110 > (Mmmh, I suppose you mean "notmuch build system" there :P)
\r
115 > Mine is a little more cooked, as I have added a distutils "setup.py"
\r
116 > script. The bad news is that Python modules need to be compiled as
\r
117 > relocatable object files (-fPIC to teh rescue!), and the linker will
\r
118 > refuse to link the generated code with "notmuch.a" -- so I am instructing
\r
119 > distutils to compile *all* sources again. Not nice.
\r
121 In my patch I simple I modified the LDFLAGS to include -fPIC. Not sure if
\r
122 that's an acceptable option or not.
\r
124 > BTW, I think that if more bindings start to appear, Notmuch might be built
\r
125 > as a shared library, to avoid duplicating it everywhere. One option may be
\r
126 > using *just* libtool but not the rest of auto-foo tools (for the record:
\r
127 > I agree with Carl that they are slow and wicked).
\r
129 I think you're probably right. Libtool is probably the best option here
\r
130 (Despite the fact that I, too, have a bitter hatred of autotools).
\r