Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

567 items tagged “python”

The First Few Weeks—ep.io. Another take on managed Python Django/WSGI hosting, from Andrew Godwin and Ben Firshman. 4 13th January 2011, 4:25 am

HotQueue. A super-simple Python work queue using Redis. The API is neat, and makes clever use of generators for blocking consumption of queue items. 3 22nd December 2010, 11:51 am

Bleach, HTML sanitizer and auto-linker. HTML sanitisation is notoriously difficult to do correctly, but Bleach (a Python library) looks like an excellent effort. It uses the html5lib parsing library to deal with potentially malformed HTML, uses a whitelist rather than a blacklist and has a neat feature for auto-linking URLs that is aware of the DOM (so it won’t try to auto-link a URL that is already wrapped in a link element). It was written by the Mozilla team for addons.mozilla.org and support.mozilla.org so it should be production ready. 2 25th October 2010, 1:32 pm

I think that “bad technology” can kill a startup, but slightly different variations of good technology don’t have much effect. Choose what you know/like best. And Ruby and Python are both in this latter category.

enko on Hacker News 33 2nd October 2010, 11:19 am

ijson. A SAX-style streaming JSON parser for Python, using ctypes to talk to the yajl C library. 4 22nd September 2010, 9:59 pm

Writing your own traceroute in Python. How to implement traceroute in Python, using the low-level socket module. 1 9th August 2010, 12:58 pm

What to do when PyPI goes down. My deployment scripts tend to rely on PyPI these days (they install dependencies in to a virtualenv) which makes me distinctly uncomfortable. Jacob explains how to use the PyPI mirrors that are starting to come online, but that won’t help if the PyPI listing links to an externally hosted file which starts to 404, as happened with the python-openid package quite recently (now fixed). The comments on the post discuss workarounds, including hosting your own PyPI mirror or bundling tar.gz files of your dependencies with your project. 19 21st July 2010, 10:19 am

simplegeo’s python-oauth2. The Python OAuth library scene is frighteningly complicated at the moment. This seems to be the most actively maintained, and the readme includes working example code for talking to the Twitter API (including integration with Django auth). 12 18th July 2010, 5:22 pm

MapOSMatic. Clever service built on top of OpenStreetMap, which renders double sided city maps with a map and grid on one size and an A-Z street name index on the other. Runs on top of Mapnik, PostGIS and Cairo, with a few thousand additional lines of Python and Django. 4 11th July 2010, 12:15 pm

python/trunk/Lib/httplib.py in 1994 (via) Python’s original httplib implementation, checked in by Guido 16 years and 4 months ago. Not much younger than the Web itself. 10 4th July 2010, 11:25 pm

Python 2.7 Release. Includes three of my favourite features from Python 3: odicts, set literals and set and dictionary comprehensions. 27 4th July 2010, 11:21 pm

Slide, Inc.—open source. slide.com have open sourced a whole bunch of interesting Python libraries, most of them involving C extensions or greenlet non-blocking I/O. wirebin (fast binary serialization of native Python types) and meminfo (an extension for finding precise in-memory sizes of Python objects) look particularly interesting. No documentation yet—not even a readme. 1 17th June 2010, 8:05 pm

Appending the request URL to SQL statements in Django. A clever frame-walking monkey-patch which pulls the most recent HttpRequest object out of the Python stack and adds the current request.path to each SQL query as an SQL comment, so you can see it in debugging tools such as slow query logs and the PostgreSQL “select * from pg_stat_activity” query. 24 2nd June 2010, 9:09 am

django-boss (via) Management commands are one of the few bits of Django that I still have to look up in the documentation whenever I write them. django-boss offers a smart alternative to regular management commands, based around decorators and taking the containing app as the first argument. 6 1st June 2010, 10:02 am

Headroid1—a face tracking robot head. Kind of creepy—Ian Ozsvald’s openCV + pySerial motorised camera follows your face around the room, and will soon be able to react to your emotions. 3 21st May 2010, 4:59 pm

Django 1.2 release notes (via) Released today, this is a terrific upgrade. Multiple database connections, model validation, improved CSRF protection, a messages framework, the new smart if template tag and lots, lots more. I’ve been using the 1.2 betas for a major new project over the past few months and it’s been smooth sailing all the way. 2 17th May 2010, 9:11 pm

Ruby-style Blocks in Python. Yes, yes, yes, yes. A proposal for muli-line lambda support in Python that doesn’t trip up on significant whitespace. If this gets in before the proposed feature freeze I’ll be a very happy Pythonista. UPDATE: This is a post from over a year ago, and it looks like the proposal has since stalled. 12 23rd April 2010, 11:19 am

Flask 0.1 Released. Armin’s Flask (a Python microframework built around Werkzeug and Jinja2) is looking pretty solid for a two week old project—extensive documentation, comprehensive unit test support (and example applications with unit tests) and some very tidy API design. 1 16th April 2010, 5:12 pm

Introduction to Surlex. A neat drop-in alternative for Django’s regular expression based URL parsing, providing simpler syntax for common path patterns. 4 11th April 2010, 7:23 pm

The Onion Uses Django, And Why It Matters To Us. The Onion ported their main site from PHP and Drupal to Django in three months with a team of four developers, including a full migration of their archived content. Their developers answer questions about the switch in this thread on the Django sub-reddit. 2 25th March 2010, 6:43 pm

Fun with TextMate and PDB. TextMate bookmarks (against lines in a file) are stored as OS X extended attributes, which can be accessed from Python using the xattr module. Here’s a clever piece of code that uses bookmarks to set breakpoints in the command-line pdb debugger. 4 23rd March 2010, 9:48 am

The Web Server Benchmarking We Need. Ian Bicking asks for a WSGI benchmark which emphasises error handling over raw performance—can the server keep serving requests if some of them are CPU bound, I/O bound, wedged or cause a segfault? 0 17th March 2010, 10:05 am

Automated deployments with Fabric—tips and tricks. “If it’s not in a Fabric fabfile, it’s not deployable”—I’m slowly applying this philosophy to my personal projects. 6 16th March 2010, 11:19 am

Installing PIL on Mac OS X Snow Leopard for use in Google App Engine. PIL installation instructions that actually work... the ’export CC=“gcc -arch i386”’ incantation in particular. Make sure you run setup.py install using the Python version that the App Engine dev tools are using (I ran “sudo /usr/bin/python2.6 setup.py install”). 2 15th March 2010, 4:06 pm

Introducing the PyPy 1.2 release. It’s been a long time coming, but 1.2 is the first PyPy release to ship with a Just-in-Time compiler! Performance looks pretty impressive. 1 12th March 2010, 11:54 pm

Cache Machine: Automatic caching for your Django models. This is the third new ORM caching layer for Django I’ve seen in the past month! Cache Machine was developed for zamboni, the port of addons.mozilla.org to Django. Caching is enabled using a model mixin class (to hook up some post_delete hooks) and a custom caching manager. Invalidation works by maintaining a “flush list” of dependent cache entries for each object—this is currently stored in memcached and hence has potential race conditions, but a comment in the source code suggests that this could be solved by moving to redis. 9 11th March 2010, 7:35 pm

Is johnny-cache for you? “Using Johnny is really adopting a particular caching strategy. This strategy isn’t always a win; it can impact performance negatively”—but for a high percentage of Django sites there’s a very good chance it will be a net bonus. 5 2nd March 2010, 11:44 am

jmoiron.net: Johnny Cache. The blog entry announcing Johnny Cache (“a drop-in caching library/framework for Django that will cache all of your querysets forever in a consistent and safe manner”) to the world. 3 1st March 2010, 11:48 am

Johnny Cache. Clever twist on ORM-level caching for Django. Johnny Cache (great name) monkey-patches Django’s QuerySet classes and caches the result of every single SELECT query in memcached with an infinite expiry time. The cache key includes a “generation” ID for each dependent database table, and the generation is changed every single time a table is updated. For apps with infrequent writes, this strategy should work really well—but if a popular table is being updated constantly the cache will be all but useless. Impressively, the system is transaction-aware—cache entries created during a transaction are held in local memory and only pushed to memcached should the transaction complete successfully. 6 28th February 2010, 10:55 pm

Unit Testing Achievements. A plugin for Python’s nose test runner that adds achievements—“Night Shift: Make a failing suite pass between 12am and 5am.” 3 28th February 2010, 3:56 pm

PiCloud. An interesting twist on cloud computing for Python. “import cloud; cloud.call(my_function, arguments)” serialises my_function and its arguments, pushes it up to one of their EC2 servers and hands you back a job ID which you can poll (or block on) for a response. They suggest using it for long running tasks such as web crawling or image processing. 2 26th February 2010, 6:25 pm

jacobian’s django-deployment-workshop. Notes and resources from Jacob’s 3 hour Django deployment workshop at PyCon, including example configuration files for Apache2 + mod_wsgi, nginx, PostgreSQL and pgpool. 2 19th February 2010, 2:28 pm

Why toppcloud will not be agnostic. Ian Bicking’s toppcloud aims to offer deployment with the ease of use of AppEngine against a standard, open source Ubuntu + Python 2.6 + mod_wsgi + Varnish stack. Here he explains why he’s not going to vary the required components: keeping everything completely standardised means everyone gets the same bugs (and the same fixes). 3 12th February 2010, 9:21 am

Presenting django-devserver, a better runserver. I really like this—it’s a Django management command (./manage.py rundevserver) which adds SQL logging and cache access summaries to the console output of Django’s local development server. It solves a similar set of problems to the debug toolbar, but requires slightly less setup and doesn’t inject additional HTML in to your pages. You can add your own custom modules to it as well. 4 10th February 2010, 11:33 am

Integrate Tornado in Django. A handy ./manage.py runtornado management command for firing up a Tornado server that serves your Django application. 4 8th February 2010, 11:12 am

What’s hot? Introducing Zeitgeist. Dan Catt’s first project at the Guardian. “When something appears on the Zeitgeist page, it’s because it performed better (got more attention) than the norm for that content type/section/day”. The application itself is written in Python and runs on Google App Engine. 2 5th February 2010, 12:17 pm

Distributed lock on top of memcached. A simple Python context manager (taking advantage of the with statement) that implements a distributed lock using memcached to store lock state: “memcached_lock can be used to ensure that some global data is only updated by one server”. Redis would work well for this kind of thing as well. 3 1st February 2010, 10:15 am

Introducing docent. Paul Mison’s clever little Flickr app for viewing galleries that have been added by your contacts. It runs in Python on App Engine and makes extensive use of the Task Queue API. 0 28th January 2010, 8:35 pm

Reexamining Python 3 Text I/O. Python 3.1’s IO performance is a huge improvement over 3.0, but still considerably slower than 2.6. It turns out it’s all to do with Python 3’s unicode support: When you read a file in to a string, you’re asking Python to decode the bytes in to UTF-8 (the new default encoding) at the same time. If you open the file in binary mode Python 3 will read raw bytes in to a bytestring instead, avoiding the conversion overhead and performing only 4% slower than the equivalent code in Python 2.6.4. 8 28th January 2010, 1:28 pm

World Government Data. Launched last week, this is the Guardian’s meta-search engine for searching and browsing through data from four different government data sites (with more sites planned). Under the hood it’s Django, Solr, Haystack and the Scrapy crawling library. The application was built by Ben Firshman during an internship over Christmas. 3 27th January 2010, 12:27 pm

For the Love of Ponies. Bryan Veloso, the discoverer of the Django Pony, makes contact with the artist who released the original drawing on iStockPhoto. 6 14th January 2010, 12:05 pm

WildlifeNearYou: It began on a fort...

Back in October 2008, myself and 11 others set out on the first /dev/fort expedition. The idea was simple: gather a dozen geeks, rent a fort, take food and laptops and see what we could build in a week. [... 558 words]

What’s new in Django 1.2 alpha 1 (via) Multiple database support, improved CSRF prevention, a messages framework (similar to the Rails “flash” feature), model validation, custom e-mail backends, template caching for much faster handling of the include and extends tags, read only fields in the admin, a better if tag and more. Very exciting release. 6 7th January 2010, 7:31 pm

last.fm for television. Dale Lane’s neat hack to visualise his television watching habits. An Ubuntu / vdx home theatre stores TV events in SQLite, and graphs are generated using Python and Open Flash Chart 2. The really clever bit: the back-end captures nearby bluetooth IDs’ allowing events to be filtered by the people watching based on the presence of their mobile phones. 1 7th January 2010, 7:28 pm

Current State of Unladen Swallow (Towards a Faster Python). The Unladen Swallow team are now planning to merge their work back in to the mainline Python 3 branch, adding a powerful incentive for Python developers to port their old Python 2 code (since the official Python 2.x line is extremely unlikely to have Unladen Swallow merged in to it). 8 7th January 2010, 12:41 pm

rlisagor’s freshen. A Python clone of Ruby’s innovative Cucumber testing framework. Tests are defined as a set of plain-text scenarios, which are then executed by being matched against test functions decorated with regular expressions. Has anyone used this or Cucumber? I’m intrigued but unconvinced—are the plain text scenarios really a useful way of defining tests? 11 5th January 2010, 7:30 pm

Timing attack in Google Keyczar library. An issue I also need to fix in the proposed Django signing code. If you’re comparing two strings in crypto (e.g. seeing if the provided signature matches the expected signature) you need to use a timing independent string comparison function or you risk leaking information. This kind of thing is exactly why I want an audited signing module in Django rather than leaving developers to figure it out on their own. 7 4th January 2010, 3:23 pm

Design and code review requested for Django string signing / signed cookies. Do you know your way around web app security and cryptography (in particular signing things using hmac and sha1)? We’d appreciate your help reviewing the usage of these concepts in Django’s proposed string signing and signed cookie implementations. 2 4th January 2010, 1:24 pm

PythonInterface—OpenCV (via) OpenCV’s new Python interface looks very nice. I’d love to see some full fledged examples of using it to solve real-world computer vision problems. 1 4th January 2010, 11:33 am

Videos from DjangoCon 2009. The videos from September’s DjangoCon are now available, including my “Cowboy development with Django” talk. 4 3rd January 2010, 11:02 am

countdown_to_newyear.py. A quick Python / OS X script I knocked up last night to count in the new year (using the OS X “say” command). 7 1st January 2010, 4:24 pm

Web Sockets in Tornado. Bret Taylor has a simple class making it trivial to experiment with the Web Sockets protocol (now shipping in Chrome) using the scalable Tornado application server. He also raises the million dollar question: what will existing load balancers and proxies make of the new protocol? 1 31st December 2009, 11:54 am

Socket Benchmark of Asynchronous Servers in Python. A comparison of eight different asynchronous networking frameworks in Python. Tornado comes out on top in most of the benchmarks, but the post is most interesting for the direct comparison of simple code examples for each of the frameworks. 1 22nd December 2009, 10:34 pm

Django | Multiple Databases. Russell just checked in the final patch developed from Alex Gaynor’s Summer of Code project to add multiple database support to Django. I’d link to the 21,000 line changeset but it crashed our Trac, so here’s the documentation instead. 8 22nd December 2009, 5:22 pm

Crowdsourced document analysis and MP expenses

As you may have heard, the UK government released a fresh batch of MP expenses documents a week ago on Thursday. I spent that week working with a small team at Guardian HQ to prepare for the release. Here’s what we built: [... 2051 words]

Django-Jython 1.1.0 released. Django on Jython matches its minor version numbers to Django, so this new release is compatible with Django 1.1. 0 16th December 2009, 10:42 pm

