[PATCH] Introduce CFFI-based python bindings

2017-11-28 Thread Floris Bruynooghe
From: Floris Bruynooghe <f...@google.com> This introduces the beginnings of new CFFI-based Python bindings. The bindings aim at: - Better performance on pypy - Easier to use Python-C interface - More "pythonic" - The API should not allow invalid operations - Use native objec

DRAFT Introduce CFFI-based Python bindings

2017-11-28 Thread Floris Bruynooghe
Hi all, Here are the beginnings off CFFI-based Python bindings, rather than the ctypes-based ones currently available. I started this work in order to get faster bindings on pypy since a script of mine was running slower on pypy than CPython. Initially aiming for a drop-in replacement of the

Re: DRAFT Introduce CFFI-based Python bindings

2017-11-29 Thread Floris Bruynooghe
Patrick Totzke <patricktot...@gmail.com> writes: > Quoting David Bremner (2017-11-28 23:59:26) >> Floris Bruynooghe <f...@devork.be> writes: >> >> > >> > Lastly there are some downsides to the choices I made: >> > - I ended up going square

Re: [PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2017-11-29 Thread Floris Bruynooghe
Daniel Kahn Gillmor writes: > On Tue 2017-11-28 23:46:11 +0100, Ruben Pollan wrote: >> Message.get_property (prop) returns a string with the value of the property >> and >> Message.get_properties (prop, exact=False) returns a list [(key, value)] > > This looks like a

Re: DRAFT Introduce CFFI-based Python bindings

2017-11-29 Thread Floris Bruynooghe
David Bremner <da...@tethera.net> writes: > Floris Bruynooghe <f...@devork.be> writes: > >> >> Lastly there are some downsides to the choices I made: >> - I ended up going squarely for CPython 3.6+. Choosing Python >> 3 allowed better API design,

Update on python-cffi bindings

2017-12-17 Thread Floris Bruynooghe
Hi all, Thanks for all the feedback on an early post of my CFFI-based libnotmuch Python bindings. I've now completed these somewhat more and they now have most of the functionality. Here's what's new since last time: - All tests pass on Python 3.5, 3.6 and pypy3.5 I could probably add 3.4

Re: DRAFT Introduce CFFI-based Python bindings

2017-12-01 Thread Floris Bruynooghe
Florian Klink writes: >>> I guess you'll have to convince the maintainers / users of alot and afew >>> that this makes sense before we go much further. I'd point out that >>> Debian stable is only at python 3.5, so that makes me a bit wary of this >>> (being able to run the

Re: [PATCH] NEWS: library changes for 0.26

2017-12-30 Thread Floris Bruynooghe
David Bremner writes: > These are just "my" changes, as arbited by "git shortlog", which > sometimes lies. > --- > NEWS | 21 + > 1 file changed, 21 insertions(+) > > diff --git a/NEWS b/NEWS > index 3b6404e7..1c5edf4c 100644 > --- a/NEWS > +++ b/NEWS > @@

Re: Update on python-cffi bindings

2017-12-29 Thread Floris Bruynooghe
Hi all, Daniel Kahn Gillmor <d...@fifthhorseman.net> writes: > On Thu 2017-12-21 12:30:39 +0100, Floris Bruynooghe wrote: >> The API changes a lot and there is no easy migration. And history has >> shown that's a terrible way to get something new adopted. Last time I &g

LIBNOTMUCH_MINOR_VERSION for 0.26

2018-01-15 Thread Floris Bruynooghe
Hi, I was looking to update my bindings with the latest release and am somewhat confused on the value of the LIBNOTMUCH_MINOR_VERSION value. It seems to be suggested in e.g. the documentation of notmuch_database_index_file that for notmuch 0.26 this should be 1, however the header still seems to

Re: Update on python-cffi bindings

2017-12-21 Thread Floris Bruynooghe
Daniel Kahn Gillmor <d...@fifthhorseman.net> writes: > Hi Floris-- > > On Sun 2017-12-17 19:08:18 +0100, Floris Bruynooghe wrote: > > i've heard reported, and i also appreciate your attention to performance > concerns on different python platforms (e.g. making sure things

experimenting with pytest tests

2018-04-07 Thread Floris Bruynooghe
Hi, From another conversation on this list I've dug up my earlier attempts at integrating a pytest run into the notmuch testing suite. I'd be grateful for some guidance on whether this is the right way to go about things. Here's the diff of configure: diff --git a/configure b/configure index

Re: [PATCH 2/2] test: pytest runner for the test suite

2018-04-08 Thread Floris Bruynooghe
This series looks good to me, would be great to have! Do you want to commit them this or should I just incorporate it and submit together with tests once actual tests exist. You could always commit with a ``def test_dummy(): assert True`` or something if you like. Thanks! Floris On Sat 07 Apr

Re: [PATCH 2/2] test: pytest runner for the test suite

2018-04-13 Thread Floris Bruynooghe
On Sun 08 Apr 2018 at 19:14 -0300, David Bremner wrote: > Floris Bruynooghe <f...@devork.be> writes: > >> This series looks good to me, would be great to have! Do you want to >> commit them this or should I just incorporate it and submit together >> with tests once

Re: New Python bindings (was: Crash with Python bindings)

2018-03-28 Thread Floris Bruynooghe
On Wed, Mar 28 2018, Brian May wrote: > Justus Winter writes: > >>> This is exactly what I have fixed in my alternative bindings which I >>> created around the end of last year [0]. So we do have an idea of how >>> to fix this, at the time I said I do believe that it's

Re: New Python bindings

2018-03-28 Thread Floris Bruynooghe
On Wed, Mar 28 2018, Justus Winter wrote: > Floris Bruynooghe <f...@devork.be> writes: > >> On Wed, Mar 21 2018, Justus Winter wrote: >>> >>> Floris Bruynooghe <f...@devork.be> writes: >>> >>>> This is exactly what I have fixed

Re: New Python bindings (was: Crash with Python bindings)

2018-03-28 Thread Floris Bruynooghe
On Wed, Mar 28 2018, David Bremner wrote: > Brian May writes: > >> I can into this thread late. However, my priorities for python bindings >> would be: > > [...] >> * Packages should be available from pypi.python.org >> > > We tried this before, and it didn't work out

Re: pytest integration for the notmuch test suite

2018-03-26 Thread Floris Bruynooghe
On Sun, Mar 25 2018, David Bremner wrote: > Here's one approach. A given pytest "file" can be embedded in a normal > (for us) test script. As I write this, it occurs to me you might be > thinking of embedding unit tests in the bindings source files; that > would be easy to add, something along

Re: New Python bindings (was: Crash with Python bindings)

2018-03-26 Thread Floris Bruynooghe
On Wed, Mar 21 2018, Justus Winter wrote: > > Floris Bruynooghe <f...@devork.be> writes: > >> This is exactly what I have fixed in my alternative bindings which I >> created around the end of last year [0]. So we do have an idea of how >> to fix this, at the t

Re: [PATCH 1/3] configure: check for pytest binary

2018-03-26 Thread Floris Bruynooghe
On Sun, Mar 25 2018, David Bremner wrote: > This is to support future use of pytest in the test suite Thanks for having a go at this! > --- > configure | 24 > 1 file changed, 24 insertions(+) > > diff --git a/configure b/configure > index b177b141..ab45878d 100755 >

Re: Crash with Python bindings

2018-03-16 Thread Floris Bruynooghe
Hi all, David Bremner writes: > "W. Trevor King" writes: > >> you can avoid the abort (which happens when q.__del__ is called after >> db.__del__). We could make that sort of cleanup easier with context >> managers for Query objects (we have them for

Re: Crash with Python bindings

2018-03-18 Thread Floris Bruynooghe
Daniel Kahn Gillmor <d...@fifthhorseman.net> writes: > On Fri 2018-03-16 19:30:37 +0100, Floris Bruynooghe wrote: >> If someone can hook pytest runs with various python versions into the >> notmuch test suit I'd be very much obliged and probably have another go >

Re: segfault using python bindings

2018-11-15 Thread Floris Bruynooghe
Hi, On Sun 11 Nov 2018 at 16:16 -0400, David Bremner wrote: > David Čepelík writes: > >> Hello Notmuch devs, >> >> I'm facing an issue trying to use the Python bindings. This trivial >> piece of code segfaults: >> >> import notmuch > > I don't remember the details [1], but there are known

Re: segfault using python bindings

2018-11-16 Thread Floris Bruynooghe
On Fri 16 Nov 2018 at 07:15 -0500, Daniel Kahn Gillmor wrote: > On Fri 2018-11-16 06:27:12 -0400, David Bremner wrote: >> Floris Bruynooghe writes: >> >>> These are at https://github.com/flub/notmuch/tree/cffi/bindings/python-cffi >>> >>> I'm not rea

Re: segfault using python bindings

2018-11-16 Thread Floris Bruynooghe
On Fri 16 Nov 2018 at 06:29 -0400, David Bremner wrote: > Brian May writes: > >> Floris Bruynooghe writes: >> >>> I've since wondered if just getting them standalone on pypi is perhaps a >>> useful service in the mean time as it's relatively little

Re: segfault using python bindings

2019-08-15 Thread Floris Bruynooghe
On Wed 14 Aug 2019 at 16:20 -0300, David Bremner wrote: > Floris Bruynooghe writes: > >> These are at https://github.com/flub/notmuch/tree/cffi/bindings/python-cffi >> >> I'm not really convinced of the way forward last time it was discussed >> on how to get them

Re: segfault using python bindings

2019-08-20 Thread Floris Bruynooghe
On Thu 15 Aug 2019 at 09:28 -0300, David Bremner wrote: > Floris Bruynooghe writes: > >> On Wed 14 Aug 2019 at 16:20 -0300, David Bremner wrote: >>> >>> Can you remind me what the percieved blockers are for merging into the >>> main notmuch tree? I'm less

Re: segfault using python bindings

2019-08-26 Thread Floris Bruynooghe
On Wed 21 Aug 2019 at 12:02 -0400, Daniel Kahn Gillmor wrote: > On Tue 2019-08-20 19:20:30 +0200, Floris Bruynooghe wrote: >> For path series what did you have in mind? One single patch with the >> whole lot? The original history at https:://github/flub/notdb? >> Someth

Python3 cffi bindings

2019-10-08 Thread Floris Bruynooghe
Hi all, IIRC there was a thread in August about another attempt at bringing the CFFI-based bindings on board as a Python3-only version. I believe there was a desire to re-name things but my searching-fu is failing me and I can no longer find the email thread. Anyway, I found the code, checked

Re: Python3 cffi bindings

2019-10-09 Thread Floris Bruynooghe
On Tue 08 Oct 2019 at 19:24 -0300, David Bremner wrote: > Floris Bruynooghe writes: >> Anyway, I found the code, checked things work, updated tests on new >> python versions, added a very basic intergration with the test >> framework and squashed the commits. Otherwi

Re: Python3 cffi bindings

2019-10-25 Thread Floris Bruynooghe
On Tue 22 Oct 2019 at 13:32 -0300, David Bremner wrote: > David Bremner writes: > >> The LD_LIBRARY_PATH is already set by the test harness, as is PATH (to >> find notmuch). It looks like your function notmuch is not respecting >> PATH (see attached log). if I hack something like >> >> diff

Re: Python3 cffi bindings

2019-10-17 Thread Floris Bruynooghe
On Mon 14 Oct 2019 at 09:42 -0300, David Bremner wrote: > David Bremner writes: > >> The shim in >> T391-python-cffi.sh doesn't work for me, it doesn't manage to set >> PYTHONPATH so that notdb is importable. Ah yes, I tested this shim while activating a venv with the extension installed using

Re: python CFFI bindings integration into notmuch build/test

2019-11-14 Thread Floris Bruynooghe
Hi, Thanks for carrying on with this! I'm a little confused with how to follow this, is the current state of the code somewhere in a repo/branch where I can try things out and make changes from? On Tue 05 Nov 2019 at 22:22 -0400, David Bremner wrote: > Tomi Ollila writes: > > >> alternative:

Re: python CFFI bindings integration into notmuch build/test

2019-11-14 Thread Floris Bruynooghe
On Thu 14 Nov 2019 at 23:24 +0100, Floris Bruynooghe wrote: > On Thu 14 Nov 2019 at 22:20 +0200, Tomi Ollila wrote: >> In git://notmuchmail.org/git/notmuch David has ref origin/wip/cffi >> which contains related changes -- You can fetch the code while waiting >> f

Re: python CFFI bindings integration into notmuch build/test

2019-11-14 Thread Floris Bruynooghe
On Thu 14 Nov 2019 at 22:20 +0200, Tomi Ollila wrote: > In git://notmuchmail.org/git/notmuch David has ref origin/wip/cffi > which contains related changes -- You can fetch the code while waiting > for more collaboration instructions from David. Aha, thanks! Floris

Re: python CFFI bindings integration into notmuch build/test

2019-11-17 Thread Floris Bruynooghe
On Sat 16 Nov 2019 at 10:51 -0500, David Bremner wrote: > Floris Bruynooghe writes: >> Anyway, this looks good. Would you like some changes, e.g. the rename >> to notmuch2 or so as patches? What's the next step. > > If you could look at the rename that would be great. Pa

[PATCH 2/2] Rename package to notmuch2

2019-11-17 Thread Floris Bruynooghe
i/setup.py +++ b/bindings/python-cffi/setup.py @@ -2,7 +2,7 @@ import setuptools setuptools.setup( -name='notdb', +name='notmuch2', version='0.1', description='Pythonic bindings for the notmuch mail database using CFFI', author='Floris Bruynooghe', @@ -10,7 +10,7 @@ setup

[PATCH 1/2] Show which notmuch command and version is being used

2019-11-17 Thread Floris Bruynooghe
This add the notmuch version and absolute path of the binary used in the pytest header. This is nice when running the tests interactively as you get confirmation you're testing the version you thought you were testing. --- bindings/python-cffi/tests/conftest.py | 7 +++ 1 file changed, 7

Rename and small tweaks to wip/cffi

2019-11-17 Thread Floris Bruynooghe
Hi, This is a patch against the wip/cffi branch. It does the rename which was discussed before and it adds a small improvment (to me) to the test runner to show which notmuch version is being tested. Let me know if this the right or wrong way to contribute to this branch. Cheers, Floris

Re: Python3 cffi bindings

2019-11-17 Thread Floris Bruynooghe
Hi Gaute, Thanks for trying this out! On Mon 04 Nov 2019 at 11:27 +0100, Gaute Hope wrote: > I just checked out the wip/cffi branch on git.notmuch.org with the > purpose of porting Lieer (https://github.com/gauteh/lieer). There > seems to be some missing functionality: `Database.get_directory()`

[PATCH] Move from _add_message to _index_file API

2019-11-17 Thread Floris 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. --- bindings/python-cffi/notdb/_build.py| 26 +-

Adressing deprecation warnings

2019-11-17 Thread Floris Bruynooghe
This addresses the deprecation warning pointed out in another thread on this list. It's also a nice self-contained example of adding an API including a new object. This patch is against the wip/cffi branch, it does not rely on my other patch against this branch which renames things. Conflicts

Re: [PATCH 1/2] Show which notmuch command and version is being used

2019-11-18 Thread Floris Bruynooghe
On Mon 18 Nov 2019 at 07:43 -0400, David Bremner wrote: > Floris Bruynooghe writes: > >> This add the notmuch version and absolute path of the binary used >> in the pytest header. This is nice when running the tests >> interactively as you get confirmation you're