]> 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](https://notmuchmail.org/doc/latest/python-bindings.html).
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         >>> from notmuch2 import Database
30         >>> db = Database()
31         >>> messages = list(db.messages('tag:inbox AND NOT tag:killed'))
32         [...]
33
34 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/bindings/python-cffi/)
35
36 ## Ruby
37
38 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/bindings/ruby/)
39
40 The [client for
41 vim](https://git.notmuchmail.org/git/notmuch/blob/HEAD:/vim/README) is in Ruby,
42 so worth a look.
43
44 ## Go
45
46 [The source](https://git.notmuchmail.org/git/notmuch/tree/HEAD:/contrib/go/)