Guardian iPhone app. Released today, ad-free, £2.39 for the application, has an excellent offline mode. I helped build the backend web service, which is a Django app running on EC2. 8 14th December 2009, 1:29 pm

Fixing Django Management Commands. Zachary Voase proposes dramatically improving Django’s management command API for Django 1.3. I’m in favour—management commands are one of the only APIs in Django that I have to look up every single time I use. My optfunc library was written partially with management commands in mind—Zachary favours the argparse library. 1 9th December 2009, 8:41 am

Python’s Moratorium—Let’s think about this. Jesse Noller explains the thinking behind the Python Language Moratorium (no new language features until Python 3.3) in great detail. It’s principally about allowing both end users and alternative implementations to catch up. The standard library will continue to evolve as normal. 6 5th December 2009, 5:33 pm

What’s coming in Django 1.2 (presentation notes). I wrote up some background notes for the talk on Django 1.2 I gave at DJUGL last week. 4 5th December 2009, 5:10 pm

Namespaces. Python’s approach to imports is possibly my favourite feature of the language. I love being able to scan up to the top of a file in my text editor and see exactly where every symbol comes from, no IDE required. 4 2nd December 2009, 9:31 am

Haystack 1.0 Final Released. I’ve used Haystack on a number of projects recently, and it has proved itself as a completely painless way of adding full-text search (using Solr or Whoosh—I haven’t tried the Xapian backend yet) to a Django ORM powered project in just a few minutes. Congratulations, Daniel + contributors. 5 30th November 2009, 8:07 am

Djangopeople JSON parser. Awesome—Andy McKay has compensated for the lack of an official DjangoPeople API by creating a JSONP screen scraped API and hosting it on App Engine. As far as I’m concerned this is an officially supported feature—I’ll make sure future site changes don’t break it, and when I do add an API I’ll try to keep it compatible and help Andy set up redirects. 6 28th November 2009, 11:29 am

Request Routing With URI Templates in Node.JS. I quite like this approach (though the implementation is a bit “this” heavy for my taste). JavaScript has no equivalent to Python’s raw strings, so regular expression based routing ala Django ends up being a bit uglier in JavaScript. URI template syntax is more appealing. 4 24th November 2009, 9:06 am

Woof—simply exchange files (via) Ultra simple file sharing for local networks: run “woof filename” to start a local web server which will serve up that file, just once, and then terminate. Can also serve up an entire directory as a compressed archive. Written in Python, as a single script which you can drop in to your ~/bin. “woof -s” serves the script itself, so you can easily pass it to someone who has a file you want. 8 24th November 2009, 8:44 am

django-batch-select (via) A smart attempt at solving select_related for many-to-many relationships in Django. Add a custom manager to your model and call e.g. Entry.objects.all()[:10].batch_select(“tags”) to execute two queries—one pulling back the first ten entries and another using an “IN” query against the tags table to pull back all of the tags for those entries in one go. 11 23rd November 2009, 4:19 pm

Debugging in Python. The missing manual for Python’s powerful pdb debugger. 0 18th November 2009, 12:34 pm

Drupal or Django? A Guide for Decision Makers. A surprisingly interesting comparison—the author describes Django as “a framework with CMS-like tendencies” and Drupal as “a CMS with framework-like tendencies”, then explores the benefits of those two different approaches. 8 15th November 2009, 10:14 pm

How to Make a US County Thematic Map Using Free Tools. This is the trick I’ve been using to generate choropleths at the Guardian for the past year: figure out the preferred colours for a set of data in a Python script and then rewrite an SVG file to colour in the areas. I use ElementTree rather than BeautifulSoup but the technique is exactly the same. The best thing about SVG is that our graphics department can export them directly out of Illustrator, with named layers and paths automatically becoming SVG ID attributes. Bonus tip: sometimes you don’t have to rewrite the SVG XML at all, instead you can generate CSS to colour areas by ID selector and inject it in to the top of the file. 4 12th November 2009, 10:49 am

Writing good documentation (part 1). Jacob explains some of the philosophy behind Django’s documentation. Topical guides are particularly interesting—many projects skip them (leaving books to fill the gap) but they fill an essential gap between tutorials and low-level reference documentation. 2 11th November 2009, 7:13 am

A history of Python packaging. A comprehensive history by Martijn Faassen, who argues that the existing set of tools tools works fine and has been working fine for several years. 1 10th November 2009, 8:48 pm

Fabric 0.9.0. A Python-based SSH automation and deployment tool. Released today, 0.9.0 is finally the official “stable” release—which is good, as it breaks API compatibility with previous versions and caused me all sorts of confusion when I tried to learn Fabric recently. 4 9th November 2009, 2:02 pm

Django-Jython 1.0.0 released! Now with database backends for PostgreSQL, Oracle and MySQL. The next release (planned for next month) should provide full compatibility with Django 1.1—the current release has 1.1 support for PostgreSQL but only 1.0 support for the other two databases. 4 9th November 2009, 1:53 pm

Python in the Scientific World. Python continues to make strides in the scientific world—and the Hubble Space Telescope team have been using it for 10 years! 1 6th November 2009, 11:04 am

Frank Wierzbicki: Leaving Sun. Frank performed miracles at Sun and before, helping bring the Jython project out of stasis and turning it in to an active, community maintained modern Python implementation. If you’re looking for an expert Python/Java/Dynamic languages guy you should snap him up. 1 4th November 2009, 10:33 pm

Large Problems in Django, Mostly Solved: Search. Eric Holscher shows how Haystack uses a number of common Django patterns (object registration, pluggable backends, QuerySet-style chaining and class-based views) to great effect in creating a powerful search application for Django. Makes me wonder if more of those patterns should be promoted to first class concepts within Django. 1 3rd November 2009, 10:42 am

Exploring Python (via) Notes from the introduction to Python presentation I gave today at Stack Overflow DevDays Amsterdam. 1 2nd November 2009, 3:35 pm

pudb. A full-screen, curses console based visual debugger for Python, built using the urwid console UI library. 3 1st November 2009, 12:09 pm

Django 1.2 planned features. The votes are in and the plan for Django 1.2 has taken shape—features are split in to high, medium and low priority. There’s some really exciting stuff in there—outside of the things I’ve already talked about, I’m particularly excited about multidb, Model.objects.raw(SQL), the smarter {% if %} tag and class-based generic views. 10 26th October 2009, 10:38 am

Twisted inlineCallbacks and deferredGenerator. inlineCallbacks are a brilliant (but seemingly under-promoted) feature of Twisted which use the ability to return a value from a yield statement to make asynchronous callbacks look much more like regular sequential programming. 3 25th October 2009, 11:30 pm

Why I like Redis

I’ve been getting a lot of useful work done with Redis recently. [... 900 words]

Introducing Cloudera Desktop. It’s a GUI for Hadoop, and under the hood is a whole stack of open source software, including Python, Django, MooTools, Twisted, lxml, CherryPy, Mako, Java and AspectJ. 3 21st October 2009, 6:48 pm

Django security updates released. A potential denial of service vulnerability has been discovered in the regular expressions used by Django form library’s EmailField and URLField—a malicious input could trigger a pathological performance. Patches (and patched releases) for Django 1.1 and Django 1.0 have been published. 4 10th October 2009, 12:24 am

MichaelMoore.com in Django. A seriously impressive case study—a complete rebuild from the ground up completed in just five weeks using Django, Solr and Haystack for a high traffic site with a top 10,000 US Alexa ranking. 1 9th October 2009, 12:38 am

Twisted Web in 60 seconds. A common complaint about Twisted is how hard it is to figure out the web stack. Jp Calderon’s tutorial (in nine installments and counting) is the best documentation on web development in Twisted I’ve seen. 3 8th October 2009, 11:48 am

Python is Unix. Jacob ports Ryan Tomayko’s simple prefork network server to Python. 0 7th October 2009, 11:43 am

History of Django’s popularity. “What sequence of events made Django the most popular Python web framework?”—insightful answers from Alex Martelli and James Bennett. 4 4th October 2009, 10:29 am

MySQL Connector/Python. A pure Python implementation of the MySQL client/server protocol, meaning you can talk to a MySQL server from Python without needing to first install the MySQL client libraries (which often requires compiling from source). 2 2nd October 2009, 2:16 pm

TypePad Motion. Launched today at FOWA, Motion is a microblogging application written in Django that uses the TypePad API for all persistent storage—which means you can deploy it as server-side code on your own site, but scaling horizontally is handled by TypePad (you just need to scale out the state-free front end). 3 1st October 2009, 3:51 pm

Python Logging 101. A really useful introduction to Python’s logging module by that module’s author, Vinay Sajip. 1 29th September 2009, 6:40 pm

Django ponies: Proposals for Django 1.2

I’ve decided to step up my involvement in Django development in the run-up to Django 1.2, so I’m currently going through several years worth of accumulated pony requests figuring out which ones are worth advocating for. I’m also ensuring I have the code to back them up—my innocent AutoEscaping proposal a few years ago resulted in an enormous amount of work by Malcolm and I don’t think he’d appreciate a repeat performance. [... 1674 words]

MySQL, Python and MacOS X 10.6 (Snow Leopard). I gave up on compiling things when I upgraded to Snow Leopard—I’m back to running Ubuntu in a VMWare instance, mounted over Samba so I can still use TextMate. 5 25th September 2009, 10:14 pm

Diesel. Yet Another Asynchronous Python Comet Library, of interest because this is the first one I’ve seen that uses Python’s generator coroutines, taking advantage of the return value of the yield statement to feed messages in to a generator function. Currently only works on Python 2.6 on Linux due to a dependency on 2.6’s epoll support. 4 23rd September 2009, 5:15 pm

Fabric factory. Promising looking continuous integration server written in Django, which uses Fabric scripts to define actions. 0 21st September 2009, 6:35 pm

Tornado Web Server (via) An extremely exciting addition to the Python web landscape, Tornado is the open sourced version of FriendFeed’s custom web stack. It’s a non-blocking (epoll) Python web server designed for handling thousands of simultaneous connections, perfect for building Comet applications. The web framework is cosmetically similar to web.py or App Engine’s webapp but has decorators for writing asynchronous request handlers. The template language uses Django-style syntax but allows you to use full Python expressions. FriendFeed have benchmarked it handling 8,000 requests a second running as four load-balanced processes on a 4 core server. 0 10th September 2009, 9:32 pm

Why Python Pickle is Insecure. Because pickle is essentially a stack-based interpreter, so you can put os.system on the stack and use it to execute arbitrary commands. 3 9th September 2009, 11:04 pm

Debugging Django in Production Revisited. Eric Holscher expands his show-technical-errors-to-superusers middleware to only show them to users in the group named “Technical Errors”. 0 7th September 2009, 5:21 am

svnpubsub.py (via) A Twisted/Python powered comet API for pushing out Subversion commits, built for Apache Foundation projects. 0 6th September 2009, 9:50 pm

And so it goes, around again. Charles Miller on Java, pointing out that if you don’t have closures and first-class functions you end up having to add band-aid solutions and special case syntactic sugar. Python’s lack of multi-line lambdas leads to a similar (though less pronounced) effect. 3 3rd September 2009, 9:46 am

Exploring OAuth-Protected APIs. One of the downsides of OAuth is that it makes debugging APIs in your browser much harder. Seth Fitzsimmons’ oauth-proxy solves this by running a Twisted-powered proxy on your local machine which OAuth-signs every request going through it using your consumer key, secret and tokens for that API. Using it with a browsers risks exposing your key and token (but not secret) to sites you accidentally browse to—it would be useful if you could pass a whitelist of API domains as a command line option to the proxy. 1 23rd August 2009, 11:06 am

easy_install no longer working with SourceForge-hosted projects? Unsurprising, since installation software (which is often run as root) that crawls the web and scrapes HTML pages for download links is a horrible, horrible idea. 0 19th August 2009, 11:38 am

Kung Fu People (via) The first site to launch based on the open source Django code from djangopeople.net! 1 19th August 2009, 11:37 am

How do you install lxml on OS X Leopard without using MacPorts or Fink? I’ve asked on Stack Overflow... hope I get a good answer. 2 14th August 2009, 1:04 pm

Python logging from multiple processes. Use Python’s socket log handler to send all log messages to a single server—the python-loggingserver project implements such a server as a Twisted application with a handy web interface for viewing the aggregated logs. 0 13th August 2009, 11:55 pm

Scriptlets—Quick web scripts (via) From the prolific Jeff Lindsay, a pastebin-style tool for short server-side scripts written in Python, JavaScript or PHP that executes them within a Google App Engine powered sandbox. The Java code that implements the service is available on GitHub. 1 13th August 2009, 1:51 pm

minixsv (via) As far as I can tell, this is the only library that can validate XML using pure Python (no C extension required). I’d be extremely happy if someone would write a pure Python library (or one that only depends on ElementTree, which is included in the standard library) for validating XML against a Relax NG Compact syntax schema. Even DTD validation would be better than nothing! 1 12th August 2009, 4:59 pm

topia.termextract. Impressive Python term extraction library (similar to the various term extraction web APIs but you can run it on your own hardware), incorporating a Parts-Of-Speech tagging algorithm. 1 10th August 2009, 9:26 pm

Richard Jones: Something I’m working on... Python’s with statement appears to provide just enough syntactic sugar to create some really interesting DSL-style APIs—here’s a very promising example for laying out GUI applications. 1 7th August 2009, 3:47 pm

Django: Security updates released. A fix for a directory traversal attack in the Django development server (the one with the big “never run this in production” warnings in the documentation). Also reminds that the release of 1.1 means that 0.96, released over two years ago, has reached end of life and will not receive any further bug fixes after the just-released 0.96.4. 0 29th July 2009, 1:45 pm

Django 1.1 release notes (via) Django 1.1 is out! Congratulations everyone who worked on this, it’s a fantastic release. New features include aggregate support in the ORM, proxy models, deferred fields and some really nice admin improvements. Oh, and the testing framework is now up to 10 times thanks to smart use of transactions. 1 29th July 2009, 9:34 am

NASA NEBULA Services (via) NASA’s new NEBULA cloud computing platform appears to be built entirely on open source infrastructure, including Python, Django, Fabric, Eucalyptus, RabbitMQ, Trac and Solr. 4 28th July 2009, 12:10 pm

Fabric, Django, Git, Apache, mod_wsgi, virtualenv and pip deployment. I’m slowly working my way through this stack at the moment—next stop, fabric. 2 28th July 2009, 11:56 am

Install Django, GeoDjango, PostgreSQL and PostGIS on OSX Leopard. This tutorial worked perfectly for me. 1 24th July 2009, 11:47 am

xmlwitch. An XML building library for Python that doesn’t suck (I love ElementTree for parsing XML, but I’ve never really liked it for generation). Makes smart use of the with statement. 1 24th July 2009, 12:33 am

Django 1.1 release candidate available. If all goes well, the final release will be out next week. 1 22nd July 2009, 12:19 pm

Curating conversations. Chris Thorpe has open-sourced the Guardian’s moderated Twitter backchannel app, for displaying back channels at high profile (and hence high potential for abuse) events. It’s a Python application that runs on App Engine. 0 16th July 2009, 7:34 pm

Tools of the Modern Python Hacker: Virtualenv, Fabric and Pip. Ashamed to say I’m not using any of these yet—for Django projects, my manage.py inserts an “ext” directory at the beginning of the Python path which contains my dependencies for that project. 6 9th July 2009, 11:40 am

Tips on using python’s datetime module. Wow. I’ve run in to problems with datetime and timezones before, but I had no idea how intrinsic those problems were to the design of the library. 3 6th July 2009, 2:20 pm

