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|.
19 More information on specific topics can be found on the following pages:
29 :class:`Database` -- The underlying notmuch database
30 ---------------------------------------------------------------------
32 .. autoclass:: Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
34 .. automethod:: create
36 .. automethod:: open(path, status=MODE.READ_ONLY)
38 .. automethod:: get_path
40 .. automethod:: get_version
42 .. automethod:: needs_upgrade
44 .. automethod:: upgrade
46 .. automethod:: begin_atomic
48 .. automethod:: end_atomic
50 .. automethod:: get_directory
52 .. automethod:: add_message
54 .. automethod:: remove_message
56 .. automethod:: find_message
58 .. automethod:: find_message_by_filename
60 .. automethod:: get_all_tags
62 .. automethod:: create_query
64 .. attribute:: Database.MODE
66 Defines constants that are used as the mode in which to open a database.
69 Open the database in read-only mode
72 Open the database in read-write mode
74 .. autoattribute:: db_p
77 :class:`Query` -- A search query
78 -------------------------------------------------
82 .. automethod:: create
84 .. attribute:: Query.SORT
86 Defines constants that are used as the mode in which to open a database.
89 Sort by message date, oldest first.
92 Sort by message date, newest first.
95 Sort by email message ID.
98 Do not apply a special sort order (returns results in document id
101 .. automethod:: set_sort
105 Instance attribute :attr:`sort` contains the sort order (see
106 :attr:`Query.SORT`) if explicitely specified via
107 :meth:`set_sort`. By default it is set to `None`.
109 .. automethod:: search_threads
111 .. automethod:: search_messages
113 .. automethod:: count_messages
115 .. automethod:: count_threads
118 :class:`Messages` -- A bunch of messages
119 ----------------------------------------
121 .. autoclass:: Messages
123 .. automethod:: collect_tags
125 .. method:: __len__()
129 :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke
130 list(Messages()). Use the :meth:`Query.count_messages` function or use `len(list(msgs))`.
132 :class:`Message` -- A single message
133 ----------------------------------------
135 .. autoclass:: Message
137 .. automethod:: get_message_id
139 .. automethod:: get_thread_id
141 .. automethod:: get_replies
143 .. automethod:: get_filename
145 .. automethod:: get_filenames
150 This flag is automatically set by a
151 Query.search_threads on those messages that match the
152 query. This allows us to distinguish matches from the rest
153 of the messages in that thread.
155 .. automethod:: get_flag
157 .. automethod:: set_flag
159 .. automethod:: get_date
161 .. automethod:: get_header
163 .. automethod:: get_tags
165 .. automethod:: maildir_flags_to_tags
167 .. automethod:: tags_to_maildir_flags
169 .. automethod:: remove_tag
171 .. automethod:: add_tag
173 .. automethod:: remove_all_tags
175 .. automethod:: freeze
179 .. automethod:: format_message_as_json
181 .. automethod:: format_message_as_text
183 .. automethod:: __str__
186 :class:`Tags` -- Notmuch tags
187 -----------------------------
196 :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke
197 list(Tags()). Use :meth:`len(list(msgs))` instead if you need to know the number of
200 .. automethod:: __str__
203 :class:`Threads` -- Threads iterator
204 -----------------------------------------------------
206 .. autoclass:: 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:: Filenames
243 .. automethod:: Filenames.__len__
245 .. automethod:: Filenames.as_generator
247 :class:`Directoy` -- A directory entry in the database
248 ------------------------------------------------------------------------
250 .. autoclass:: Directory
252 .. automethod:: Directory.get_child_files
254 .. automethod:: Directory.get_child_directories
256 .. automethod:: Directory.get_mtime
258 .. automethod:: Directory.set_mtime
260 .. autoattribute:: Directory.mtime
262 .. autoattribute:: Directory.path
265 The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.