gauteh / lieer

Fast email-fetching, sending, and two-way tag synchronization between notmuch and GMail
http://lieer.gaute.vetsj.com
Other
554 stars 62 forks source link

Notmuch2 interface updates #212

Closed aplund closed 2 years ago

aplund commented 2 years ago

I've tried to merge across the interface calls to notmuch2.

I have done some simple testing, but might have missed some things that have changed.

gauteh commented 2 years ago

Tests are failing. Is the notmuch2 version on pip the latest one?

aplund commented 2 years ago

Tests are failing. Is the notmuch2 version on pip the latest one?

It doesn't appear so. The version listed is apparently '0.1' when the release version is '0.35'. The linked github page doesn't work. And when I did find the correct link, it seems to be 2 years old.

aplund commented 2 years ago

The error message in the test output relates the notmuch.h library header files missing.

       gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../lib -I/opt/hostedtoolcache/Python/3.9.10/x64/include/python3.9 -c build/temp.linux-x86_64-3.9/notmuch2._capi.c -o build/temp.linux-x86_64-3.9/build/temp.linux-x86_64-3.9/notmuch2._capi.o
      build/temp.linux-x86_64-3.9/notmuch2._capi.c:572:14: fatal error: notmuch.h: No such file or directory
        572 |     #include <notmuch.h>
            |              ^~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
gauteh commented 2 years ago

So we probably need to install libnotmuch-dev and also notmuch-python if it exists as a package. Otherwise it needs to be installed from source. The python bindings requires a fairly new notmuch version, newer than ubuntu 18 has.

What would be the preferred way to set up gmi on say ubuntu 18 and 20 now? We can no longer use the pypi package. And requirements.txt is probably just going to cause confusion, we probably have to point it to the notmuch git repository (pip+git).

aplund commented 2 years ago

If libnotmuch-dev was installed, then the pip package would probably build.

gauteh commented 2 years ago

Yeah, but the pip package is outdated and not maintained by notmuch org :/ (as far as I can see).

rex1fernando commented 2 years ago

It seems that notmuch has no plans to keep the pip package up-to-date:

https://notmuchmail.org/pipermail/notmuch/2020/029683.html

gauteh commented 2 years ago

Just to be clear. I think this PR is good to go, and thanks for all the work. I am hesitating to merge because it is difficult to install the new notmuch bindings. I am currently on Ubuntu 18 and there is no way to do that without compiling entire notmuch from source.

mjg commented 2 years ago

Given the dependencies, I'd say notmuch and its bindings is something you want from your distro, not from pip. Ubuntu 18 LTS is based on Debian buster, and buster-backports has python3-notmuch2 at 0.31.4-2. I'm not a Debian nor Ubuntu guy and therefore don't know whether this helps.

0.31 is quite an early version of the notmuch2 bindings, though: Since then there were a couple of fixes and additions, especially around "split config".

Debian bullseye backports has 0.36 already (and Ubuntu 20 LTS is based on bullseye). I'm note sure how far you want to go back with LTS support, but the new notmuch2 bindings don't seem to be a good match for an 18 LTS when both 20 LTS and 22 LTS are around.

aplund commented 2 years ago

I have tried to rewrite this to be as "dual stack" as possible. I'm using a test on the module name attribute to see which interface is being called and adapt.

It's very likely I've missed some of the interfaces so I'd appreciate help in testing. I've tried running in a virualenv with either notmuch or notmuch2 installed and I've been able to sync mail with both.

I've also tried to fix the bug reported in issue #173 where the notmuch2 "set like" interface for the tags has seeminly changed.

mjg commented 2 years ago

@aplund Thanks a lot for working on this. @gauteh Do you really want to keep supporting the old bindings? If yes: There is a lot of duplication in the compat code. Maybe we should go for a compatibility module which wraps these in one place instead?

gauteh commented 2 years ago

No, I don't need to support the old bindings. Are the new bindings easy to install?

gauteh commented 2 years ago

Looks like this works well with notmuch2. I'd be happy with removing support for the old bindings at the same time. Thanks for your work @aplund .

mjg commented 2 years ago

No, I don't need to support the old bindings. Are the new bindings easy to install?

There are those who prefer distro packages and those who prefer pip and such. As the maintainer of notmuch in Fedora, I may be biased :-) I don't think there are official notmuch pip packages, and you want the bindings to match your notmuch. So the answer depends on the distro. Ubuntu 18LTS or so might be a problem. Fedora is fine, of course!

gauteh commented 2 years ago

Sounds good. Then they're at least as well distributed as the old ones. I'm ready to merge this, but I can wait if @aplund or anyone wants to remove the old bindings first.

aplund commented 2 years ago

Tried to remove old bindings. Again, only done rudimentary testing.

gauteh commented 2 years ago

Thanks, merged!