Address Extractor. Running on App Engine, an address extractor web service using code from the EveryBlock open source release. 1 1st July 2009, 8:03 pm

EveryBlock source code released. EveryBlock’s Knight Foundation grant required them to release the source code after two years, under the GPL. Lots of neat Django / PostgreSQL / GIS tricks to be found within. 1 1st July 2009, 8:01 pm

What’s New In Python 3.1. Lots of stuff, but the best bits are an ordered dictionary type (congrats, Armin), a Counter class for counting unique items in an iterable (I do this on an almost daily basis) and a bunch of performance improvements including a rewrite of the Python 3.0 IO system in C. 0 28th June 2009, 3:02 pm

Towards a Standard for Django Session Messages. I completely agree that Django’s user.message_set (which I helped design) is unfit for purpose, but I don’t think sessions are the right solution for messages sent to users. A signed cookie containing either the full message or a key referencing the message body on the server is a much more generally useful solution as it avoids the need for a round trip to a persistent store entirely. 1 19th June 2009, 9:57 pm

Investigate your MP’s expenses. Launched today, this is the project that has been keeping me ultra-busy for the past week—we’re crowdsourcing the analysis of the 700,000+ scanned MP expenses documents released this morning. It’s the Guardian’s first live Django-powered application, and also the first time we’ve hosted something on EC2. 14 18th June 2009, 11:16 pm

Jython 2.5.0 Final is out! It’s been a long time coming—congratulations to the team. 0 16th June 2009, 11:21 pm

Installing Django, Solr, Varnish and Supervisord with Buildout. Useful, detailed instructions... but I still think this stuff is Way Too Difficult at the moment. I’m a big fan of the idea of sites that are assembled from multiple smaller web services talking HTTP to each other, but ensuring all the moving parts stay running is massively more painful than just running Apache and MySQL. 1 7th June 2009, 1:54 pm

Perl 6: The MAIN sub (via) “Calling subs and running a typical Unix program from the command line is visually very similar: you can have positional, optional and named arguments.”—that’s exactly what I was thinking when I came up with optfunc. 0 28th May 2009, 9:32 pm

optfunc. Command line parsing libraries in Python such as optparse frustrate me because I can never remember how to use them without consulting the manual. optfunc is a new experimental interface to optparse which works by introspecting a function definition (including its arguments and their default values) and using that to construct a command line argument parser. Feedback and suggestions welcome! 23 28th May 2009, 7:38 pm

geocoders. A fifteen minute project extracted from something else I’m working on—an ultra simple Python API for geocoding a single string against Google, Yahoo! Placemaker, GeoNames and (thanks to Jacob) Yahoo! Geo’s web services. 6 27th May 2009, 10:02 am

Testing Django Views for Concurrency Issues. Neat decorator for executing a Django view under high concurrency in your unit tests, to help spot errors caused by database race conditions that should be executed inside a transaction. 0 27th May 2009, 10:01 am

uuidd.py. Neat implementation of an ID server from Mike Malone—it serves up incrementing integers over a socket (using Python’s asyncore for fast IO) and records state to a file only after every 10,000 IDs served, so most of the time it’s not reading or writing to disk at all. If the server crashes it doesn’t matter because it can start up again at an integer it’s sure hasn’t been used before. 4 25th May 2009, 9:34 pm

Working with Python and RabbitMQ. Nathan Borror eliminates the boilerplate needed to talk to RabbitMQ (or any other AMQP queue server) from Python. 0 21st May 2009, 11:10 pm

Django tip: Caching and two-phased template rendering. Neat trick for expensive pages which can be mostly cached with the exception of the “logged in as” bit—run them through the template system twice, caching the intermediary generated template. 1 19th May 2009, 1:34 am

djng—a Django powered microframework

djng is nearly two weeks old now, so it’s about time I wrote a bit about the project. [... 1500 words]

python-daemon (via) A library for correctly creating Unix daemon processes in Python, implementing the proposed PEP 3143 API. 0 18th May 2009, 10:12 am

python-spidermonkey. A Python to JavaScript bridge using Mozilla Spidermonkey. Expose Python objects to JavaScript, or execute JavaScript from Python. 0 14th May 2009, 3:56 pm

South’s Design. Andrew Godwin explains why South resorts to parsing your models.py file in order to construct information about for creating automatic migrations. 0 13th May 2009, 12:30 pm

Contextual (via) I’ve been trying to figure out a sane way to replace Django’s settings.py global module with something that’s designed to be reconfigured at run-time. Contextual appears to be trying to solve exactly that problem. 4 12th May 2009, 1:19 pm

disturbyte’s zenqueue. Simple, tiny and fast Python message queue server built on top of coroutines and Eventlet, using JSON over TCP as the message format. I’m impressed with how potentially useful this looks considering the small amount of code. The author benchmarks it at 28 thousand messages/second. 3 11th May 2009, 1:27 pm

Nose 0.11 released. My favourite Python testing tool just got some really neat new features, including the ability to parallelize tests across multiple processes (hence CPUs) using the multiprocess module, Xunit XML output for integration with continuous integration tools and a --failed switch to re-run only the last batch of failed tests. 0 8th May 2009, 11:24 am

hash_ring 1.2. A Python library for consistent hashing with memcached, using MD5 and the same algorithm as libketama. Exposes an interface that is identical to regular memcache making this a drop-in replacement. 5 5th May 2009, 1:45 pm

djangopeople.net on GitHub. I’ve released the source code for Django People, the geographical community site developed last year by myself and Natalie Downe (it hasn’t otherwise been touched since April last year, so it needs porting to Django 1.1). If you want a new feature on the site, implement it and I’ll see about merging it in. 10 4th May 2009, 6:12 pm

Right now, pypy compiled with JIT can run the whole CPython test suite without crashing, which means we’re done with obvious bugs and the only ones waiting for us are really horrible.

Maciej Fijalkowski 0 1st May 2009, 3:04 pm

django-piston. Promising looking Django mini-framework for creating RESTful APIs, from the bitbucket team. Ticks all of Jacob’s boxes, even including built-in pluggable authentication support with HTTP Basic, Digest and OAuth out of the box. 0 30th April 2009, 7:55 pm

REST worst practices. Jacob Kaplan-Moss’ thoughts on the characteristics of a well designed Django REST API library, from November 2008. 0 30th April 2009, 7:53 pm

python-sqlparse (via) Python library for re-identing SQL statements. This could make debugging Django’s generated SQL a whole lot easier. You can try the library out using an App Engine hosted application (complete with an API). 0 28th April 2009, 8:25 pm

A Curious Course on Coroutines and Concurrency. David Beazley’s sequel to last year’s mind-expanding “Generator Tricks for System Programmers”, perfect for if you’ve ever puzzled over what exactly you can use Python’s generator-based coroutine support for. 0 24th April 2009, 10:58 am

Finding and fixing memory leaks in Python. Using Dozer, a clever piece of WSGI middleware which displays sparklines of Python object counts and allows you to introspect them, using the gc module under the hood. 3 22nd April 2009, 12:16 pm

pubsubhubbub. From Brad Fitzpatrick, a simple but clever way of using web hooks (HTTP callbacks) to inform subscribers that an Atom feed has updated in almost real-time—solving the constant polling problem and making it easier for small sites to offer publish-subscribe APIs. Any Atom feed can delegate subscriber updates to a “hub” server. An example hub server implementation is provided running on App Engine. 0 20th April 2009, 6:49 pm

Phusion Passenger for nginx. Passenger (aka mod_rails / mod_rack) enables easy deployment of Rails and Ruby apps under Apache... and the latest version adds support for nginx as well. It works as an HTTP proxy and process manager, spawning worker processes and forwarding HTTP requests to them via a request queue. It can also handle Python WSGI applications—anyone tried it out for that yet? 19 20th April 2009, 4:53 am

Haystack (via) A brand new modular search plugin for Django, by Daniel Lindsley. The interface is modelled after the Django ORM (complete with declarative classes for defining your search schema) and it ships with backends for both Solr and pure-python Whoosh, with more on the way. Excellent documentation. 1 17th April 2009, 9:53 pm

Paul Buchheit: Make your site faster and cheaper to operate in one easy step. Paul promotes gzip encoding using nginx as a proxy, and mentions that FriendFeed use a “custom, epoll-based python server” as their application server. Does that mean that they’re serving their real-time comet feeds directly from Python? 0 17th April 2009, 5:19 pm

Drop ACID and think about data. I’ve been very impressed with the quality and speed with which the PyCon 2009 videos have been published. Here’s Bob Ippolito on distributed databases and key/value stores. 0 17th April 2009, 5:13 pm

Developing Django apps with zc.buildout. Jacob went ahead and actually documented one of Python’s myriad of packaging options. 0 16th April 2009, 9:50 am

Visualising Sorting Algorithms. Aldo Cortesi dislikes animations of sorting algorithms, so he designed a beautiful technique for statically visualising them instead (using Python and Cairo to generate the images). 0 14th April 2009, 8:55 am

django-shorturls. Jacob took my self-admittedly shonky shorter URL code and turned it in to a proper reusable Django application. 1 13th April 2009, 9:31 am

rev=canonical bookmarklet and designing shorter URLs

I’ve watched the proliferation of URL shortening services over the past year with a certain amount of dismay. I care about the health of the web and try to ensure that URLs I am responsible will last for as long as possible, and I think it’s very unlikely that all of these new services will still be around in twenty years time. Last month I suggested that the Internet Archive start mirroring redirect databases, and last week I was pleased to hear that Archiveteam, a different organisation, had already started crawling. [... 920 words]

Scaling Django web apps on Apache. Cool to see this kind of article cropping up on IBM developerWorks, but it’s a shame they don’t mention mod_wsgi. 0 10th April 2009, 9:23 am

Finding similar items with Amazon Elastic MapReduce, Python, and Hadoop streaming. Tutorial for running Hadoop jobs on Elastic MapReduce using Python and the 2005 Audioscrobbler dataset. 0 7th April 2009, 9:19 am

Rabbits and warrens. Handy tutorial introduction to using RabbitMQ and AMQP with Python. 0 7th April 2009, 9:13 am

Automating PowerPoint with Python. Useful tutorial on using ActivePython’s win32com module to automate PowerPoint. The example code pulls in the top 50 banks by assets from the Guardian Data Store and generates a treemap using PowerPoint’s shape drawing primitives. 2 3rd April 2009, 3:13 pm

How to use Django with Apache and mod_wsgi. My favourite deployment option is now included in the official Django docs, thanks to Alex Gaynor. I tend to run a stripped down Apache with mod_wsgi behind an nginx proxy, and have nginx serve static files directly. This avoids the need for a completely separate media server (although a separate media domain is still a good idea for better client-side performance). 9 1st April 2009, 12:24 am

Apparently [unladen-swallow] is already 30% faster than CPython, and this version is being used to run some of the Python code on YouTube.

Ted Leung 1 30th March 2009, 10:10 am

ProjectPlan—unladen-swallow. A branch of Python 2.6 aiming to radically improve performance (the target is a 5x improvement), by compiling Python to machine code using LLVM’s JIT engine. I think this is a Google 20% time project (or maybe not, see the comments). An early version without LLVM is already available for download. 1 30th March 2009, 10:09 am

Future roadmap for mod_wsgi. mod_wsgi 3.0 isn’t too far off, and will include Python 3.0 support, WSGI application preloading and internal web server redirection (similar to nginx X-Accel-Redirect). Version 4.0 plans a major architectural change that will allow multiple versions of Python to be run from the same Apache. 0 19th March 2009, 5:27 pm

Parrot 1.0.0 “Haru Tatsu” Released! Parrot hits 1.0! Anyone know how complete Pynie, the Python implementation on top of Parrot is? 3 19th March 2009, 3:17 pm

Load spikes and excessive memory usage in mod_python. “The final answer? Stop using mod_python, use mod_wsgi and run it with daemon mode instead. You will save yourself a lot of headaches by doing so.” 3 16th March 2009, 5:26 pm

Concurrence. Exciting: a Python framework for “creating massively concurrent network applications” (the tutorial benchmarks a Hello World web server at over 8,000 requests a second). It’s implemented on top of libevent using pyrex, can run on either Stackless Python or Greenlets from the py library and ships with a WSGI server, an HTTP client and a DBAPI 2.0 compliant MySQL driver. 0 15th March 2009, 1:28 pm

Ruby on Rails 2.3 Release Notes. I’m impressed with how thoroughly Rails has embraced Rack (Ruby’s standardised web framework API, inspired by Python’s WSGI). 0 15th March 2009, 1:22 pm

A few notes on the Guardian Open Platform

This morning we launched the Guardian Open Platform at a well attended event in our new offices in Kings Place. This is one of the main projects I’ve been helping out with since joining the Guardian last year, and it’s fantastic to finally have it out in the open. [... 839 words]

It’s time for a change. Jacob Kaplan-Moss is joining Revolution Systems, who will now be offering professional Django support “to companies who need a Django expert on staff, but can’t afford someone full-time.” 3 4th March 2009, 10:30 pm

Django snippets: Smart {% if %} template tag. Chris Beaven’s drop-in replacement for Django’s {% if %} tag that adds comparison operators (less than, greater than, not equal etc) while staying backwards compatible with the less able original. I love it. This is one place where I no longer favour Django’s stated philosophy: I think it’s perfectly reasonable to use comparisons in presentation logic, and I’ve found that in my own code the lack of an advanced if tag frequently leads to pure presentation logic sneaking in to my view functions. 5 3rd March 2009, 3:03 pm

How FriendFeed uses MySQL to store schema-less data. The pain of altering/ adding indexes to tables with 250 million rows was killing their ability to try out new features, so they’ve moved to storing pickled Python objects and manually creating the indexes they need as denormalised two column tables. These can be created and dropped much more easily, and are continually populated by an off-line index building process. 0 27th February 2009, 2:33 pm

django-springsteen and Distributed Search. Will Larson’s Django search library currently just talks to Yahoo! BOSS, but is designed to be extensible for other external search services. Interestingly, it uses threads to fire off several HTTP requests in parallel from within the Django view. 0 25th February 2009, 10:28 pm

FAPWS3-0.2 (WSGI server based on libev). Another strong contender for Python’s answer to Mongrel—3500 requests/s for static files, 43 for a simple dynamic (Django powered) pages and 4.8 for a heavy SQL query—all benchmarked with 300 concurrent requests. 4 25th February 2009, 10:21 pm

The History of Python: Adding Support for User-defined Classes. Guido designed the run-time representation first, and tried to design the syntax to include as few new parsing concepts as possible. The origins of explicit self are also explained. 0 18th February 2009, 11 pm

DB2 support for Django is coming. From IBM, under the Apache 2.0 License. I’m not sure if this makes it hard to bundle it with the rest of Django, which uses the BSD license. 2 18th February 2009, 10:58 pm

Announcing django-viewtools. A really excellent idea—run ./manage.py viewtools --pdb /path/on/site/ to debug a view in your Django project that is raising an error using the Python debugger, or use --profile to run the full request cycle for that URL through the profiler. 1 17th February 2009, 9:35 pm

CloudMade: A Summary of the Future of Mapping. CloudMade are now offering commercially supported APIs on top of OpenStreetMap, including geocoding, routing and tile access libraries in Python/Ruby/Java and a very neat theming tool that lets you design your own map styles. This is really going to kick innovation around OpenStreetMap up a notch. 0 17th February 2009, 11:25 am

