]> git.notmuchmail.org Git - notmuch/blob - bindings/python/docs/source/index.rst
73d2a3b015454ed97fcd93468b3872648dab8b5f
[notmuch] / bindings / python / docs / source / index.rst
1 .. notmuch documentation master file, created by
2    sphinx-quickstart on Tue Feb  2 10:00:47 2010.
3
4 .. currentmodule:: notmuch
5
6 Welcome to :mod:`notmuch`'s documentation
7 ===========================================
8
9 The :mod:`notmuch` module provides an interface to the `notmuch <http://notmuchmail.org>`_ functionality, directly interfacing to a shared notmuch library.
10 Within :mod:`notmuch`, the classes :class:`Database`, :class:`Query` provide most of the core functionality, returning :class:`Threads`, :class:`Messages` and :class:`Tags`.
11
12 .. moduleauthor:: Sebastian Spaeth <Sebastian@SSpaeth.de>
13
14 :License: This module is covered under the GNU GPL v3 (or later).
15
16 This page contains the main API overview of notmuch |release|. 
17
18 Notmuch can be imported as::
19
20  import notmuch
21
22 or::
23
24  from notmuch import Query, Database
25
26  db = Database('path',create=True)
27  msgs = Query(db,'from:myself').search_messages()
28
29  for msg in msgs:
30     print (msg)
31
32 More information on specific topics can be found on the following pages:
33
34 .. toctree::
35    :maxdepth: 1
36
37    status_and_errors
38    notmuch   
39
40 :mod:`notmuch` -- The Notmuch interface
41 =================================================
42
43 .. automodule:: notmuch
44
45 :class:`notmuch.Database` -- The underlying notmuch database
46 ---------------------------------------------------------------------
47
48 .. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
49
50    .. automethod:: create
51
52    .. automethod:: open(path, status=MODE.READ_ONLY)
53
54    .. automethod:: get_path
55
56    .. automethod:: get_version
57
58    .. automethod:: needs_upgrade
59
60    .. automethod:: upgrade
61
62    .. automethod:: begin_atomic
63
64    .. automethod:: end_atomic
65
66    .. automethod:: get_directory
67
68    .. automethod:: add_message
69
70    .. automethod:: remove_message
71
72    .. automethod:: find_message
73
74    .. automethod:: find_message_by_filename
75
76    .. automethod:: get_all_tags
77
78    .. automethod:: create_query
79
80    .. attribute:: Database.MODE
81
82      Defines constants that are used as the mode in which to open a database.
83
84      MODE.READ_ONLY
85        Open the database in read-only mode
86
87      MODE.READ_WRITE
88        Open the database in read-write mode
89
90    .. autoattribute:: db_p
91
92
93 :class:`notmuch.Query` -- A search query
94 -------------------------------------------------
95
96 .. autoclass:: notmuch.Query
97
98    .. automethod:: create
99
100    .. attribute:: Query.SORT
101
102      Defines constants that are used as the mode in which to open a database.
103
104      SORT.OLDEST_FIRST
105        Sort by message date, oldest first.
106
107      SORT.NEWEST_FIRST
108        Sort by message date, newest first.
109
110      SORT.MESSAGE_ID
111        Sort by email message ID.
112
113      SORT.UNSORTED
114        Do not apply a special sort order (returns results in document id     
115        order). 
116
117    .. automethod:: set_sort
118
119    .. attribute::  sort
120
121       Instance attribute :attr:`sort` contains the sort order (see
122       :attr:`Query.SORT`) if explicitely specified via
123       :meth:`set_sort`. By default it is set to `None`.
124
125    .. automethod:: search_threads
126
127    .. automethod:: search_messages
128
129    .. automethod:: count_messages
130
131
132 :class:`Messages` -- A bunch of messages
133 ----------------------------------------
134
135 .. autoclass:: Messages
136
137    .. automethod:: collect_tags
138
139    .. method:: __len__()
140
141    .. warning:: :meth:`__len__` was removed in version 0.6 as it exhausted
142        the iterator and broke list(Messages()). Use the
143        :meth:`Query.count_messages` function or use
144        `len(list(msgs))`.
145
146 :class:`Message` -- A single message
147 ----------------------------------------
148
149 .. autoclass:: Message
150
151    .. automethod:: get_message_id
152
153    .. automethod:: get_thread_id
154
155    .. automethod:: get_replies
156
157    .. automethod:: get_filename
158
159    .. automethod:: get_filenames
160
161    .. attribute:: FLAG
162
163         FLAG.MATCH 
164           This flag is automatically set by a
165           Query.search_threads on those messages that match the
166           query. This allows us to distinguish matches from the rest
167           of the messages in that thread.
168
169    .. automethod:: get_flag
170
171    .. automethod:: set_flag
172    
173    .. automethod:: get_date
174
175    .. automethod:: get_header
176
177    .. automethod:: get_tags
178
179    .. automethod:: maildir_flags_to_tags
180
181    .. automethod:: tags_to_maildir_flags
182
183    .. automethod:: remove_tag
184
185    .. automethod:: add_tag
186
187    .. automethod:: remove_all_tags
188
189    .. automethod:: freeze
190
191    .. automethod:: thaw
192
193    .. automethod:: format_message_as_json
194
195    .. automethod:: format_message_as_text
196
197    .. automethod:: __str__
198
199
200 :class:`Tags` -- Notmuch tags
201 -----------------------------
202
203 .. autoclass:: Tags
204    :members:
205
206    .. method:: __len__
207
208        .. warning:: :meth:`__len__` was removed in version 0.6 as it
209            exhausted the iterator and broke list(Tags()). Use
210            :meth:`len(list(msgs))` instead if you need to know the
211            number of tags.
212
213    .. automethod:: __str__
214
215
216 :class:`notmuch.Threads` -- Threads iterator
217 -----------------------------------------------------
218
219 .. autoclass:: notmuch.Threads
220
221    .. automethod:: __len__
222
223    .. automethod:: __str__
224
225 :class:`Thread` -- A single thread
226 ------------------------------------
227
228 .. autoclass:: Thread
229
230   .. automethod:: get_thread_id
231
232   .. automethod:: get_total_messages
233
234   .. automethod:: get_toplevel_messages
235
236   .. automethod:: get_matched_messages
237
238   .. automethod:: get_authors
239
240   .. automethod:: get_subject
241
242   .. automethod:: get_oldest_date
243
244   .. automethod:: get_newest_date
245
246   .. automethod:: get_tags
247
248   .. automethod:: __str__
249
250
251 :class:`Filenames` -- An iterator over filenames
252 ------------------------------------------------
253
254 .. autoclass:: notmuch.database.Filenames
255
256    .. automethod:: notmuch.database.Filenames.__len__
257
258 :class:`notmuch.database.Directoy` -- A directory entry in the database
259 ------------------------------------------------------------------------
260
261 .. autoclass:: notmuch.database.Directory
262
263    .. automethod:: notmuch.database.Directory.get_child_files
264
265    .. automethod:: notmuch.database.Directory.get_child_directories
266
267    .. automethod:: notmuch.database.Directory.get_mtime
268
269    .. automethod:: notmuch.database.Directory.set_mtime
270
271    .. autoattribute:: notmuch.database.Directory.mtime
272
273    .. autoattribute:: notmuch.database.Directory.path
274
275
276 The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.
277
278 Indices and tables
279 ==================
280
281 * :ref:`genindex`
282 * :ref:`search`
283