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 More information on specific topics can be found on the following pages:
34 :mod:`notmuch` -- The Notmuch interface
35 =================================================
37 .. automodule:: notmuch
39 :todo: Document nmlib,STATUS
41 :class:`notmuch.Database` -- The underlying notmuch database
42 ---------------------------------------------------------------------
44 .. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
46 .. automethod:: create
48 .. automethod:: open(path, status=MODE.READ_ONLY)
50 .. automethod:: get_path
52 .. automethod:: get_version
54 .. automethod:: needs_upgrade
56 .. automethod:: upgrade
58 .. automethod:: get_directory
60 .. automethod:: add_message
62 .. automethod:: remove_message
64 .. automethod:: find_message
66 .. automethod:: get_all_tags
68 .. automethod:: create_query
70 .. note:: :meth:`create_query` was broken in release
71 0.1 and is fixed since 0.1.1.
73 .. attribute:: Database.MODE
75 Defines constants that are used as the mode in which to open a database.
78 Open the database in read-only mode
81 Open the database in read-write mode
83 .. autoattribute:: db_p
85 :class:`notmuch.Query` -- A search query
86 -------------------------------------------------
88 .. autoclass:: notmuch.Query
90 .. automethod:: create
92 .. attribute:: Query.SORT
94 Defines constants that are used as the mode in which to open a database.
97 Sort by message date, oldest first.
100 Sort by message date, newest first.
103 Sort by email message ID.
106 Do not apply a special sort order (returns results in document id
109 .. automethod:: set_sort
113 Instance attribute :attr:`sort` contains the sort order (see
114 :attr:`Query.SORT`) if explicitely specified via
115 :meth:`set_sort`. By default it is set to `None`.
117 .. automethod:: search_threads
119 .. automethod:: search_messages
121 .. automethod:: count_messages
124 :class:`Messages` -- A bunch of messages
125 ----------------------------------------
127 .. autoclass:: Messages
129 .. automethod:: collect_tags
131 .. method:: __len__()
133 .. note:: :meth:`__len__` was removed in version 0.6 as it exhausted
134 the iterator and broke list(Messages()). Use the
135 :meth:`Query.count_messages` function or use
138 :class:`Message` -- A single message
139 ----------------------------------------
141 .. autoclass:: Message
143 .. automethod:: get_message_id
145 .. automethod:: get_thread_id
147 .. automethod:: get_replies
149 .. automethod:: get_filename
151 .. automethod:: get_filenames
156 This flag is automatically set by a
157 Query.search_threads on those messages that match the
158 query. This allows us to distinguish matches from the rest
159 of the messages in that thread.
161 .. automethod:: get_flag
163 .. automethod:: set_flag
165 .. automethod:: get_date
167 .. automethod:: get_header
169 .. automethod:: get_tags
171 .. automethod:: maildir_flags_to_tags
173 .. automethod:: tags_to_maildir_flags
175 .. automethod:: remove_tag
177 .. automethod:: add_tag
179 .. automethod:: remove_all_tags
181 .. automethod:: freeze
185 .. automethod:: format_message_as_json
187 .. automethod:: format_message_as_text
189 .. automethod:: __str__
192 :class:`Tags` -- Notmuch tags
193 -----------------------------
198 .. automethod:: __len__
200 .. automethod:: __str__
203 :class:`notmuch.Threads` -- Threads iterator
204 -----------------------------------------------------
206 .. autoclass:: notmuch.Threads
208 .. automethod:: __len__
210 .. automethod:: __str__
212 :class:`Thread` -- A single thread
213 ------------------------------------
215 .. autoclass:: Thread
217 .. automethod:: get_thread_id
219 .. automethod:: get_total_messages
221 .. automethod:: get_toplevel_messages
223 .. automethod:: get_matched_messages
225 .. automethod:: get_authors
227 .. automethod:: get_subject
229 .. automethod:: get_oldest_date
231 .. automethod:: get_newest_date
233 .. automethod:: get_tags
235 .. automethod:: __str__
238 :class:`Filenames` -- An iterator over filenames
239 ------------------------------------------------
241 .. autoclass:: notmuch.database.Filenames
243 .. automethod:: notmuch.database.Filenames.__len__
245 :class:`notmuch.database.Directoy` -- A directory entry in the database
246 ------------------------------------------------------------------------
248 .. autoclass:: notmuch.database.Directory
250 .. automethod:: notmuch.database.Directory.get_child_files
252 .. automethod:: notmuch.database.Directory.get_child_directories
254 .. automethod:: notmuch.database.Directory.get_mtime
256 .. automethod:: notmuch.database.Directory.set_mtime
258 .. autoattribute:: notmuch.database.Directory.mtime
260 .. autoattribute:: notmuch.database.Directory.path
263 The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.