Dulwich. A pure Python implementation of the Git file format and protocols. Reinforces my impression that a key to Git’s success is stable, well designed and documented on-disk formats. 3 16th February 2009, 10:27 pm

Write to a Google Spreadsheet from a Python script. I didn’t know Google Spreadsheets could directly serve dynamic images that automatically update when the underlying data changes. 0 16th February 2009, 9:02 pm

Xapian performance comparision with Whoosh. Whoosh appears to be around four times slower than Xapian for indexing and empty cache searches, but Xapian with a full cache blows Whoosh out of the water (5408 searches/second compared to 26.3). Considering how fast Xapian is, that’s still a pretty impressive result for the pure-Python Whoosh. 1 14th February 2009, 1:15 pm

pytyrant. A pure-python client library for the Tokyo Tyrant binary protocol (used to access Tokyo Cabinet databases over a network). The library appears to be developed by Bob Ippolito and the team at Mochi Media. 0 14th February 2009, 11:19 am

EuroDjangoCon 2009. Tickets are now on sale for the conference, scheduled for 4th-6th of May (not March as I originally said) in Prague (followed by two days of development sprints). 1 12th February 2009, 4:59 pm

Whoosh. A brand new, pure-python full text indexing engine (think Lucene). Claims to offer performance in the same league as wrappers to C or Java libraries. If this works as well as it claims it will be an excellent tool for adding search to projects that wish to avoid a dependency on an external engine. 5 12th February 2009, 12:49 pm

Django Settings Tip—Setting Relative Paths. This is the first thing I do in every single one of my Django projects—it makes projects relocatable to other machines with just a couple of lines of code. I wouldn’t be at all upset to see it added to the default Django settings.py file created by ./manage.py startproject 1 12th February 2009, 12:30 pm

Google App Engine: A roadmap update! Receiving e-mail, background tasks and XMPP. I predict a bunch of sites will start building small parts of their overall functionality on App Engine when some of these features land (much easier than hosting your own custom XMPP server). 0 9th February 2009, 7 pm

jessenoller.com—python magazine. Jesse Noller has been sharing his articles originally published in Python Magazine. Topics include SSH programming with Paramiko, context managers and the with statement and an excellent explanation of Python’s threading support and the global interpreter lock. 0 5th February 2009, 11:10 pm

solango. Another attempt at a Django/Solr integration library, based on code written for “a top 20 newspaper site” (I’d love to know which one). This is well documented, uses a registration model clearly inspired by the Django admin which keeps search related metadata out of your regular models and includes management commands for re-indexing and generating Solr schema.xml files. 1 4th February 2009, 12:22 pm

juno. An ultra-lightweight Python web framework inspired by Ruby’s Sinatra. 3 4th February 2009, 10:48 am

Changeset 9793: SMTP testing documentation. I didn’t know this trick: running “python -m smtpd -n -c DebuggingServer localhost:1025” will start up a simple SMTP server which dumps received e-mails to the terminal instead of forwarding them on. 3 29th January 2009, 1:35 pm

Giant, Python Powered Robots. “They each weigh about 11 tonnes and have a 17 meter reach. The control system is written in Python, with small sections of C which run in hard-real-time to guarantee safety.” 0 28th January 2009, 10:35 am

Sharding Counters on Google App Engine. “While the datastore for App Engine scales to support a huge number of entities it is important to note that you can only expect to update any single entity, or entity-group, about five times a second”. This article explains a technique for sharding writes across multiple counters in detail, including a way to keep a memcache counter updated at the same time for faster reads. 1 27th January 2009, 8:27 pm

Dive into Python 3. Mark Pilgrim’s seminal work taught me Python nearly eight years ago. Now he’s updating it to cover Python 3. It’s just a table of contents at the moment, but the chapter on “Packaging Python libraries” has me very excited. 1 26th January 2009, 6:10 pm

google-mobwrite. Neal Fraser’s terrifyingly clever differential synchronization algorithm (for SubEthaEdit-style collaboration over the web) is now available as an open source Python and JavaScript library. 2 24th January 2009, 11:55 pm

EuroDjangoCon. 4th-6th of May 2009, in Prague. Talk submissions are open now, and registration starts on the 6th of February. 0 24th January 2009, 6:54 pm

New PylonsHQ Site Launches. The new site uses CouchDB instead of a relational database, and the code for the site is open source so you can see how it all works. 1 22nd January 2009, 6:33 pm

Train Crash Leads LA Times to Create Django Database on Deadline. A story from last September. I didn’t know the LA Times used Django. UPDATE: Yes I did, I introduced their panel about it at DjangoCon. Sorry, mind like a sieve sometimes. 2 21st January 2009, 5:19 pm

What is django.contrib? I’d add that including a package in django.contrib is a promise that the core development team will ensure that package is updated to work with future versions of Django. 0 20th January 2009, 10:58 am

Load Windows ICO files. Apparently PIL has trouble with the most recent versions of the windows .ico format (Vista now embeds PNG images in them)—this clever function deals with the differences and gives back a PIL Image object. 0 17th January 2009, 9:48 pm

Washington Post Update. Peter Harkins summarises the large number of Django-powered database journalism projects released by the Post since September 2007. 1 16th January 2009, 12:18 pm

Django now has fast tests. Changeset 9756 switched Django’s TestCase class to running tests inside a transaction and rolling back at the end (instead of doing a full dump and reload). “Ellington’s test suite, which was taking around 1.5-2 hours to run on Postgres, has been reduced to 10 minutes.” 3 16th January 2009, 11:40 am

Localbuilder. Gareth Rushgrove’s neat little Python continuous integration tool—it watches a directory for changes, then runs a command when it spots any. 0 14th January 2009, 10:57 pm

The History of Python (via) “A series of articles on the history of the Python programming language and its community”, being compiled by Guido plus guest authors. 0 14th January 2009, 9:42 am

The Django Book: Version 2.0 (via) Adrian’s working on a new edition of the Django Book updated to cover version 1.0. As with the first edition, it will be available free online in addition to a published Apress paperback. The first three chapters are now available. 0 9th January 2009, 2:54 pm

Rate limiting with memcached

On Monday, several high profile “celebrity” Twitter accounts started spouting nonsense, the victims of stolen passwords. Wired has the full story—someone ran a dictionary attack against a Twitter staff member, discovered their password and used Twitter’s admin tools to reset the passwords on the accounts they wanted to steal. [... 910 words]

Represent. Andrei Scheinkman and Derek Willis describe how they built the NYTimes Represent feature using GeoDjango and PostGIS. 0 29th December 2008, 10:10 pm

pygooglechart. I tried a bunch of Python wrappers for Google Charts and liked this one best. 5 22nd December 2008, 11:43 am

Represent and GeoDjango. The NYTimes new Represent application is built on GeoDjango. 0 20th December 2008, 9:07 pm

How to install lxml python module on mac os 10.5 (leopard). Instructions that work! Finally, I can find out what all the fuss is about. 1 15th December 2008, 12:05 am

On packaging. James Bennett discusses the problems with setuptools (and ruby gems), and recommends Ian Bicking’s pip as a setuptools replacement. 0 14th December 2008, 4:57 pm

lxml: an underappreciated web scraping library. I just wish I could get the wretched thing to install on OS X Leopard without resorting to MacPorts. 2 11th December 2008, 9:54 am

I don’t think that Python 3.0 is a bad thing. But that it’s displayed so prominently on the Python web site, without any kind of warning that it’s not going to work with 99% of the Python code out there, scares the hell out of me. People are going to download and install 3.0 by default, and nothing’s going to work. They’re going to complain, and many are going to simply walk away.

Christopher Lenz 2 6th December 2008, 10 am

pyquery. “A jQuery-like library for Python”—implemented on top of lxml, providing jQuery style methods for manipulating an HTML or XML document. 1 6th December 2008, 9:53 am

Python 3.0. “We are pleased to announce the release of Python 3.0 (final), a new production-ready release, on December 3rd, 2008.” 0 4th December 2008, 12:38 pm

Django 1.0.2 released. An update to last week’s 1.0.1 release, which I failed to link to. 1.0.2 mainly fixes some packaging issues, while 1.0.1 contains “over two hundred fixes to the original Django 1.0 codebase”. The team are holding up the promise to move to a regular release cycle after 1.0. 0 19th November 2008, 8:46 am

The new Lawrence.com. The world’s best local entertainment website, relaunched on Django 1.0 with an accompanying substantial redesign. 1 18th November 2008, 2:25 pm

Secrets of the Django ORM. An undocumented (and unsupported) method of poking a Django QuerySet’s internal query to add group_by and having clauses to a SQL query. 0 8th November 2008, 11:49 pm

Python gems of my own (via) Did you know you can pass 128 as a flag to Python’s re.compile() function to spit out a parse tree? I didn’t. re.compile(“pattern”, 128) 2 3rd November 2008, 11:59 am

Beanstalkd / Python Basic Tutorial. How to get up and running quickly with my favourite light-weight queue server. If only it had persistence... 0 20th October 2008, 11:40 pm

What’s New in Python 2.6 (via) Python 2.6 final has been released (the last 2.x version before 3.0). multiprocessing and simplejson (as json) are now in the standard library, any backwards compatible 3.0 features have been added and the official docs are now powered by Sphinx (used by Django 1.0 as well). There’s plenty more. 10 2nd October 2008, 11:47 am

simplejson 2.0.1. Python’s simplejson JSON library got a whole lot faster while I wasn’t looking. 0 1st October 2008, 10:55 pm

Reia. The most common complaint I see about Erlang is the syntax. Reia is a Python-style scripting language (with a dash of Ruby) that runs on the Erlang virtual machine. Looks promising. 3 25th September 2008, 6:12 pm

Decorator to limit request rates to individual views. Neat piece of code for public facing web APIs written in Django. Update: some smart criticisms in the comments. 2 24th September 2008, 1:13 pm

bpgsql. Barry Pederson’s pure Python PostgreSQL client library now ships with a Django backend. 0 23rd September 2008, 11:42 am

RestView—a class for creating a view that dispatches based on request.method (via) I finally got around to writing up a simple approach I’ve been using for REST-style view functions in Django that dispatch based on request.method. 1 21st September 2008, 8:47 pm

backup_to_s3.py. I wrote Yet Another S3 backup script today. It’s a thin wrapper about boto that doesn’t do anything particularly impressive, but it fits my brain. 4 21st September 2008, 6:51 pm

Django version 1.1 roadmap. Django 1.1 is due out in March, but the deadline for feature proposals is November the 7th. 0 20th September 2008, 7:17 pm

Django’s release process. Django is moving to time-based releases, with minor releases (new features but no backwards incompatible changes) approximately every six months. 0 20th September 2008, 7:16 pm

DjangoCon and learning from Zope 2. Mark Ramm presented probably the most thought-provoking talk at DjangoCon. He’s started writing it up as a series of posts. 14 17th September 2008, 11:25 pm

YouTube Playlist: DjangoCon 2008 Sessions. YouTube’s tag and search indexes appear to lag behind the main site by quite a while; this appears to be the definitive index page for videos of talks at DjangoCon. 3 16th September 2008, 4:50 am

YouTube: djangocon tag. Google have started posting videos of presentations at DjangoCon on YouTube. 3 16th September 2008, 2:43 am

DjangoCon and PyCon UK

September is a big month for conferences. DjangoCon was a weekend ago in Mountain View (forcing me to miss both d.Construct and BarCamp Brighton), PyCon UK was this weekend in Birmingham, I’m writing this from @media Ajax and BarCamp London 5 is coming up over another weekend at the end of this month. As always, I’ve been posting details of upcoming talks and notes and materials from previous ones on my talks page. [... 446 words]

Kevin Teague explains the Python packaging ecosystem. The distinction between setuptools, PyPI, distutils, eggs, easy_install, pkg_resources and zc.buildout used to make my head spin. Kevin Teague’s outstanding explanation made it all make sense. 1 15th September 2008, 2:06 pm

django-batchadmin (via) Seriously classy reusable Django app that adds batch editing (multiple delete by default, with hooks to add your own custom batch actions) to the Django admin changelist screen, using best practice techniques of sub-classing ModelAdmin and hence requiring no patches to Django core itself. 0 15th September 2008, 10:46 am

Using Python and Stompserver to Get Started With Message Queues. An eminently practical guide to this year’s Hot New Thing (for web developers at least) from Gareth Rushgrove. 0 14th September 2008, 11:39 pm

Django snippets: Orderable inlines using drag and drop with jQuery UI. Code example from my PyCon tutorial on customising the Django admin interface. 3 13th September 2008, 12:19 pm

The TimeToLead.eu technical stack: Django and Flex. Nice case study of a site using Django’s i18n support along with django-rosetta. 0 11th September 2008, 8:33 pm

Prototype based programming in python. Neat implementation of JavaScript-style prototype inheritance in Python. 1 11th September 2008, 5:50 pm

django-html. A small project I’m working on to make Django behave better with regards to HTML v.s. XHTML. 11 9th September 2008, 11:59 pm

Django snippets: server with debugging backdoor. Six lines of code that uses spawning to fire up a Django server on port 8000 and a remote interactive interpreter backdoor on port 8001, so you can interogate the state of your server within the same process. 0 8th September 2008, 10:15 pm

Django tickets with keyword “djangocon”. Adrian and Jacob ran an “I want a pony” session during their closing keynote at DjangoCon—I’ve filed the feature requests as tickets tagged with the “djangocon” keyword. 1 8th September 2008, 3:02 am

Django 1.0 release notes. What’s new in Django 1.0. Short answer: one heck of a lot. 0 4th September 2008, 1:10 am

Django 1.0 released! Outstanding. Massive thanks to everyone who contributed. We made it! 0 4th September 2008, 1:08 am

Low level hooks for multi-database support in Django. As discussed in this sub-thread on reddit: The internal Django Query class has a ’connection’ attribute which can be set by the constructor. This low level hook is the secret to talking to more than one database at once, but higher level APIs have not yet been defined. Jacob Kaplan-Moss: “As a matter of fact, at least a couple high-traffic Django sites are using the new hooks.” 3 3rd September 2008, 11:33 pm

dmigrations thread on Django Nashville. The Django Nashville Google Group is currently hosting the most interesting discussion of dmigrations. 0 3rd September 2008, 10:36 pm

Announcing dmigrations

The team at Global Radio (formerly GCap Media) is the largest group of Django developers I’ve personally worked with, consisting of 14 developers split into two scrum teams, all contributing to the same overall codebase. [... 625 words]

What’s New in Python 2.6. The new multiprocessing package looks pretty useful, especially as it provides a way to work around Python’s GIL. 1 1st September 2008, 9:03 pm

Using Akismet with Django’s new comments framework. A nice example that demonstrates two features that were recently rolled in to the Django 1.0 betas: the new signals library and the new comments framework. 2 28th August 2008, 10:12 am

URLsafe base64 encoding/decoding in two lines. A much better solution than my base65 hack—if you understand how base64 padding works (I didn’t) you can use it to generate URL-safe compressed hashes. Performance should be significantly better than my version. 0 28th August 2008, 9:57 am

Django snippets: Sign a string using SHA1, then shrink it using url-safe base65. I needed a way to create tamper-proof URLs and cookies by signing them, but didn’t want the overhead of a full 40 character SHA1 hash. After some experimentation, it turns out you can knock a 40 char hash down to 27 characters by encoding it using a custom base65 encoding which only uses URL-safe characters. 6 27th August 2008, 10:18 pm

