]> git.cworth.org Git - notmuch-wiki/blob - bindings.mdwn
News for release 0.38.3
[notmuch-wiki] / bindings.mdwn
1 [[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
2 # Notmuch Language Bindings [DRAFT]
3
4 The Notmuch library, `libnotmuch`, can be used from many programming
5 languages using the Notmuch language bindings. The [command line
6 interface](https://notmuchmail.org/doc/latest/man1/notmuch.html) and
7 the [[email clients and frontends|frontends]] are based on the
8 language bindings.
9
10 [[!toc levels=2]]
11
12 ## C and C++
13
14 `libnotmuch` is a shared C library. [The API](https://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/notmuch.h)
15
16 The Notmuch command-line interface is based on the C library.
17
18 ## Python
19
20 Notmuch includes Python bindings to the Notmuch shared library. Please refer to
21 the nice and extensive [Notmuch Python API
22 documentation](http://notmuch.readthedocs.org/projects/notmuch-python/).
23
24 The bindings are very simple to use. As an example, given you have the Python
25 bindings installed (or simply set your PYTHONPATH environment variable to point
26 to the .../bindings/python directory), this snippet will produce a list of mails
27 matching the given expression:
28
29         >>> import notmuch
30         >>> db = notmuch.Database()
31         >>> query = db.create_query('tag:inbox AND NOT tag:killed')
32         >>> list(query.search_messages()) # doctest:+ELLIPSIS
33         [...]
34
35 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/bindings/python/)
36
37 ## Ruby
38
39 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/bindings/ruby/)
40
41 The [client for
42 vim](https://git.notmuchmail.org/git/notmuch/blob/HEAD:/vim/README) is in Ruby,
43 so worth a look.
44
45 ## Go
46
47 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/contrib/go/)