Simon Willison’s Weblog

Subscribe
Atom feed for python

1,069 items tagged “python”

The Python programming language.

2008

Python one-liner of the day. I love the idea of publishing one-liners accompanied by one-line test suites.

# 26th April 2008, 10:24 am / testing, python

Generator Tricks for Systems Programmers. The best tutorial on Python’s powerful generator feature I’ve seen anywhere.

# 24th April 2008, 10:17 am / generators, python, david-beazley

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.

# 12th April 2008, 12:54 pm / django, python, multipleinheritance, metaclasses, inheritance, newforms, modelforms

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.

# 12th April 2008, 12:58 am / django-people, django, python, irc

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.

# 10th April 2008, 11:14 pm / niallkennedy, guido-van-rossum, python, django, googleappengine

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

# 8th April 2008, 1:48 pm / django, google, python, newforms, modelforms, googleappengine

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.

# 8th April 2008, 1:15 pm / django, python, google, googleappengine

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.

# 8th April 2008, 7:25 am / googleappengine, python, bigtable, google, scaling, virtualisation, wsgi

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.

# 4th April 2008, 8:33 am / django, web-standards, gareth-rushgrove, python

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.

# 2nd April 2008, 3:42 pm / python, documentation, stdlib

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.

# 31st March 2008, 1:19 pm / templatetags, django, python, reviewboard, djblets

Graphication. Andrew Godwin’s Python graphing library, based on Cairo. Responsible for the very handsome graphs on The Carbon Account.

# 30th March 2008, 7:05 pm / andrew-godwin, graphication, graphing, python, thecarbonaccount, cairo

Exposing calendar events using iCalendar in Django. A simple abstraction around the vobject Python library.

# 30th March 2008, 6:31 pm / django, vobject, icalendar, python

xPyUnit: Uniting in Python with XML reporting. Should be just the ticket for integrating Django’s testing framework with Cruise Control.

# 27th March 2008, 12:35 pm / cruisecontrol, testing, pyunit, xpyunit, python, django

Setup mod_wsgi for Django and Shared Hosting. Tutorial by David Cramer; attached are useful comments from mod_wsgi author Graham Dumpleton.

# 26th March 2008, 2:42 pm / modwsgi, wsgi, hosting, django, python, david-cramer, grahamdumpleton

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.

# 26th March 2008, 8:47 am / ryan-berg, django, hosting, bytemark, python, vps

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.

# 25th March 2008, 10:53 pm / django, newforms, dry, python, peter-baumgartner

fireeagle_api.py. Steve Marshall’s Fire Eagle python binding on GitHub.

# 22nd March 2008, 11:57 pm / github, steve-marshall, fireeagle, python

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.

# 22nd March 2008, 11:18 pm / pownce, python, oauth, fuse, powncefs, richard-crowley

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.

# 22nd March 2008, 7:23 pm / fireeagle, django, python, django-snippets, wikinear

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.

# 22nd March 2008, 12:27 am / ruby, python, ian-bicking, monkeypatching

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.

# 21st March 2008, 1:23 pm / modwsgi, python, django, wsgi, hosting, sharedhosting

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.

# 21st March 2008, 8:45 am / masterslave, ivansagalaev, django, mysqlcluster, orm, python, replication

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.

# 21st March 2008, 3:28 am / comet, eventlet, lindenlab, secondlife, chuckthier, python, mulib

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.

# 19th March 2008, 4:44 pm / ajax, firebug, django, python

IronPython, MS SQL, and PEP 249. How Dino Viehland got Django’s ORM to talk to the .NET database layer.

# 19th March 2008, 9:46 am / dinoviehland, dotnet, microsoft, django, python, ironpython, mssql, pep249, sql

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.

# 19th March 2008, 9:43 am / sql, orm, python, django, querysetrefactor, malcolmtredinnick

Integrating reCAPTCHA with Django. Looks pretty straight forward.

# 19th March 2008, 9:41 am / recaptcha, django, captcha, python

Django on IronPython. Dino Viehland demonstrated Django running on IronPython and SQL Server at PyCon.

# 17th March 2008, 4:05 pm / sqlserver, python, ironpython, pycon, microsoft, dinoviehland

Hacking Contributed Models. Neat Django trick using monkeypatching to make some minor tweaks to built-in contributed models such as auth or flatpages.

# 11th March 2008, 5:51 am / django, contrib, monkeypatching, python