Django 1.0 beta 2 released! 1.0 draws ever closer. Important new features include major documentation and comment system refactorings, plus the removal of a bunch of deprecated code (including oldforms). Feature and string freezes are now in place, so it’s just bugs and documentation improvements between now and the final release. 0 27th August 2008, 2:41 pm

Django documentation (for 1.0). The documentation refactor is in: the docs for the upcoming 1.0 release have been tidied up, rearranged and ported to a new documentation system based on Sphinx (the Python documentation toolkit, NOT the full-text search engine). The URL has also changed to docs.djangoproject.com. 10 24th August 2008, 10:49 am

The Python Property Builtin. The always-educational Adam Gomaa explains the Python property built-in and shows how it can be used to improve Django’s model-based URL generation. 0 23rd August 2008, 1:08 pm

django-timezones. Models, form fields and a template filter for dealing with timezones in Django. 1 21st August 2008, 11:18 pm

Persistent Django on Amazon EC2 and EBS—the easy way. Useful tutorial on getting Django up and running on EC2 with EBS for a persistent PostgreSQL database. 1 21st August 2008, 9:32 pm

UnicodeDictWriter—write unicode strings out to Excel compatible CSV files using Python. Stuart Langridge and I spent quite a while this morning battling with Excel. The magic combination for storing unicode text in a CSV file such that Excel correctly reads it is UTF-16, a byte order mark and tab delimiters rather than commas. 2 20th August 2008, 12:19 pm

minidetector. Neat piece of Django middleware that adds a “mobile = True” attribute to the request object if the request’s user-agent matches a list of strings of known low-power browsers in mobiles, PDAs or game consoles. 1 15th August 2008, 8:21 am

This Week in Django. After 33 episodes Django’s usually-weekly podcast finally has its own website. 0 14th August 2008, 2:57 pm

Keyczar (via) New open source cryptography toolkit from Google, designed to get algorithm selection, key rotation and versioning right so you don’t have to. Java and Python versions are available; the Python version depends on PyCrypto. 0 13th August 2008, 1:20 pm

Django snippets: RequestFactory. I’ve been wanting this for ages; when I finally got around to writing it it turned out to only be a dozen or so lines of code. Makes it easy to create mock request objects in Django, which you can then use for testing view functions directly (bypassing the current test client mechanism which requires views to be assigned to a URLconf before they can be tested). 1 12th August 2008, 12:40 pm

Changeset 8266—Added ModelAdmin.save_model() and ModelAdmin.save_formset() methods. One of those small changes that opens up enormous possibilities—it’s now incredibly easy to customise exactly how a model is saved in the Django admin interface by over-riding the save_model method. 1 10th August 2008, 1:17 pm

GeoDjango Documentation. Merged to Django trunk a few hours ago. The tutorial isn’t there yet, but the rest of the docs are worth exploring. 1 5th August 2008, 11:06 pm

My Universal Feed Parser was conceived as a weapon against what I considered the gravest error of XML: draconian error handling. Recently, someone asked me to implement a switch that makes it not fall back on lax parsing in the case of an XML wellformedness error. I said no, not because it would be difficult to implement, but because that defeats its entire reason for being.

Mark Pilgrim 0 5th August 2008, 10:52 pm

simple-thrift-queue (via) Phillip Pearson’s surprisingly concise in-memory message queue written in Python using Facebook’s Thrift library (which is similar to Protocol Buffers, but was open sourced much earlier on). Handles 4,000 requests per second on a laptop. 2 4th August 2008, 12:27 pm

PDFMiner. Useful looking PDF parsing library in Python—can produce an XML representation of the text and style information in a PDF document. 0 3rd August 2008, 3:29 pm

Changeset 8162. “Implemented a secure password reset form that uses a token and prompts user for new password”—also sneaks base36 encoding and decoding in to Django. 3 31st July 2008, 10:54 pm

Super User Conditional Page Exception Reporting. The name is almost as long as the code snippet: this serves Django’s debug page to logged in super-users, falling back to the default 500 template for everyone else. 0 31st July 2008, 9:06 pm

Spawning + Django. The latest version of Spawning (a fast Python web server built on top of the Eventlet non-blocking coroutine networking library) can run Django applications out of the box, using threads and processes to work around the blocking nature of the ORM’s database drivers. Eric Florenzano reports better performance than Apache and mod_wsgi, and is now hosting his site on it. 2 31st July 2008, 10:56 am

DjangoCon & Django 1.0 updates. DjangoCon tickets will be released in two batches of 100. The first set will be available at 12 noon UTC on Thursday July 31st; the second set will be released at 6pm UTC on Friday August 1st. 0 30th July 2008, 10:25 am

Extra fields on many-to-many relationships (via) Checked in just over an hour ago, Django now lets you specify a custom “through” table for a ManyToManyField. Great work by Eric Florenzano. 0 29th July 2008, 1:58 pm

FLOSS Weekly 34: Django. Randal Schwartz interviewed Jacob Kaplan-Moss at OSCON for the consistently excellent FLOSS Weekly podcast. 2 27th July 2008, 9:47 am

Dojango version 0.3 released. A reusable Django application that provides Dojo, helper functions (dojo.data integration) and tools for switching between Dojo versions. 1 24th July 2008, 12:47 am

Python BoF and Django Drinkup (via) At OSCON? Come along to the Jax Bar tonight (Tuesday 22nd) from 7pm to 10pm to hang out with fellow Pythoneers and Djangonaughts. 0 22nd July 2008, 6:48 pm

Replacing Django’s Template Language With Jinja2. Part of Wil Larson’s series on taking advantage of Django’s loose coupling. 0 22nd July 2008, 5:18 pm

Django 1.0 alpha release notes. The big features are newforms-admin, unicode everywhere, the queryset-refactor ORM improvements and auto-escaping in templates. 0 22nd July 2008, 6:04 am

Django 1.0 alpha released! Not meant for production use, but a pretty solid preview of what’s coming in 1.0 proper. The beta is scheduled for August 5th. 0 22nd July 2008, 6:01 am

DjangoCon 2008. The official DjangoCon site is up, along with a mostly complete schedule. 0 20th July 2008, 8:49 pm

Jinja2 Final aka Jinjavitus Released. The Jinja template engine now has auto-escaping as an optional feature, disabled by default. Worth considering as an almost drop-in replacement for Django’s template language if features such as macros and compilation to Python code appeal to you. 2 19th July 2008, 11:52 pm

Simple Top-Down Parsing in Python. Eye-opening tutorial on building a recursive descent parser for Python, in Python that uses top-down operator precedence. 0 19th July 2008, 11:37 pm

DjangoCon 2008. Venue: Gooleplex, San Francisco Bay Area. Dates: 6th and 7th Sept. Official post will be on djangoproject.com soon.

Robert Lofthouse 2 13th July 2008, 4:50 pm

ftputil. Python’s built-in ftplib is ridiculously low level, requiring you to send RETR commands and even assemble downloaded chunks yourself using a callback. ftputil looks like a really solid high-level interface to that module with file-like objects and plenty of convenient methods. 2 9th July 2008, 10:51 am

Protocol Buffers: Google’s Data Interchange Format. Open sourced today. Highly efficient binary protocol for storing and transmitting structured data between C++, Java and Python. Uses a .proto file describing the data structure which is compiled to classes in those languages for serializing and deserializing. 3-10 times smaller and 20-100 times faster than XML. 10 8th July 2008, 8:20 am

Django Unit Tests and Transactions. If you’re using a transactional database engine (MySQL with InnoDB, Postgres or SQLite) you can speed things up by running each of your unit tests inside a transaction and rolling back in tearDown(). 0 7th July 2008, 2:14 pm

OSM routing, A*, cycle-filtered, python (via) A python library for finding routes using OpenStreetMap data. 0 5th July 2008, 3:13 pm

Running C and Python Code on The Web. Adobe are working on a toolchain to compile C code to target the Tamarin VM in Flash. This will allow existing C code (from CPython to Quake) to execute in a safe sandbox in the browser. 0 4th July 2008, 8:26 am

Whitespace Sensitivity. Amusingly, Ruby is actually far more sensitive about whitespace than Python is. 0 1st July 2008, 2:50 pm

Graphite. Real-time graphing package for server monitoring, similar to RRDTool. Created by the team at Orbitz, using Django and ExtJS for the frontend and Cairo to generate the graphs. 0 28th June 2008, 11:53 pm

How-to: Full-text search in Google App Engine. Use search.SearchableModel instead of db.Model—it’s pretty rough at the moment which is probably why it’s still undocumented. 2 27th June 2008, 8:25 am

CookBookNewFormsFieldOrdering. Handy tip—change the order of fields in a Django newforms instance by over-riding form.fields.keyOrder (since fields is a SortedDict). 3 27th June 2008, 1:02 am

Django snippets: Command to dump data as a python script. Extremely useful—dumps the data for an application as an executable Python script which will re-import it in to another database without any risk of colliding with existing IDs, sorting out foreign keys along the way. 1 24th June 2008, 12:07 pm

The basics of creating a tumblelog with Django (via) Ryan Berg suggests having a StreamItem model that links uses a GenericForeignKey to link to other content types, then using signals to cause a StreamItem to be created for every other model type. I should switch to doing that on this blog: at the moment I have to query three separate tables to build the tumblelog part which results in messy code for ordering and pagination. 3 24th June 2008, 11:09 am

Tailor. “Tailor is a tool to migrate or replicate changesets between ArX, Bazaar, Bazaar-NG, CVS, Codeville, Darcs, Git, Mercurial, Monotone, Subversion and Tla repositories.”—written in Python. 2 24th June 2008, 9:59 am

jsontime. Nat and I threw this together this morning—it runs on Google App Engine and exposes Python’s pytz timezone library over JSONP. 13 21st June 2008, 7:07 pm

PortingDjangoTo3k. Martin von Loewis has started assembling a patch. His write-up illustrates some key differences between Python 2.X and Python 3—it looks like Django’s unicode handling is going to require the most work. 4 19th June 2008, 5:53 pm

Reddit release their codebase. Under the same Common Public Attribution License used by Facebook for their recent source release. 1 18th June 2008, 2:32 pm

New foundation for Django. Django now has its own nonprofit software foundation (courtesy of a bunch of tough paperwork by Jacob Kaplan-Moss), and fittingly the Lawrence-Journal World get the exclusive. 0 17th June 2008, 5:16 pm

Spicing Up Embedded JavaScript. John Resig collects the various ways in which a JavaScript interpreter can be hosted by Python, PHP, Perl, Ruby and Java. There are full JS implementations in PHP, Perl and Java; Ruby and Python both have modules that use an embedded SpiderMonkey. 1 15th June 2008, 11:32 am

DebugFooter middleware with Pygments sql syntax highlighting. Andreas Marr has enhanced my Django DebugFooter middleware with proper syntax highlighting for the logged SQL. 2 14th June 2008, 10:04 am

Censoring the Internet at Paraguay. The state owned telecommunication company DNS hijacked the opposition party’s domain to point at a porn site during the election back in April. Maybe we don’t want a django.py vanity domain after all... 2 13th June 2008, 3:24 pm

RFC: Django 1.0 roadmap and timeline. Jacob’s proposed target is “early September” for the final 1.0 release. 0 12th June 2008, 10:34 am

Shortcutting render_to_response. I tend to use a simple wrapper function, but the other options described here are worth exploring. This is why I’m so keen on Django’s “take a request object, return a response object” philosophy—it makes it trivial to extend the framework in the direction you want. 0 10th June 2008, 11:49 am

Python + Hadoop = Flying Circus Elephant. Last.fm have released Dumbo, a Python module that lets you easily write Hadoop map/reduce tasks using Python and generators. 0 31st May 2008, 2:14 pm

modswgi: Debugging Techniques. mod_wsgi is excellent software, and the documentation is equally superb. I used these instructions recently to run the Python debugger inside a running instance of Apache, which helped my track down some import errors that weren’t occurring with Django’s development server. 0 25th May 2008, 1:34 pm

AOP aspect of JavaScript with Dojo. Fantastic post—concisely explains Aspect Oriented Programming, then shows how Dojo’s dojox.lang.aspect brings AOP to JavaScript, including some really useful built-in aspects for logging, profiling and more. Aspects are like Python decorators on steroids. 3 18th May 2008, 10:45 am

Using Git as a versioned data store in Python. gitshelve supports the same interface as Python’s built-in shelve module but stores things to a versioned Git repository instead of just a pickled dictionary. I’ve been casually wondering what a Git-powered CMS would look like. 6 15th May 2008, 3:25 pm

Python with a modular IDE (Vim). Great tips—I’d use these if I wasn’t still scarred from the time vim encrypted my file instead of saving it because I had caps lock on by mistake. 0 12th May 2008, 7:09 am

Byteflow Blog Engine. This looks like the most full-featured of the Django blog engines by a pretty big margin, including OpenID client and server support. A product of the growing Russian/Ukrainian Django community. 8 11th May 2008, 7:41 pm

What amazes me is how close Ruby 1.9 bytecode and Python 2.5 bytecode are. Some things translate almost directly. [...] And, really, if that’s true (and I vouch that it is truly, truly true,) then how are Python and Ruby still on separate runtimes?

Why the lucky stiff 4 5th May 2008, 10:14 pm

Sneaking Ruby Through Google App Engine (and Other Strictly Python Places). In a characteristic stroke of genius, _why makes a solid initial attempt at compiling Ruby 1.9 source to Python 2.5 bytecode. 0 5th May 2008, 10:13 pm

Django Users Group London meetup, 19th of May. The inaugural meeting of DJUGL will be on the 19th of May at the Capital Radio building in Leicester Square, sponsored by GCap Media. Three presentations starting at 7pm (I’ll be giving one of them), then on to the pub. Sign up on EventWax; there are only 70 places. 0 2nd May 2008, 12:19 pm

jQuery style chaining with the Django ORM

Django’s ORM is, in my opinion, the unsung gem of the framework. For the subset of SQL that’s used in most web applications it’s very hard to beat. It’s a beautiful piece of API design, and I tip my hat to the people who designed and built it. [... 820 words]

QuerysetRefactorBranch. What’s new and changed now that queryset-refactor has merged to trunk. 1 27th April 2008, 7:34 am

Queryset-refactor branch has been merged into trunk. Malcolm’s latest Django masterpiece is complete. 0 27th April 2008, 7:21 am

Multi-Inflection-Point Alert. Dammit, Tim, stop giving away our competitive advantages! 0 26th April 2008, 6:48 pm

Python one-liner of the day. I love the idea of publishing one-liners accompanied by one-line test suites. 0 26th April 2008, 10:24 am

Generator Tricks for Systems Programmers. The best tutorial on Python’s powerful generator feature I’ve seen anywhere. 1 24th April 2008, 10:17 am

Multiple inheritance of newforms and modelforms. If you ever see “Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases” when trying multiple inheritance with newforms and modelforms, here’s a scary solution I found. 0 12th April 2008, 12:54 pm

Active on IRC in the past hour. New Django People feature in collaboration with Brian Rosner—DjangoBot now provides information on currently active IRC participants. There’s an opt-out privacy control and the bot sends you a message about it the first time it logs your activity. 6 12th April 2008, 12:58 am

Google App Engine for developers. Best in-depth coverage so far, from Niall Kennedy. I didn’t know that Guido had worked on the Django compatibility layer. 4 10th April 2008, 11:14 pm

The Google App Engine model class, db.Model, is not the same as the model class used by Django. As a result, you cannot directly use the Django forms framework with Google App Engine. However, Google App Engine includes a module, db.djangoforms, which casts between the datastore models used with Google App Engine and the Django models specification. In most cases, you can use db.djangoforms.ModelForm in the same manner as the Django framework.

