lieer icon indicating copy to clipboard operation
lieer copied to clipboard

Notmuch2 interface updates

Open aplund opened this issue 3 years ago • 9 comments

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.

aplund avatar Feb 10 '22 02:02 aplund

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

gauteh avatar Feb 14 '22 09:02 gauteh

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 avatar Feb 14 '22 09:02 aplund

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

aplund avatar Feb 14 '22 09:02 aplund

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).

gauteh avatar Feb 14 '22 09:02 gauteh

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

aplund avatar Feb 14 '22 09:02 aplund

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

gauteh avatar Feb 14 '22 09:02 gauteh

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

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

rex1fernando avatar Feb 14 '22 17:02 rex1fernando

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.

gauteh avatar Feb 23 '22 13:02 gauteh

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.

mjg avatar May 10 '22 17:05 mjg

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.

aplund avatar Sep 12 '22 15:09 aplund

@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?

mjg avatar Sep 13 '22 07:09 mjg

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

gauteh avatar Sep 13 '22 08:09 gauteh

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 .

gauteh avatar Sep 13 '22 08:09 gauteh

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!

mjg avatar Sep 13 '22 08:09 mjg

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.

gauteh avatar Sep 13 '22 08:09 gauteh

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

aplund avatar Sep 14 '22 03:09 aplund

Thanks, merged!

gauteh avatar Sep 14 '22 08:09 gauteh