From 8d71d5eaa4edff45aa00025ccfbf07f913fb0203 Mon Sep 17 00:00:00 2001 From: Suvayu Ali Date: Mon, 8 Oct 2012 11:34:29 +0200 Subject: [PATCH] Re: nbook: a notmuch based address book written in python --- 87/04b977b3f994d4c2cf24f073be4bb1f3f7b199 | 165 ++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 87/04b977b3f994d4c2cf24f073be4bb1f3f7b199 diff --git a/87/04b977b3f994d4c2cf24f073be4bb1f3f7b199 b/87/04b977b3f994d4c2cf24f073be4bb1f3f7b199 new file mode 100644 index 000000000..413557344 --- /dev/null +++ b/87/04b977b3f994d4c2cf24f073be4bb1f3f7b199 @@ -0,0 +1,165 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 2224E431FB6 + for ; Mon, 8 Oct 2012 02:34:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id kYvVl-VLcJZm for ; + Mon, 8 Oct 2012 02:34:36 -0700 (PDT) +Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com + [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 4632E431FAF for ; Mon, 8 Oct 2012 02:34:36 -0700 + (PDT) +Received: by mail-ee0-f53.google.com with SMTP id d17so2924031eek.26 + for ; Mon, 08 Oct 2012 02:34:33 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=sender:date:from:to:subject:message-id:mail-followup-to:references + :mime-version:content-type:content-disposition:in-reply-to + :user-agent; bh=yKYkBjAlJR0x3VvvuEd+AeBlUo1yQIrRc/jzj+DChjM=; + b=ZjSdY8rWQWhZb8HjqPyR+18RmD8zsG8LM9O6HRHWk6+KqBHl5uinrDZiqBzrjcO61r + +e+iQ/8wxX/iRp4xEurGgfEOKIOJ5JASJzWv5jdPMB7ZDPMFerb96kPBobmsoQ8LDGd2 + kCufFyEZtsMCojiOxT7WLmPBS14MGGFNiIxb1Imfx04ocTQJuEtPvM6EOOWQVmq3tnZ9 + P6dNq/UeBs+QUkVa8S7uX8ozB6SbZ+OMtoxMeaAV4XCoEsomeVap4mnqN6w0XqjqNbvK + SGO+Nn5HSiPnR27KdTR47J3SbhqGbtKJWtrxxd/Jg501oStX7Pr0ANDTVQ/zXb1+xWuL + 8e4Q== +Received: by 10.14.202.131 with SMTP id d3mr21893463eeo.32.1349688873653; + Mon, 08 Oct 2012 02:34:33 -0700 (PDT) +Received: from kuru.dyndns-at-home.com (pb-d-128-141-52-183.cern.ch. + [128.141.52.183]) + by mx.google.com with ESMTPS id r45sm28828615eem.6.2012.10.08.02.34.32 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 08 Oct 2012 02:34:32 -0700 (PDT) +Sender: suvayu ali +Date: Mon, 8 Oct 2012 11:34:29 +0200 +From: Suvayu Ali +To: notmuch@notmuchmail.org +Subject: Re: nbook: a notmuch based address book written in python +Message-ID: <20121008093429.GC4534@kuru.dyndns-at-home.com> +Mail-Followup-To: notmuch@notmuchmail.org +References: <20120924082646.GA10577@kuru.dyndns-at-home.com> + <20120925104457.12264.30350@megatron> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20120925104457.12264.30350@megatron> +User-Agent: Mutt/1.5.21 (2011-07-01) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 08 Oct 2012 09:34:38 -0000 + +Hi Patrick, + +Sorry for the very late reply; I got distracted with some personal +matters. + +On Tue, Sep 25, 2012 at 11:44:57AM +0100, Patrick Totzke wrote: +> Hey Suvayu, welcome to notmuch! +> +> I hope you are aware that there are already a few search based abook tools +> around for notmuch (listed in the wiki, albeit hidden in the emacs docs): +> http://notmuchmail.org/emacstips/#index14h2 +> I personally use nottoomuch-addresses.sh, which apparently does some advanced +> caching voodoo for speed. +> + +I wasn't aware of either of them, thanks for pointing them out. I'll +take a look for inspiration and ideas. + +> But to your tool; practice test: +> I wasn't able to use wildcards or simply prefixes of names. This is essential +> if you want to use it for tabcompleting contacts in a MUA. + +Since the idea was inspired by the completion on the Gmail web +interface, I already do a partial search so wildcards should not be +necessary. + +> The time lookups take seems to depend on how many matches there are: +> +> ------------------------------- +> time nbook Suvayu +> 1 unique email addresses found for `Suvayu' +> fatkasuvayu+linux@gmail.com Suvayu Ali +> +> nbook Suvayu 0.04s user 0.01s system 95% cpu 0.050 total +> ------------------------------- +> time nbook Justus +> ... +> +> nbook Justus 0.21s user 0.07s system 11% cpu 2.484 total +> ------------------------------- + +Yes, I noticed this too when I searched for the more common names. Not +sure how to get around this though. + +> And If I look for my own name, this takes over a minute, +> eventually dying. This could be an issue with libnotmuch though. +> Possibly, your algorithm takes very long and then reads from an initially +> opened Database object again, which was invalidated by concurrent writes of other processes.. +> +> ------------------------------- +> [~] time nbook Patrick +> +> Error opening /home/pazz/mail/gmail/[Google Mail].All Mail/cur/1330682270_0.12958.megatron,U=8766,FMD5=66ff6a8bc18a8a3ac4b311daa93d358a:2,S: Too many open files +> Traceback (most recent call last): +> File "/home/pazz/bin/nbook", line 167, in +> File "/home/pazz/bin/nbook", line 71, in __init__ +> File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/message.py", line 233, in get_header +> notmuch.errors.NullPointerError +> Error in sys.excepthook: +> Traceback (most recent call last): +> File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook +> ImportError: No module named fileutils +> +> Original exception was: +> Traceback (most recent call last): +> File "/home/pazz/bin/nbook", line 167, in +> File "/home/pazz/bin/nbook", line 71, in __init__ +> File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/message.py", line 233, in get_header +> notmuch.errors.NullPointerError +> nbook Patrick 3.20s user 5.47s system 12% cpu 1:11.65 total +> ------------------------------------ +> + +Yes someone else pointed this out too. Again I'm not sure how to +proceed here. I had a quick look at this last week and it seemed to me +the limitation comes from within the python bindings for notmuch. Do +you have any ideas? + +> Anyway, have fun hacking notmuch! If you are looking for a related project to bring in your python skills +> I could think of one or two :D + +That would be wonderful. To give you my background, I'm a graduate +student in physics and I have to do a lot of C/C++ and python +programming for my research. Contributing to FOSS projects seems like a +wonderful way to learn to collaborate and clean programming (we +physicists tend to be sloppy programmers :-p). + +> Best, +> /p + +Cheers, + +-- +Suvayu + +Open source is the future. It sets us free. -- 2.26.2