We just open sourced Flanker, our Python email address and Mime parsing library
blog.mailgun.com
blog.mailgun.com
Looking at a 100mb multipart upload I can see that email module takes 3.7s and allocates 265 extra MB to parse it, while flanker.mime takes 0.22s and allocates 0.2mb extra memory.
I'm a corelibs nazi and refuse to add dependencies to the very last when I'm writing Python.
But if what you're saying is true then I can see a very good argument for replacing email with flanker.
Python has already simplified programming so much coming from languages like C, so I guess I view it as a tolerance matter.
I'm willing to put up with the longer way of using corelibs in some cases, to keep my dependencies low. And I'm willing to tolerate this longer way because I feel that Python in it self is such a shortcut from other languages that I'm already reaping huge benefits.
I know there's usually a huge community testing and supporting all dependencies but having installed some Ruby and Node apps I've seen massive lists of dependencies and I've had situations where it breaks down on some obscure library used to do some really mundane task.
I could not have solved many of those cases without the years of Linux experience I already have. I don't think users should have to go through that.
Dealing with MIME has always been an issue in Python, and the last move was Zed Shaw's Lamson project a few years ago. The native email.parser module is crazy slow once you start doing heavy processing.
Flanker's addresslib also is a no-brainer to use. These are the sorts of things which should be bundled with the Python email module.
Thanks for open sourcing them!
--
[1] This isn't announced yet, and will deserve a much longer post. You can sign-up for news here: https://www.inboxapp.com.
But only after they don't need to be changed any more...
Mailgunners will be hanging around in comments, ready to answer any questions, should you have any.
In short email is probably more important to my business (even with my paltry list numbers) but I no longer run a mail server, anywhere, I do not even have a local mail client unless you count JavaScript.
I'm wondering if I am trading off vulnerability for ease at the wrong places.
... hmmm a little unfocused I am afraid but I really have not made any explicit strategic decisions over email but even so, my whole mail handling has altered.
I just am surprised I have not noticed how big a step it has been.
So, its a good thing, yes, but I think the unit of abstraction is not the individual developer but the "organisation". WHich is oddly different from most OSS
I appreciate how the Flanker release includes benchmarks without thrashing on alternative implementations.
Where is the python-requests for email? I will seriously buy someone as much beer they can consume in an evening if such a thing exists!
It's a solid service, very easy to configure, with generous free limits (for the five emails a month my server sends) and with a very nice UI. Props to the team.
Did you consider using a C extension and tools like lex or ragel for the rfc822 scanning phase? Not worth it?
It's pretty unlikely that many well-used and years old OSS language libraries have orders of magnitude speed ups lying on the table, without there being a design decision in there that can be argued many different ways.
It's pretty unlikely that many well-used and years old OSS language libraries have orders of magnitude speed ups lying on the table...
Normally I'd agree with you, but this is the python stdlib we're talking about.
But I think my point elsewhere stands - I hardly want to parse email these days, even though I consume more of it. Most of my mail is outsourced and it seems to be a trend.
Maybe not a good one. I am not sure. I used to hate spamassassin though
Where does the project name (Flanker) come from?