Google App Engine docs 2 8th April 2008, 1:48 pm

Running Django on Google App Engine. Django 0.96 is included, but you need to disable the ORM related parts and use the Google App Engine Bigtable interface instead. 4 8th April 2008, 1:15 pm

Google App Engine. Write applications in Python using a WSGI compatible application framework, then host them on Google’s highly scalable infrastructure. The most exciting part is probably the Datastore API, which provides external developers with access to Bigtable for the first time. 13 8th April 2008, 7:25 am

Why the webstandards world appears to be choosing Django. I’m not convinced that this is a definite trend, but it certainly makes for an interesting discussion. 0 4th April 2008, 8:33 am

Python-by-example. “This guide aims to show examples of use of all Python Library Reference functions, methods and classes”, thus addressing my number one complaint about Python’s standard library documentation. 6 2nd April 2008, 3:42 pm

Django Development with Djblets. The Review Board team have extracted a library of useful Django utilities from their application. The first to be documented are helpers for reducing boilerplate in custom template tags. 2 31st March 2008, 1:19 pm

Graphication. Andrew Godwin’s Python graphing library, based on Cairo. Responsible for the very handsome graphs on The Carbon Account. 0 30th March 2008, 7:05 pm

Exposing calendar events using iCalendar in Django. A simple abstraction around the vobject Python library. 0 30th March 2008, 6:31 pm

xPyUnit: Uniting in Python with XML reporting. Should be just the ticket for integrating Django’s testing framework with Cruise Control. 4 27th March 2008, 12:35 pm

Setup mod_wsgi for Django and Shared Hosting. Tutorial by David Cramer; attached are useful comments from mod_wsgi author Graham Dumpleton. 0 26th March 2008, 2:42 pm

Djangofriendly (via) Ryan Berg’s attractive new site collecting ratings and reviews for web hosts that support Django. I’m still happily hosted on a bytemark VPS, which isn’t currently listed on the site. 6 26th March 2008, 8:47 am

Better Use of Newforms. Two really neat techniques: using an inclusion tag template to DRY your custom form templates, and adding what-to-do-next methods to the form class itself to cut down on the application code in your views. 0 25th March 2008, 10:53 pm

fireeagle_api.py. Steve Marshall’s Fire Eagle python binding on GitHub. 0 22nd March 2008, 11:57 pm

PownceFS. Not a joke: it’s a Fuse filesystem (written in Python, using OAuth for authentication) which exposes a directory for each of your friends on Pownce containing the files that they have uploaded. 0 22nd March 2008, 11:18 pm

views.py for wikinear.com (via) I’ve published the views.py file from wikinear.com as an example of simple Fire Eagle integration with a Django application. 0 22nd March 2008, 7:23 pm

Monkeypatching is Destroying Ruby (via) Deliberately provocative title, but makes a well considered case for restrained use of monkey patching in Ruby. Cultural norms around monkey patching seem to me to be one of the core differences between the Ruby and Python communities. 0 22nd March 2008, 12:27 am

Version 2.0 of mod_wsgi is now available. Includes features that should make Python (and Django) on shared hosting much easier: a non-root user can touch their WSGI script file to restart just their application’s daemon processes when they make changes and Python virtual environments are supported to allow different versions of packages without interference. 0 21st March 2008, 1:23 pm

mysql_cluster (via) My Russian isn’t all that good, but this looks like a neat way of getting Django to talk to a master/slave setup, written by Ivan Sagalaev. UPDATE: English docs are linked from the comments. 2 21st March 2008, 8:45 am

A Toy Chat Server with Eventlet and Mulib (via) Eventlet (the Python non-blocking IO library originally written for Second Life) is ideally suited to building Comet servers; Chuck Thier demonstrates a simple chat server in a small amount of code. 0 21st March 2008, 3:28 am

Simple Exception Response for AJAX debugging. Neat solution to the problem of Django error pages showing up as raw HTML in the Firebug Ajax log. 0 19th March 2008, 4:44 pm

IronPython, MS SQL, and PEP 249. How Dino Viehland got Django’s ORM to talk to the .NET database layer. 0 19th March 2008, 9:46 am

Queryset Implementation. Malcolm explains the work that has gone in to the queryset-refactor branch. Executive summary: Python’s ORM is probably a lot better at SQL than you are. 1 19th March 2008, 9:43 am

Integrating reCAPTCHA with Django. Looks pretty straight forward. 0 19th March 2008, 9:41 am

Django on IronPython. Dino Viehland demonstrated Django running on IronPython and SQL Server at PyCon. 0 17th March 2008, 4:05 pm

Hacking Contributed Models. Neat Django trick using monkeypatching to make some minor tweaks to built-in contributed models such as auth or flatpages. 0 11th March 2008, 5:51 am

python4ply tutorial. python4ply is a parser for Python written in Python using the PLY toolkit, which compiles to Python bytecode using the built-in compiler module. The tutorial shows how to use it to add support for Perl-style 1_000_000 readable numbers. 0 11th March 2008, 5:49 am

Windows Live ID Delegated Authentication. Would make life a lot simpler if they just supported OAuth, but at least they include sample code in Python, Ruby and PHP. 0 8th March 2008, 3:19 pm

In-Depth django-sphinx Tutorial. Another neat Django extension from the guys at Curse: easy integration with the sphinx full text search engine. 0 5th March 2008, 12:03 am

Jython’s Future Looking Sunny. Sun have (finally) invested in Jython, hiring lead maintainer Frank Wierzbicki. They’ve also hired Ted Leung to “represent the wider world of Python at Sun”. Great news. 1 3rd March 2008, 4:08 pm

queryset-refactor changeset 7126. Malcolm just checked model inheritance in to the queryset-refactor branch, with full documentation and unit tests. People have been requesting this for ages. 5 18th February 2008, 9:46 am

Mono Beta Launch—Official Linden Blog. The Mono VM is now in public beta testing running LSL scripts in Second Life. The first step on the road to IronPython support? 0 30th January 2008, 2:19 am

Python Web Framework on the JVM. An update on both Jython and the Django on Jython project—it looks like Jython 2.5 isn’t that far away. 0 30th January 2008, 2:06 am

Monkeypatching idioms—elegant or ugly? Guido offers a decorator and a metaclass as syntactic sugar for monkeypatching existing Python classes. 2 30th January 2008, 12:39 am

Linkherd—django. Linkherd is a Django-powered startup that offers sub-reddit style functionality. I’ve set up a Django site there as well. 2 26th January 2008, 11:58 pm

Django sub-reddit. Reddit are trialling the ability to create custom sub-reddits, so I put one up for Django links and discussions. 0 26th January 2008, 11:56 pm

Community sites on Django People. Small new feature: I can now add community sites to individual country pages. If you know of any regional community sites that I’ve missed, let me know in a comment or by e-mail. 11 25th January 2008, 12:40 am

Django People: OpenID and microformats

In hindsight, it was a mistake to launch Django People without support for OpenID. It was on the original feature list, but in the end I decided to cut any feature that wasn’t completely essential in order to get the site launched before it drowned in an ocean of “wouldn’t-it-be-cool-ifs”. [... 626 words]

Django People: Colophon. I’ve added a colophon to Django People, something I try to do for all of my personal projects. 2 23rd January 2008, 4:58 pm

Caching Layer for Django ORM. Interesting extension to Django’s ORM that adds automatic caching of querysets and smart cache invalidation. 0 23rd January 2008, 3:18 pm

World’s ugliest Django app. Brilliant hack from Paul Bissex: a self-contained Django application in 70 lines of code which shows off some internals trickery and makes use of a bunch of handy django.contrib packages. 0 22nd January 2008, 1:34 am

Django at PyCon. Unfortunately I’ll be missing US PyCon this year (I’ll be at SxSW and Webstock in New Zealand though)—but it’s great to see that there’s a strong line-up of Django related presentations. 1 21st January 2008, 9:54 pm

django-evserver. Marek Majkowski got Comet working with Django using a custom WSGI server that wraps libevent using ctypes. 0 19th January 2008, 12:15 pm

Django Developer Jobs. Just an observation: the Django job market is booming at the moment, with 16 new job ads posted so far this year (that’s nearly one a day). If you want to be paid money to develop in Django there’s never been a better time. 4 18th January 2008, 3:51 pm

Django snippets: “for” template tag with support for “else” if array is empty. A neat solution to a common pattern; I’d personally like to see this included in Django proper. 8 16th January 2008, 9:42 pm

A little something I’ve been working on. Paul Bissex has been working on a Django book with Jeff Forcier and Wesley Chun, to be published by Prentice Hall. It sounds like they’re a good way along the process. 2 14th January 2008, 10:47 pm

pysolr. Python wrapper for Solr, the search web service wrapper for Lucene. One thing I’m not clear on: do you need to configure Solr with the fields you’ll be indexing in advance, or can Solr create new fields on the fly to match the data you send it? 1 9th January 2008, 8:50 pm

Good architectural layering, and Bzr 1.1. Mark Shuttleworth on the growing importance of plug-in architectures as an open source project evolves, as they allow new developers to release their own components without needing commit access to the project. Django is pretty good for this, but more hooks (and a faster event dispatch system) would be useful. 0 9th January 2008, 2:06 pm

daemon.py (via) Neat little Python module for daemonizing a process; handles logging and pid files out of the box. 0 8th January 2008, 9:58 pm

Job: Django developer in London. I’m consulting with GCap Media at the moment, who are looking to hire full-time Django developers in London for some really interesting projects. Please feel free to contact me directly with questions. 1 7th January 2008, 9:37 pm

Naming twins in Python and Perl. Simple anagram problem solved in Perl and Python, with a bunch more solutions in the comments. The C# solution provides an interesting example of LINQ in action. 0 7th January 2008, 11:03 am

FUD and TurboGears. Not cool: the TurboGears guys have been targeted by some (hopefully not deliberate) FUD along the lines of “the author of the TurboGears book is using Django now”, based on Mark posting about his research in to other frameworks. 2 7th January 2008, 9:02 am

Django Tip: Complex Forms. Malcolm demonstrates some advanced tricks with newforms. 0 6th January 2008, 10:14 pm

Filtering foreign key choices in newforms-admin. A nice introduction to the Django newform-admin branch, including an example of how to easily implement row-level permissions. 0 6th January 2008, 8:31 pm

Chatting with Adrian Holovaty. Fabio Akita interviews Adrian about Django and related topics. 0 1st January 2008, 11:44 am

This Week in Django podcast. Michael Trier’s been doing a really fantastic job putting together a Django podcast. The most recent episode (number 4) includes an update on the newforms-admin branch and a couple of handy tips. 0 1st January 2008, 10:44 am

django-mptt (via) Jonathan Buchanan’s simple utility for performing Modified Preorder Tree Traversal (efficient tree operations in SQL) on Django models. 0 29th December 2007, 11:33 am

I definitely like Python 3K’s Unicode support better [...] In fact, I think I prefer Ruby 1.8’s non-support for Unicode over Ruby 1.9’s “support”. The problem is one that is all to familiar to Python programmers. You can have a fully unit tested library and have somebody pass you a bad string, and you will fall over.

Sam Ruby 1 28th December 2007, 7:05 pm

Django and Comet. How to build a chat application using Django and the Orbited comet server. Orbited can be set up to proxy most requests through to a Django backend while handling any comet requests itself. 0 26th December 2007, 9:05 pm

IPy. Handy Python module for manipulating IP addresses—use IP(ip_addr).iptype() == ’PUBLIC’ to check that an address isn’t in a private address range. 0 24th December 2007, 1:19 pm

Size Is The Enemy. Jeff Atwood: “I’ve started a cottage industry mining Steve [Yegge]’s insanely great but I-hope-you-have- an-hour-to-kill writing and condensing it into its shorter form points.” Lots of verbose static typing apologists in the comments. 0 24th December 2007, 10:50 am

WebOb. WebOb is “an extraction and refinement of pieces from Paste”—provides a very nice request and response object, clearly inspired partly by Django. The documentation includes the differences between the WebOb API and that of other frameworks. 1 23rd December 2007, 10:22 am

Speeding up dateutil: Python’s heapq module turns minutes into seconds. Neat case study in data structure optimisation. 0 22nd December 2007, 1:07 pm

Pvote (via) Electronic voting machine software in 460 lines of highly readable Python (using Pygame), implemented by Ka-Ping Yee for his doctoral dissertation. Demonstrates prerendering, where as much of the UI as possible is defined in a separate ballot definition file. 0 22nd December 2007, 1:04 pm

Using Unipath to Keep Things Portable. Django tip to avoid hard-coding full paths. I usually set a global called OUR_ROOT in settings.py using os.path.dirname(__file__) and use os.path.join with it to construct any other paths that I need. 5 21st December 2007, 10:45 am

Misapplying book terms, Pylons, and the ’end-user’. Ben Bangert responds to Adam Gomaa’s claim that Pylons lacks “conceptual integrity”. 0 19th December 2007, 11:09 am

Frameworks Exist for Conceptual Integrity. Adam Gomaa just taught me a bunch of interesting things about Django’s underlying philosophy. Looks like I need to re-read the Mythical Man-Month. 0 17th December 2007, 1:58 pm

The future of web standards. Nice analysis from James Bennett, who suggests that successful open source projects (Linux, Python, Perl etc) could be used as the model for a more effective standards process, and points out that Ian Hickson is something of a BDFL for the WHAT-WG. 0 17th December 2007, 1:16 pm

Chapter 7: Form Processing. The chapter on newforms I contributed to “The Definitive Guide to Django” is now online, along with the rest of the published book. 0 16th December 2007, 9:44 pm

stompserver. I think this is the lightweight message queue I’ve been looking for: written in Ruby and EventMachine, easy to set up (thanks to gems), interoperates perfectly with stomp.py. 3 14th December 2007, 4:40 pm

Two-Faced Django. Excellent Django tutorial by Will Larson that shows how to build a polling application with an interface both on the Web and in Facebook. Also touches on unit testing and Ajax using jQuery. 0 14th December 2007, 2:44 pm

Updates to template_utils. James Bennett’s Django template_utils library now provides tags for consuming external RSS and Atom feeds. Combine with template fragment caching for an instant mashup written just using templates. 0 10th December 2007, 3:25 pm

Django snippets: Authenticate against Active Directory. Uses a custom authentication backend with the Python ldap module. If Django hasn’t seen the user before a new Django user account is created with data from ldap. 0 10th December 2007, 8:40 am

Django Basic Apps. Nathan Borror has released a suite of simple, reusable Django applications: Basic Blog, Basic Places, Basic People, Basic Library and Basic Profiles. 0 5th December 2007, 3:30 pm

xkcd: Python. Just type “import antigravity”. 3 5th December 2007, 6:09 am

Datejs—A JavaScript Date Library. Building a date API around chaining—Date.today().next().thursday()—is a neat concept. I’d like to see that adapted for Python’s datetime library. 17 3rd December 2007, 9:01 pm

If you only remember one thing about handling non-HTML output via Django: know that you can use the HttpResponse object as if it were a file. Writing to such an object and returning it will give you the output you wrote. It’s a very simple concept, but one that translates well to third-party libraries.

Alex de Landgraaf 0 3rd December 2007, 8:44 pm

First Notes on Django. Cool, the IETF are developing internal tools with Django. 0 3rd December 2007, 11:38 am

Oxford Geek Night 4. Tomorrow night, usual venue. Topics include mySociety, Pylons, MythTV and more. 0 27th November 2007, 9:04 pm

