aboutsummaryrefslogtreecommitdiff
path: root/bindings/python-cffi/notmuch2/_database.py
AgeCommit message (Collapse)Author
2025-07-04python/doc: fix link to notmuch-config manpageDavid Bremner
This docstring has been like this a long time, but recently I noticed sphinx-doc complaining about :man:. This :any: link seems to work, and is consistent with the other links to the notmuch-config man page.
2025-06-16bindings/python-cffi: fix typosJakub Wilk
2025-03-29python: make IndexOptions publicJakub Wilk
Database docstrings refer to IndexOptions, so the latter should be public too.
2022-01-09bindings/python-cffi: search for config by defaultDavid Bremner
The previous (pre-0.34.2) constructor searched for a config file but only if the database path was not specified, and only to retrieve database.path. Neither of the available options (CONFIG.SEARCH or CONFIG.NONE) matches this semantics exactly, but CONFIG.SEARCH causes less breakage for people who relied on the old behaviour to set their database.path [1]. Since it also seems like the friendlier option in the long run, this commit switches to CONFIG.SEARCH as default. This requires a certain amount of updating the pytest tests, but most users will actually have a config file, unlike the test environment. [1]: id:87fsqijx7u.fsf@metapensiero.it
2021-12-04python-cffi: switch to notmuch_database_{open,create}_with_configDavid Bremner
Since release 0.32, libnotmuch provides searching for database and configuration paths. This commit changes the python module notmuch2 to use those facilities. This fixes the bug reported in [1], along with a couple of the deprecation warnings in the python bindings. Database.default_path is deprecated, since it no longer faithfully reflects what libnotmuch is doing, and it is also no longer used in the bindings themselves. This commit choose the default of config=CONFIG.EMPTY (equivalent to passing "" to notmuch_database_open_with_config). This makes the change upward compatible API-wise (at least as far as the test suite verifies), but changing the default to CONFIG.SEARCH would probably be more convenient for bindings users. [1]: id:87h7d4wp6b.fsf@tethera.net
2021-12-04python-cffi: fix typos in docstring for Database.default_pathDavid Bremner
These generate warnings from sphinx doc, which makes it harder to debug documentation changes. They also corrupt the output.
2020-12-25python/notmuch2: fix exclude tag handlingJohannes Larsen
A typo in Database._create_query lost the exclude_tag names during the string to utf-8 conversion. Amended by DB: fixed patch format and updated commit message.
2020-08-09Fix typosJonas Bernoulli
2020-06-16Support aborting the atomic contextFloris Bruynooghe
Since it is possible to use an atomic context to abort a number of changes support this usage. Because the only way to actually abort the transaction is to close the database this must also do so. Amended by db: Note the limitation requiring close is a limitation of the underlying notmuch API, which should be fixed in a future notmuch release.
2020-06-16Make messages returned by Thread objects ownedFloris Bruynooghe
This reverses the logic of StandaloneMessage to instead create a OwnedMessage. Only the Thread class allows retrieving messages more then once so it can explicitly create such messages. The added test fails with SIGABRT without the fix for the message re-use in threads being present.
2020-06-16python/notmuch2: do not destroy messages owned by a queryAnton Khirnov
Any messages retrieved from a query - either directly via search_messages() or indirectly via thread objects - are owned by that query. Retrieving the same message (i.e. corresponding to the same message ID / database object) several times will always yield the same C object. The caller is allowed to destroy message objects owned by a query before the query itself - which can save memory for long-lived queries. However, that message must then never be retrieved again from that query. The python-notmuch2 bindings will currently destroy every message object in Message._destroy(), which will lead to an invalid free if the same message is then retrieved again. E.g. the following python program leads to libtalloc abort()ing: import notmuch2 db = notmuch2.Database(mode = notmuch2.Database.MODE.READ_ONLY) t = next(db.threads('*')) msgs = list(zip(t.toplevel(), t.toplevel())) msgs = list(zip(t.toplevel(), t.toplevel())) Fix this issue by creating a subclass of Message, which is used for "standalone" message which have to be freed by the caller. Message class is then used only for messages descended from a query, which do not need to be freed by the caller.
2020-06-15python/notmuch2: add bindings for the database config stringsAnton Khirnov
2019-12-24python/notmuch2: fix typo for "destroyed"Daniel Kahn Gillmor
Another fix to the docstrings, this time for the English part of the docstrings, not the Python class name. No functional changes here. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-24python/notmuch2: fix typo for ObjectDestroyedErrorDaniel Kahn Gillmor
There is no functional change here, just a fix to a typo in the docstrings. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03Move from _add_message to _index_file APIFloris Bruynooghe
This moves away from the deprecated notmuch_database_add_message API and instead uses the notmuch_database_index_file API. This means instroducing a class to manage the index options and bumping the library version requirement to 5.1.
2019-12-03Rename package to notmuch2Floris Bruynooghe
This is based on a previous discussion on the list where this was more or less seen as the least-bad option.