1 .. notmuch documentation master file, created by
2 sphinx-quickstart on Tue Feb 2 10:00:47 2010.
4 .. currentmodule:: notmuch
6 Welcome to :mod:`notmuch`'s documentation
7 ===========================================
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`.
12 .. moduleauthor:: Sebastian Spaeth <Sebastian@SSpaeth.de>
14 :License: This module is covered under the GNU GPL v3 (or later).
16 This page contains the main API overview of notmuch |release|.
18 Notmuch can be imported as::
24 from notmuch import Query, Database
26 db = Database('path',create=True)
27 msgs = Query(db,'from:myself').search_messages()
32 More information on specific topics can be found on the following pages:
40 :mod:`notmuch` -- The Notmuch interface
41 =================================================
43 .. automodule:: notmuch
45 :class:`notmuch.Database` -- The underlying notmuch database
46 ---------------------------------------------------------------------
48 .. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
50 .. automethod:: create
52 .. automethod:: open(path, status=MODE.READ_ONLY)
54 .. automethod:: get_path
56 .. automethod:: get_version
58 .. automethod:: needs_upgrade
60 .. automethod:: upgrade
62 .. automethod:: begin_atomic
64 .. automethod:: end_atomic
66 .. automethod:: get_directory
68 .. automethod:: add_message
70 .. automethod:: remove_message
72 .. automethod:: find_message
74 .. automethod:: find_message_by_filename
76 .. automethod:: get_all_tags
78 .. automethod:: create_query
80 .. attribute:: Database.MODE
82 Defines constants that are used as the mode in which to open a database.
85 Open the database in read-only mode
88 Open the database in read-write mode
90 .. autoattribute:: db_p
93 :class:`notmuch.Query` -- A search query
94 -------------------------------------------------
96 .. autoclass:: notmuch.Query
98 .. automethod:: create
100 .. attribute:: Query.SORT
102 Defines constants that are used as the mode in which to open a database.
105 Sort by message date, oldest first.
108 Sort by message date, newest first.
111 Sort by email message ID.
114 Do not apply a special sort order (returns results in document id
117 .. automethod:: set_sort
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`.
125 .. automethod:: search_threads
127 .. automethod:: search_messages
129 .. automethod:: count_messages
132 :class:`Messages` -- A bunch of messages
133 ----------------------------------------
135 .. autoclass:: Messages
137 .. automethod:: collect_tags
139 .. method:: __len__()
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
146 :class:`Message` -- A single message
147 ----------------------------------------
149 .. autoclass:: Message
151 .. automethod:: get_message_id
153 .. automethod:: get_thread_id
155 .. automethod:: get_replies
157 .. automethod:: get_filename
159 .. automethod:: get_filenames
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.
169 .. automethod:: get_flag
171 .. automethod:: set_flag
173 .. automethod:: get_date
175 .. automethod:: get_header
177 .. automethod:: get_tags
179 .. automethod:: maildir_flags_to_tags
181 .. automethod:: tags_to_maildir_flags
183 .. automethod:: remove_tag
185 .. automethod:: add_tag
187 .. automethod:: remove_all_tags
189 .. automethod:: freeze
193 .. automethod:: format_message_as_json
195 .. automethod:: format_message_as_text
197 .. automethod:: __str__
200 :class:`Tags` -- Notmuch tags
201 -----------------------------
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
213 .. automethod:: __str__
216 :class:`notmuch.Threads` -- Threads iterator
217 -----------------------------------------------------
219 .. autoclass:: notmuch.Threads
221 .. automethod:: __len__
223 .. automethod:: __str__
225 :class:`Thread` -- A single thread
226 ------------------------------------
228 .. autoclass:: Thread
230 .. automethod:: get_thread_id
232 .. automethod:: get_total_messages
234 .. automethod:: get_toplevel_messages
236 .. automethod:: get_matched_messages
238 .. automethod:: get_authors
240 .. automethod:: get_subject
242 .. automethod:: get_oldest_date
244 .. automethod:: get_newest_date
246 .. automethod:: get_tags
248 .. automethod:: __str__
251 :class:`Filenames` -- An iterator over filenames
252 ------------------------------------------------
254 .. autoclass:: notmuch.database.Filenames
256 .. automethod:: notmuch.database.Filenames.__len__
258 :class:`notmuch.database.Directoy` -- A directory entry in the database
259 ------------------------------------------------------------------------
261 .. autoclass:: notmuch.database.Directory
263 .. automethod:: notmuch.database.Directory.get_child_files
265 .. automethod:: notmuch.database.Directory.get_child_directories
267 .. automethod:: notmuch.database.Directory.get_mtime
269 .. automethod:: notmuch.database.Directory.set_mtime
271 .. autoattribute:: notmuch.database.Directory.mtime
273 .. autoattribute:: notmuch.database.Directory.path
276 The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.