sorl-thumbnail. This looks like a decent attempt at a generic Django thumbnailing service, but I’m always wary of code that allows URL hackers to create large numbers of files that will be cached to disk. UPDATE: My mistake, thumbnail creation can only be caused by template authors. 5 27th November 2007, 7:17 pm

Using django.newforms with Pylons. It’s always good to see Django components used outside of the framework itself. For the record, you can avoid the DJANGO_SETTINGS_MODULE environment variable entirely using django.conf.settings.configure (search for it). 0 27th November 2007, 3:01 pm

Eventlet—Second Life Wiki. Seriously powerful non-blocking IO library for Python, currently maintained by Linden Lab as part of the server architecture used for Second Life. 0 26th November 2007, 3:21 pm

Newforms, part 1. James Bennett provides a detailed description of Django’s newforms (not so new now though, they’ve been around for over a year), complete with attractive diagrams. 0 23rd November 2007, 11:54 pm

Mock—Mocking and Test Utilities (via) New mocking library for Python based on the “action ... assertion” pattern (as opposed to the more common “record ... replay”). 0 20th November 2007, 11:30 pm

Professional Python Frameworks: Web 2.0 Programming with Django and Turbogears. Apparently published by Wrox in October 2007, beating the “official” Django book by just over a month. Has anyone seen this on bookshelves yet? 5 16th November 2007, 9:16 pm

Django Changeset 6671. Malcolm Tredinnick: “Implemented auto-escaping of variable output in templates”. Fantastic—Django now has protection against accidental XSS holes, turned on by default. 6 14th November 2007, 5:05 pm

Django Book Update. It’s done! Went to the printer on Friday, due in bookstores in the second week of December (just in time for Christmas). Congrats to Adrian and Jacob. 0 14th November 2007, 12:59 am

Reinteract—Better interactive Python. Really neat Mathematica-style pygtk interactive prompt for Python, where previous lines can be edited in place and graphs and other graphical primitives can be displayed inline. Includes an elegant plugin mechanism. 0 12th November 2007, 12:55 pm

Orbited: The Orbit Event Daemon. HTTP daemon designed for long-lasting comet connections, written in Python using pyevent on top of libevent. 1 9th November 2007, 11:01 pm

Django documentation bookmarklets. James Bennett continues his month-long series of daily Django tutorials with documentation for one of Django’s best kept secrets: application introspection HTTP headers and bookmarklets that make use of them. 0 8th November 2007, 10:59 am

Hello Revver.com 2.0. Revver, one of the more established video startups, have launched their new version which is powered by Django. 0 2nd November 2007, 7:03 am

PyObjC 2.0 changes (via) All the good stuff that’s in PyObjC 2.0, released as part of Leopard. According to bbum this is the most significant release of PyObjC in 7 years. 0 2nd November 2007, 6:18 am

Python on Leopard. readline is finally bundled, so the interactive interpreter works correctly without hunting around for frustratingly elusive add-ons. easy_install is bundled as well. 5 31st October 2007, 5:53 pm

Django security fix released. Django’s internationalisation system has a denial of service hole in it; you’re vulnerable if you are using the i18n middleware. Fixes have been made available for trunk, 0.96, 0.95 and 0.91. 0 26th October 2007, 9:47 pm

Using the extra() QuerySet modifier in Django for WeGoEat. You can use select() on a QuerySet to obtain extra values using subqueries. 0 24th October 2007, 7:28 pm

EventScripts 2.0, now with Python. EventScripts is a plugin that lets you write scripts to customise dedicated servers for Valve’s Source engine games (Half-Life 2, Counter-Strike, Team Fortress 2 and the like). Version 2.0 adds support for Python 2.5 as an embedded scripting language. 0 22nd October 2007, 11:57 pm

Django may be built for the Web, but CouchDB is built of the Web. I’ve never seen software that so completely embraces the philosophies behind HTTP. CouchDB makes Django look old-school in the same way that Django makes ASP look outdated.

Jacob Kaplan-Moss 0 20th October 2007, 1:46 pm

LastGraph. Now Available. Andrew Godwin has relaunched his LastGraph Last.fm graphing application. The new version is built on Django and S3 and uses Andrew’s Graphication graphing library based on Cairo. 0 15th October 2007, 10:02 pm

/trunk/jl/scraper. journa-list.com is open source, and the screen scrapers are written in Python. 0 11th October 2007, 4:10 pm

nose 0.10.0 final! Nose is my favourite Python testing tool: it can auto-discover and execute tests in a directory hierarchy, which makes it easy to run just a sub-set of your test suite. 0 11th October 2007, 1:52 pm

Two months with Ruby on Rails. Good rant—covers both the good and the bad. The first complaint is the lack of XSS protection by default in the template language. Django has the same problem, but the solution was 90% there when I saw Malcolm at OSCON. 5 9th October 2007, 12:23 pm

Writing An Hadoop MapReduce Program In Python. Hadoop (the open source map/reduce framework) can interact with any program that reads from stdin and outputs on stdout—so it’s trivial to drop in Python scripts for the map and reduce steps. 0 9th October 2007, 11:33 am

tranquil. Inspired take on the Django ORM to SQLAlchemy problem: lets you define your models with the Django ORM but use SQLAlchemy to run queries against them. 0 9th October 2007, 2:30 am

String types in Python 3. bytes are now immutable (just like the bytestrings they are replacing) and a new mutable buffer type has been introduced. 0 9th October 2007, 2:08 am

Some Notes on Tim Bray’s Wide Finder Benchmark. Fredrik Lundh demonstrates some Python ninja techniques for parsing log files using multiple cores (and eventually memory mapping). 1 7th October 2007, 1:06 am

DbMigration—a schema migration tool for Django. Nice and simple tool for adding schema migrations to a Django application. 0 27th September 2007, 3:04 pm

lxml.cssselect (via) lxml includes an implementation of CSS 3 selectors, which compiles them to XPath expressions. Should be a useful tool for parsing Microformats from Python. 1 24th September 2007, 11:57 pm

Hello JS-CTYPES, Goodbye Binary Components. Mark Finkle is porting Python’s ctypes functionality to the Mozilla platform, to allow binary XPCOM components to be defined in pure JavaScript. 0 22nd September 2007, 11:57 pm

The Rubinius Sprint. Sun are throwing a ton of resources at Ruby, because as Tim Bray says, “it’s not fast enough”. Imagine where they’d be if they’d invested this kind of support in Jython five years ago... 0 21st September 2007, 11:32 pm

virtualenv 0.8.1. Ian Bicking’s tool for creating isolated Python environments; designed to replace his earlier workingenv package. Does anyone have any experience using this? It looks fantastically useful. 1 15th September 2007, 11:36 pm

Zope3 for Djangoers. I prefer “Djangonauts”, personally. Useful overview of Zope 3 for people with Django experience (first of a multi-part series). 0 14th September 2007, 3:20 pm

Restructured Text to Anything. Slick set of online tools for converting Restructured Text (one of the more mature wiki-style markup languages) to HTML or PDF. Includes a nice looking API. Powered by Django. 3 13th September 2007, 3:54 pm

Building the Social Web with OpenID. Slides from my keynote at yesterday’s PyCon UK. 2 9th September 2007, 12:36 am

django-sphinx (via) More code from Curse Gaming; this time a really nice API for adding Sphinx full-text search to a Django model. 1 9th September 2007, 12:35 am

wikimarkup (via) “MediaWiki markup in Python”. I’ve always suspected that MediaWiki was like Perl; the only thing that can parse MediaWiki is MediaWiki. Not sure how faithful this Python port is but I’d love my theory to be proved wrong. 1 9th September 2007, 12:33 am

Advanced Django. Slides from my hour long tutorial at PyCon UK this morning. Most of the material was adapted from OSCON, but I also added a new section covering newforms. 3 8th September 2007, 1 pm

Django on Jython: What I’ve done until now. It’s not quite there yet (the new Jython is Python 2.2 with a few 2.3 features; Django requires 2.3 at least) but it’s looking pretty promising. 0 4th September 2007, 2:53 am

Amazon EC2 Basics For Python Programmers. Detailed introduction and tutorial from James Gardner. 0 3rd September 2007, 6:20 pm

calendar.timegm() (via) An “unrelated but handy function” that converts a time.gmtime() in to a corresponding Unix timestamp. I’ve been hand-rolling this one for years; never thought to look in calendar. 0 3rd September 2007, 1:54 am

Sam Ruby: 2to3. Sam’s report on an attempt to port the Universal Feed Parser to Python 3.0. The 2to3 tool does most of the work, but it seems the unicode changes can be pretty tricky. 0 3rd September 2007, 1:38 am

Django vs feedparser on dates. Some useful tips in the comments. I find Python’s timezone stuff endlessly frustrating: I know it can do what I want, but it always takes me a ridiculously long time to figure out the necessary incantations. 0 2nd September 2007, 10:17 am

What’s New in Python 3.0. They’re definitely taking advantage of the break in backwards compatibility—lots of niggling inconsistencies are finally being cleaned up. 0 1st September 2007, 1:41 am

The use of double underscores creates a separate namespace for names that are part of the Python language definition, so that programmers are free to create variables, attributes, and methods that start with letters, without fear of silently colliding with names that have a language-defined purpose.

Ka-Ping Yee 0 1st September 2007, 1:30 am

Python 3.0a1 released. Wow, that was a pretty fast turnaround. Betas are planned for 2008, with a final release scheduled for August. 0 31st August 2007, 8:36 pm

Satchmo 0.5 Release. Django powered e-commerce application, “the webshop for perfectionists with deadlines”. 1 22nd August 2007, 10:36 pm

The Shrinking Python Web Framework World. Python used to suffer from a paradox of choice with regards to Web frameworks; today things are considerably easier for new developers. 0 22nd August 2007, 10:06 pm

BabelDjango. Tools for integrating Christopher Lenz’s Babel i18n framework with Django. 0 20th August 2007, 2:59 pm

Django on the iPhone. Jacob got it working. The next image in his photostream shows the Django admin application querying his phone’s local database of calls. 0 19th August 2007, 7:58 am

The Python docs have been redesigned for 2.6. They’re beautiful. The docs for a module are on a single page now (rather than splitting over multiple pages), they’ve added unobtrusive permalinks to individual sections and the whole thing is built on ReST rather than LaTeX. 15 18th August 2007, 12:39 pm

Changeset 5925. You can now register custom commands for your application with Django’s manage.py script. More sensible than littering your application’s root directory with shell scripts. 2 18th August 2007, 11:06 am

DictMixin. I wasn’t aware of this Python class (part of the UserDict module): lets you implement __get__, __set__, __del__ and keys() and provides the other dictionary methods for you. 0 17th August 2007, 10:34 am

AuditTrail. Add change tracking and history to a Django model with a single line of code. Doesn’t handle relationships though, which is definitely the toughest part of this problem. 0 15th August 2007, 1 pm

Finding Lookup Items that Are Not Used. How to do left outer joins (and other custom SQL) using the Django ORM. 0 13th August 2007, 5:08 pm

Ubuntu -- python-django. Sweet, Django 0.96 is packaged for Ubuntu Gutsy. 3 11th August 2007, 8:47 am

Atom Models. Building Python classes that act as utility wrappers around data stored in an lxml DOM object. 0 7th August 2007, 4:02 pm

A nice example of when to use reduce in python. As a shortcut for assembling a large OR query using the Django ORM. 1 2nd August 2007, 11:51 pm

Cabochon event server. Written in Python (on top of SQLObject and Paste), uses JSON for messages, allows event consumers to subscribe with a callback URL. 1 2nd August 2007, 8:36 am

stomp.py. A Python client library for accessing ActiveMQ using the STOMP protocol. Pleasantly simple API for both sending and accepting messages. 1 1st August 2007, 1:50 pm

Django, iCal and vObject. Easy iCal generation for Django using vObject. 0 1st August 2007, 11:09 am

Thread Synchronization Mechanisms in Python. Locks, RLocks, Semaphores, Events and Conditions as explained by Fredrik Lundh. 0 29th July 2007, 9:32 pm

The recent announcement that Mozilla’s next JavaScript engine, Tamarin, will also be a container for functionality written in Python and Ruby (and, one assumes, beyond) is proof that JavaScript is the new Parrot.

Aaron Straup Cope 0 29th July 2007, 9:17 pm

mod_wsgi 1.0 Release Candiate Available. mod_wsgi is shaping up to be an excellent alternative to mod_python. 0 26th July 2007, 8:21 pm

Mozilla and IronPython: IronMonkey. Interesting to note that all three new Mozilla projects are being lead by experienced Python developers. 0 26th July 2007, 8:07 pm

Instant Django. Portable Django environment for Windows, no installation required. Can also be run from a USB thumb drive. 0 24th July 2007, 6:49 pm

Django Master Class. Notes and slides from the OSCON tutorial I gave yesterday with Jacob Kaplan-Moss and Jeremy Dunck. 4 24th July 2007, 3:20 pm

Undelete in Django. Inspired by the conversation about undo the other day, Nathan Ostgard created a simple solution based around custom managers and a trashed_at model field. 1 20th July 2007, 6:54 pm

Announcing Babel. Impressive new Python i18n / l10n package, with improved message extraction and a huge amount of bundled locale data. 2 20th July 2007, 12:20 pm

Logic in Templates. I don’t think it would hurt Django to have a bit more support for conditional logic in templates, but I wouldn’t go as far as supporting the ability to call Python functions directly. 7 19th July 2007, 8:35 am

ThingDB. Another extensible key/value pair data store, constructed for the Open Library based on Aaron Swartz’s Infogami technology. 5 17th July 2007, 10:21 am

Python Tuples are Not Just Constant Lists. “The index in a tuple has an implied semantic”. 0 17th July 2007, 7:53 am

lwqueue. Lightweight cross-language message queue system, written in Perl with client libraries in Perl, Python and Ruby. 2 16th July 2007, 10:04 am

Partial OpenID provider implementation from idproxy.net. It’ll take a while to package up provider support for django-openid, but in the meantime here’s some partial, incomplete, poorly documented example code ripped from idproxy.net. Hopefully this will give people trying to figure out the JanRain Python library a bit of a leg up. 2 12th July 2007, 6:48 pm

gSculpt. Powerful open source modelling software, written in Python and demonstrated (to much applause) as the last lightning talk of EuroPython 2007. 1 11th July 2007, 11:48 pm

pybraces. I didn’t know this was possible: a source level filter implemented as a custom -*- encoding: braces -*- 2 11th July 2007, 2:48 pm

Bazaar/Avahi mDNS Plugin. Adds ZeroConf support to Bazaar, so you can “bzr share” a branch over the local network and “bzr browse” to discover shared branches. Designed for sprints with a local network but no internet access. 0 10th July 2007, 10:17 am

PyCon UK 2007. The weekend of the 8th and 9th of September, currently accepting talk submissions. I’ll be running a Django tutorial session. 1 10th July 2007, 9:42 am

Storm. New Python ORM from Canonical, emphasising multiple database support, intelligent local cache invalidation and a thin layer over the underlying SQL. 0 9th July 2007, 8:44 am

Interview with Leah Culver: The Making of Pownce. Django + Perlbal + S3 + AIR. 0 7th July 2007, 10:05 pm

The Django Web Application Framework. I’m slowly pushing my presentations from the past couple of years up to Slideshare. This is a Django talk from April 2006, so it’s a little out of date. 0 5th July 2007, 1:07 am

PyMOTW: subprocess. Better documentation for the swiss army knife of process control tools. 0 4th July 2007, 10:18 am

