]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/docs/source/index.rst
python: strip module prefix in the sphinx documentation
[notmuch] / bindings / python / docs / source / index.rst
index c90492c8b674ce99a7683c42c8d1fc4f66881548..fc3179b46196067d4cf6104c06f1b00c4494639d 100644 (file)
@@ -13,7 +13,7 @@ Within :mod:`notmuch`, the classes :class:`Database`, :class:`Query` provide mos
 
 :License: This module is covered under the GNU GPL v3 (or later).
 
-This page contains the main API overview of notmuch |release|. 
+This page contains the main API overview of notmuch |release|.
 
 Notmuch can be imported as::
 
@@ -21,26 +21,31 @@ Notmuch can be imported as::
 
 or::
 
- from notmuch import Query,Database
+ from notmuch import Query, Database
+
+ db = Database('path',create=True)
+ msgs = Query(db,'from:myself').search_messages()
+
+ for msg in msgs:
+    print (msg)
 
 More information on specific topics can be found on the following pages:
 
 .. toctree::
    :maxdepth: 1
 
-   notmuch   
+   status_and_errors
+   notmuch
 
 :mod:`notmuch` -- The Notmuch interface
 =================================================
 
 .. automodule:: notmuch
 
-:todo: Document nmlib,STATUS
-
-:class:`notmuch.Database` -- The underlying notmuch database
+:class:`Database` -- The underlying notmuch database
 ---------------------------------------------------------------------
 
-.. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
+.. autoclass:: Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
 
    .. automethod:: create
 
@@ -54,6 +59,10 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: upgrade
 
+   .. automethod:: begin_atomic
+
+   .. automethod:: end_atomic
+
    .. automethod:: get_directory
 
    .. automethod:: add_message
@@ -62,13 +71,12 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: find_message
 
+   .. automethod:: find_message_by_filename
+
    .. automethod:: get_all_tags
 
    .. automethod:: create_query
 
-   .. note:: :meth:`create_query` was broken in release
-             0.1 and is fixed since 0.1.1.
-
    .. attribute:: Database.MODE
 
      Defines constants that are used as the mode in which to open a database.
@@ -81,10 +89,11 @@ More information on specific topics can be found on the following pages:
 
    .. autoattribute:: db_p
 
-:class:`notmuch.Query` -- A search query
+
+:class:`Query` -- A search query
 -------------------------------------------------
 
-.. autoclass:: notmuch.Query
+.. autoclass:: Query
 
    .. automethod:: create
 
@@ -99,7 +108,11 @@ More information on specific topics can be found on the following pages:
        Sort by message date, newest first.
 
      SORT.MESSAGE_ID
-       Sort by email message ID
+       Sort by email message ID.
+
+     SORT.UNSORTED
+       Do not apply a special sort order (returns results in document id
+       order).
 
    .. automethod:: set_sort
 
@@ -115,6 +128,8 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: count_messages
 
+   .. automethod:: count_threads
+
 
 :class:`Messages` -- A bunch of messages
 ----------------------------------------
@@ -123,7 +138,12 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: collect_tags
 
-   .. automethod:: __len__
+   .. method:: __len__()
+
+   .. warning::
+
+      :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke
+      list(Messages()). Use the :meth:`Query.count_messages` function or use `len(list(msgs))`.
 
 :class:`Message` -- A single message
 ----------------------------------------
@@ -138,24 +158,30 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: get_filename
 
+   .. automethod:: get_filenames
+
    .. attribute:: FLAG
 
-        FLAG.MATCH 
+        FLAG.MATCH
           This flag is automatically set by a
          Query.search_threads on those messages that match the
          query. This allows us to distinguish matches from the rest
          of the messages in that thread.
 
-  .. automethod:: get_flag
+   .. automethod:: get_flag
 
    .. automethod:: set_flag
-   
+
    .. automethod:: get_date
 
    .. automethod:: get_header
 
    .. automethod:: get_tags
 
+   .. automethod:: maildir_flags_to_tags
+
+   .. automethod:: tags_to_maildir_flags
+
    .. automethod:: remove_tag
 
    .. automethod:: add_tag
@@ -166,7 +192,9 @@ More information on specific topics can be found on the following pages:
 
    .. automethod:: thaw
 
-   .. automethod:: format_as_text
+   .. automethod:: format_message_as_json
+
+   .. automethod:: format_message_as_text
 
    .. automethod:: __str__
 
@@ -177,15 +205,21 @@ More information on specific topics can be found on the following pages:
 .. autoclass:: Tags
    :members:
 
-   .. automethod:: __len__
+   .. method:: __len__
+
+       .. warning::
+
+            :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke
+            list(Tags()). Use :meth:`len(list(msgs))` instead if you need to know the number of
+            tags.
 
    .. automethod:: __str__
 
 
-:class:`notmuch.Threads` -- Threads iterator
+:class:`Threads` -- Threads iterator
 -----------------------------------------------------
 
-.. autoclass:: notmuch.Threads
+.. autoclass:: Threads
 
    .. automethod:: __len__
 
@@ -220,53 +254,31 @@ More information on specific topics can be found on the following pages:
 :class:`Filenames` -- An iterator over filenames
 ------------------------------------------------
 
-.. autoclass:: notmuch.database.Filenames
-
-   .. automethod:: notmuch.database.Filenames.__len__
+.. autoclass:: Filenames
 
-:class:`notmuch.database.Directoy` -- A directory entry in the database
-------------------------------------------------------------------------
-
-.. autoclass:: notmuch.database.Directory
-
-   .. automethod:: notmuch.database.Directory.get_child_files
-
-   .. automethod:: notmuch.database.Directory.get_child_directories
+   .. automethod:: Filenames.__len__
 
-   .. automethod:: notmuch.database.Directory.get_mtime
+   .. automethod:: Filenames.as_generator
 
-   .. automethod:: notmuch.database.Directory.set_mtime
+:class:`Directoy` -- A directory entry in the database
+------------------------------------------------------------------------
 
-   .. autoattribute:: notmuch.database.Directory.mtime
+.. autoclass:: Directory
 
-   .. autoattribute:: notmuch.database.Directory.path
+   .. automethod:: Directory.get_child_files
 
-:exc:`NotmuchError` -- A Notmuch execution error
-------------------------------------------------
-.. autoexception:: NotmuchError
-   :members:
+   .. automethod:: Directory.get_child_directories
 
-   This execption inherits directly from :exc:`Exception` and is raised on errors during the notmuch execution.
+   .. automethod:: Directory.get_mtime
 
-:class:`STATUS` -- Notmuch operation return status
---------------------------------------------------
+   .. automethod:: Directory.set_mtime
 
-.. data:: STATUS
+   .. autoattribute:: Directory.mtime
 
-  STATUS is a class, whose attributes provide constants that serve as return indicators for notmuch functions. Currently the following ones are defined. For possible return values and specific meaning for each method, see the method description.
+   .. autoattribute:: Directory.path
 
-  * SUCCESS
-  * OUT_OF_MEMORY
-  * READ_ONLY_DATABASE
-  * XAPIAN_EXCEPTION
-  * FILE_ERROR
-  * FILE_NOT_EMAIL
-  * DUPLICATE_MESSAGE_ID
-  * NULL_POINTER
-  * TAG_TOO_LONG
-  * UNBALANCED_FREEZE_THAW
-  * NOT_INITIALIZED
 
+The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.
 
 Indices and tables
 ==================