Posts tagged: python

Speeding up Toolforge tools with Redis

Over the past two weeks I significantly sped up two of my Toolforge tools by using Redis, a key-value database. The two tools, checker and shorturls were slow for different reasons, but now respond instantaneously. Note that I didn't do any proper benchmarking, it's just noticably faster. If you're not…

mwparser on wheels

mwparserfromhell is now fully on wheels. Well...not those wheels - Python wheels! If you're not familiar with it, mwparserfromhell is a powerful parser for MediaWiki's wikitext syntax with an API that's really convenient for bots to use. It is primarily developed and maintained by Earwig, who originally wrote it for…

Requiring HTTPS for my Toolforge tools

My Toolforge (formerly "Tool Labs") tools will now start requiring HTTPS, and redirecting any HTTP traffic. It's a little bit of common code for each tool, so I put it in a shared "toolforge" library. from flask import Flask import toolforge app = Flask(__name__) app.before_request(toolforge.redirect_to_https) And that's it! Your tool…

Pelican theming

Pelican theming isn't actually that difficult. It's based on jinja2 templates, and there were enough themes already out there to pick one and just start forking it. I'm not too happy that they want themes installed into your system python path (or a virtualenv in my case), but since you…