Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

302 items tagged “python”

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. 0 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. 12 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. 3 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. 11 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. 1 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. 12 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 queysets 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. 3 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. 7 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 200