Sparklines.js Port to Python
Since it seems to be my season for releasing abandoned code, I figured I'd also release my somewhat-complete but far from perfect port of Sparklines.js to Python that I undertook a while back.
You can download the file here.
It uses PIL to render the Sparklines to files. For the most part it creates horrifyingly ugly sparklines, and while the API is quite similar to Sparklines.js it isn't necessarily perfect. You might say that I am releasing it on meritless whim. It was originally intended to support a web service that would dynamically generate sparklines for users on the website via Sparklines.js, and would then allow users to export a copy using the Python library to generate an image file. It actually works fairly well for that purpose (the API is slightly different, but nothing you can't correct somewhere in your application's logic), except for the images generated by the Python library being so hideous (this isn't entirely a bluff, the prototype of the web application I was working on did exactly that).
For what it's worth, I don't think the putrid appearance is something that can't be overcome, just requires a bit of attention to it, that's all.
The Porting Experience
The Python version is 270 lines, whereas the JavaScript one is about 320. Since I had the benefit of designing the JavaScript library first before implementing the Python one, I think that is a fairly powerful statement about the relative expressivity of Python and JavaScript. On the other hand, I don't have to look at a reference to subclass things in Python, which is more than I can say for JavaScript.
It actually took a bit longer than I expected, but that was largely due to ambiguity or holes in PIL's documentation. Or perhaps my own failings are to blame. Regardless, there are more mismatches between idiomatic Python and idiomatic JavaScript than one might imagine.
Hopefully the port is mildly useful. I don't have much intention of supporting this one, but if you have questions I'll do my best to assist.