Web hosting landscape and mod_wsgi. Graham Dumpleton explains how mod_wsgi’s daemon mode should provide secure Python deployment for commodity hosting providers. 0 2nd July 2007, 3:47 pm

dnspython. Python DNS toolkit—seems like the kind of thing that should be in the standard library. 0 1st July 2007, 11:55 am

Python, Mac OS X, and Readline. This worked for me, though you need to already have gcc and svn installed. It’s crap like this that made me switch to Ubuntu on Parallels for most of my Python development. 0 30th June 2007, 10:24 pm

Python 3000 Status Update. Doesn’t look like we’ll get multiline lambdas, but the other stuff looks great. I’m not looking forward to years of Python 2 and Python 3 co-existing and splitting the community though (ala PHP 4 and 5). 1 19th June 2007, 1:49 pm

Mac OS X Leopard: UNIX. Leopard ships with DTrace, and it’s been hooked in to Java, Ruby, Python and Perl. 2 11th June 2007, 11:05 pm

google-diff-match-patch (via) Robust algorithms to perform the operations required for synchronizing plain text, in Java, JavaScript and Python. 0 9th June 2007, 6:15 pm

Wait For It (via) Neat WSGI middleware from Ian Bicking that launches a thread for every incoming request and watches for slow responses; if something is taking too long it returns a “please wait” page to the user and polls for completion. 0 9th June 2007, 4:53 pm

Talking to the internal GPS in my N95 from Python. Thanks to a new LocationRequestor module for Python Series 60. 0 6th June 2007, 10:31 am

start.gotapi.com. Lightning fast lookups of API documentation; includes Python docs, YUI, HTML, CSS and lots more. 0 5th June 2007, 6:05 pm

’tie’ considered harmful (via) Rich Skrenta on the disadvantages of abstractions like Perl’s tie, which lets you create hash data structures that aren’t actually hashes. Operator overloading (as seen in Python) suffers the same problems. 1 30th May 2007, 11:11 pm

oxfordgeeks.net

Nat and I had a bit of a mini-hackday this bank holiday Monday. Nat’s been doing a great job summoning local geeks out of the woodwork with Oxford Geek Nights event, but it’s still pretty hard to find other interesting events in the Oxfordshire area. It’s not that there aren’t any, it’s just that the geek community in Oxford is currently pretty fragmented. [... 295 words]

Levenshtein. Python C extension for Levenshtein distance and other advanced diff functions. 0 27th May 2007, 6:51 pm

Test stubbing httplib2. Nice demonstration of monkey-patching as part of unit testing in Python. 0 10th May 2007, 11:24 pm

Just because Java was once aimed at a set-top box OS that didn’t support multiple address spaces, and just because process creation in Windows used to be slow as a dog, doesn’t mean that multiple processes (with judicious use of IPC) aren’t a much better approach to writing apps for multi-CPU boxes than threads.

Guido van Rossum 0 8th May 2007, 9:21 pm

The One True Object (Part 2). Jim Hugunin describes how the DLR let’s Python / JavaScript / Ruby talk to each other using a message passing abstraction. 0 5th May 2007, 1:27 am

The joy of pdb.set_trace(). I use nosetests --pdb-failures as my main entrypoint for Python debugging—it starts the debugger at the first failing test. 0 25th April 2007, 11:37 pm

django-logging. Looks neat—includes the ability to use Python’s standard logging module to log messages to a footer appended to your site’s HTML output. 0 24th April 2007, 6:50 am

Turn your Django application in to an OpenID consumer

I’ve just put the finishing touches on the first releasable version of django_openidconsumer, a package that makes it easy to add OpenID consumer support to any Django application. [... 229 words]

modwsgi. Apache module (written in C) for hosting Python WSGI applications, no mod_python required. Includes Django integration instructions. Has anyone tried this out? 5 14th April 2007, 9:48 am

Avoid IE Brokenness When using Vary and Attachments (via) Django middleware that works around a bug in IE where external applications fail to load content that was served with a Vary header. 1 9th April 2007, 9:41 am

How to Write a Spelling Corrector. Example code in Python, by Peter Norvig. 0 8th April 2007, 9:42 pm

Debian GNU/Linux 4.0 released. Includes Iceweasel (Firefox), Icedove (Thunderbird), Iceape (Seamonkey) and Python 2.4.4 as standard. 1 8th April 2007, 6:25 pm

PyCon Wireless Network. Conference WiFi is generally bad, and getting worse as more people turn up with laptops. Here’s how Sean Reifschneider built a solid network for PyCon 2007 for $2200 in hardware and 70 hours of work. 0 6th April 2007, 10:39 am

Mass Video Conversion Using AWS. How to use S3, SQS, EC2, ffmpeg and some Python to bulk convert videos with Amazon Web Services. 0 3rd April 2007, 11:44 pm

phpsh. An interactive shell for PHP, developed at Facebook and written mostly in Python. Facebook are really pushing their open-source stuff at the moment. 1 3rd April 2007, 9:43 am

DjangoKit. Early preview release of a tool that lets you package a Django application up as a fully contained OS X application. When Leopard ships with PyObjC this kind of thing will be even easier. 0 29th March 2007, 12:50 am

PyPy 1.0. The fascinating Python implemented in Python project reaches 1.0, and now includes a JIT compiler. It’s still not recommended for general use though. 0 27th March 2007, 11:48 pm

cmemcache. Python extension for libmemcache which provides more than twice the performance of the pure-Python memcached client. Supported by Django development version. 2 27th March 2007, 1:51 pm

The Athena Framework. CERN’s ATLAS particle accelerator experiment is scriptable with Python. 0 26th March 2007, 2:43 pm

Free Software Foundation to switch to Django. “FSF is switching from Zope to Django (both Python powered!) for web application development... Lots of new stuff coming soon, including contributions back to the Django community.” 0 25th March 2007, 7:56 pm

Python web development and frameworks in 2007. A fair and detailed look at the current main options for web development with Python. 0 25th March 2007, 5:30 pm

TweetyPy. A Python-based CLI client for Twitter, by Stuart Colville 0 24th March 2007, 4:47 pm

Algorithm Education in Python (via) A paper describing the usage of Python in Algorithm courses at UC Irvine. I found Python invaluable when I was at university and would have loved to see it become part of the official curriculum. 1 19th March 2007, 1:46 pm

pg8000 v1.02. The pure Python PostgreSQL library now supports DB-API 2.0 (and SSL too). That didn’t take long! 0 13th March 2007, 9:18 pm

pg8000 (via) A pure-Python interface to PostgreSQL, using the PostgreSQL network protocol directly. Doesn’t (yet) support DB-API 2.0, but that’s promised in a future release. 0 9th March 2007, 7:35 pm

Hacking del.icio.us with Python. Nat introduces snaflr, a Python script for republishing selected links from a number of del.icio.us users to one communal account. 0 6th March 2007, 11:11 pm

Five things I hate about Python. By Jacob Kaplan-Moss. I didn’t know you could force eggs to install unzipped with an option in ~/.pydistutils.cfg—that’s always been my least favourite thing about them. 1 4th March 2007, 10:32 pm

pear 0.8. “A libevent/pyevent-based locking session daemon for the web”. Relational databases aren’t particularly well suited to the access characteristics of session data. 0 4th March 2007, 9:19 pm

Scaling Python for High-Load Web Sites. Slides from a talk at PyCon. Be sure to switch to the notes view (Ø in the bottom right)—a really nice overview of scaling up from a CGIs to load balanced, memcached Python application servers. 0 4th March 2007, 9:14 pm

soupselect. My simple extension to BeautifulSoup that allows you to grab elements using CSS selectors; should be useful for parsing microformats. 6 28th February 2007, 1:47 pm

Django snippets. James Bennett’s new site for Django snippets. The source code to the whole site is available. 0 26th February 2007, 10:08 am

PyCon Day 1: OLPC Has Excited me. Did you know that the OLPC machines have a “show source” button? 1 23rd February 2007, 11:21 pm

30 second PyPy tutorial. Zyroth on programming.reddit.com shows how to interactively compile a Python function to C using PyPy and benchmark it against the original. 2 18th February 2007, 9:30 pm

Automated Translation of Java to Python. java2python can translate most Java code in to non-idiomatic Python, using ANTLR for the heavy lifting. 0 15th February 2007, 3:50 pm

Say Hello to Elixir for SQLAlchemy. New ActiveRecord style layer over SQLAlchemy; a collaboration that includes the authors of ActiveMapper and TurboEntity. 0 12th February 2007, 10:28 pm

soaplib (via) New open-source Python SOAP library, with a pleasantly Pythonic looking API. 0 12th February 2007, 10:26 pm

boto. Python library for accessing Amazon’s S3, SQS and EC2 Web Services, with excellent documentation. 0 11th February 2007, 12:17 am

Parallel Python. A simple mechanism for running Python code in parallel across multiple processes and/or machines, based on submitting jobs and retrieving their results. 0 9th February 2007, 1:51 am

Mono 1.2.3 has been released (via) More importantly, it ships with IronPython in the form of Seo Sanghyeon’s Community Edition. 0 9th February 2007, 12:55 am

TurboGears and Pylons (a technical comparison). Ian Bicking explores the differences between the two, and finds that the most significant is probably CherryPy v.s. Paste. 0 7th February 2007, 1:51 pm

IronPython URLs. Mark Rees’ and Seo Sanghyeon’s collection of interesting URLs posted to the IronPython mailing list. 2 4th February 2007, 5:25 pm

nose. Really nice Python unit testing tool—run ’nosetests somedir’ and it finds and executes every unittest (and test_like function) it can find in that directory tree. 0 1st February 2007, 2:20 am

Spelling correction using the Python Natural Language Toolkit. Uses porter stemming to implement a search engine ’did you mean’ feature based on the Brown Corpus. 0 31st January 2007, 10:07 pm

Pickles Begone. Barry Warsaw’s notes on adding SQLAlchemy persistence to Mailman. 0 23rd January 2007, 1:43 pm

CSS library for Python (via) “A Python package to parse and build CSS Cascading Style Sheets. Partly implements the DOM Level 2 Style Stylesheets and CSS interfaces.” 0 15th January 2007, 2:32 am

Apache Solr 1.1. Solr is the search Web Service built on top of Lucene. The latest release introduces JSON, Python and Ruby response formats in addition to XML. 0 13th January 2007, 1:16 am

What Python looks like naked. Michal Wallace has been doing some really interesting work writing purely functional code in Python. His latest experiment replaces all of the basic Python statements with equivalent functions. 0 10th January 2007, 11:22 pm

mimeparse.py (via) Parsing mime-types is harder than you might think. 0 8th January 2007, 6:43 pm

supervisor2. I haven’t tried this yet, but looks like a decent process monitoring tool. It even has an XML-RPC interface. 0 8th January 2007, 1:19 am

Why doesn’t Python have more data format readers in the stdlib? I for one would love to see simplejson included in the standard library, with or without a C implementation. 0 8th January 2007, 1:03 am

Writing a Jokosher extension. I like the way API calls are made through an API object passed to the extension’s startup function. 1 7th January 2007, 10:25 pm

killableprocess.py. “I have created a python module which can launch a subprocess, wait for the process with a timeout, and kill that process and all of its sub-subprocesses correctly, on Windows, Mac, and Linux.” 0 23rd December 2006, 12:23 am

html5lib (via) A python library for working with HTML5 documents. 0 22nd December 2006, 11:58 pm

The Daily Python-URL. Python’s number one news source, now powered by Django. 0 22nd December 2006, 11:39 pm

__builtins__ usage. Avoid using __builtins__ if you want your code to be compatible with IronPython. 1 18th December 2006, 3:22 pm

Meta-classes Made Easy. Fuzzyman introduces a metaclass factory for applying a decorator to every method of a class. 0 17th December 2006, 12:42 am

SubWiki (via) A wiki that uses Subversion for its data repository, implemented as a Python CGI. 0 16th December 2006, 7:19 pm

Dependency injection is the enterprisey name for trampling over namespaces with reckless abandon.

Ted Dziuba 0 16th December 2006, 1:05 am

[Python-3000] Refactoring tool available. Guido’s initial work on a tool for converting Python 2.x code to Python 3K. 0 15th December 2006, 2:19 pm

Statement Functions. Smart workaround for the lack of multi-line lambdas in Python. 0 12th December 2006, 7:08 pm

100% Python SCGI implementation. SCGI is like FastCGI but simpler. 0 12th December 2006, 1:37 pm

python-cluster. Fantastic interface design—pass a list and a function and you’re done. 0 7th December 2006, 5:19 pm

Incompatible SQLite in OS X and Python. I’ve hit this problem; James has the solution. 0 28th November 2006, 5:40 pm

Fun with ctypes

This probably only works on Intel-based OS X machines: [... 86 words]

HOWTO: Adding an RSS feed to a Subversion Server. Using post-commit hooks and some Python. 0 17th August 2006, 11:17 pm

YDN Python Developer Center. Launched today: tips and tutorials on accessing Yahoo! Web services from Python. 0 8th August 2006, 8:57 pm

The YDN Python Developer Center

I recently had the opportunity to put together the Python Developer Center for the Yahoo! Developer Network. YDN is one of my favourite parts of Yahoo! so I jumped at the chance, and the resulting mini-site is now online (YDN blog post here). [... 235 words]

Exciting stuff in Python 2.5

Python 2.5 alpha 1 is out, and as usual the What’s New in Python 2.5 document provides a pleasant overview of the new features. There are some real treats in there. While I’m hoping that the syntax for conditional expressions will grow on me, I’m looking forward to Partial function application becoming a common Python idiom. Relative imports are going to make Django applications a lot easier to redistribute, and I can’t wait to see all the crazy hacks that result from the introduction of coroutines. [... 291 words]

Things I learned at EuroOSCON

Last week was the first ever O’Reilly European Open Source Convention, held in the magnificent NH Grand Hotel Krasnapolsky in Amsterdam. It was the first big budget conference I’d been too (previously I’ve stuck to less expensive affairs such as SxSW Interactive and PyCon) but the money seems to have been well spent. The venue was fantastic and there was a great line-up of speakers, keynotes and panels. [... 878 words]

PHP 5 Release Candidate 1

I haven’t blogged much about PHP in a while because I’ve been up to my nose in mod_python and loving every minute of it. This news is just too important to miss: PHP 5 Release Candidate 1 has been released, bringing the first production-ready release tantilisingly close. While I doubt PHP 5 will tempt me back it’s definitely an exciting upgrade—my biggest complaint with PHP 4 is the brain-dead object model which defaults to copying whole objects rather than passing references, and this is one of the many things addressed by PHP 5. The new libxml2 powered XML features sound really powerful, and SQLite as an on-board database should be ideal for knocking out small stand-alone applications without needing to set up a mySQL database for them. [... 173 words]

Google conspiracy theories

Microdoc News have a poorly researched story suggesting that Google have been engineering their search results to favour their own properties: [... 582 words]

Installing PySQLite

Techno Weenie has a detailed guide to setting up PySQLite on boxes you don’t have root access to. SQLite looks ideal for small to medium sized applications so I can see this being really useful should I ever write something that uses it. [... 48 words]

SQLObject

My new favourite toy is SQLObject, an object-relational mapper which makes heavy use of Python’s special method names to create objects which can be used to transparently access and modify data in a relational database. I tried to write something like this in PHP once before and failed miserably, but SQLObject has such an elegant design that I’m just annoyed I didn’t find out about it sooner. Here’s some example code, adapted from the SQLOBject site: [... 249 words]

A django site