Simon Willison’s Weblog

Subscribe
Atom feed for python

1,085 items tagged “python”

The Python programming language.

2009

Jython 2.5.0 Final is out! It’s been a long time coming—congratulations to the team.

# 16th June 2009, 11:21 pm / jython, python, java

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.

# 7th June 2009, 1:54 pm / apache, mysql, sysadmin, operations, rest, django, solr, varnish, supervisord, buildout, python, bertrand-mathieu

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.

# 28th May 2009, 9:32 pm / perl, optfunc, commandlines, perl6, python, unix

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!

# 28th May 2009, 7:38 pm / optfunc, github, introspection, commandlines, optparse, projects, python

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.

# 27th May 2009, 10:02 am / geocoders, github, projects, geocoding, placemaker, google, yahoo, geonames, jacob-kaplan-moss, python, web-services

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.

# 27th May 2009, 10:01 am / django, testing, concurrency, raceconditions, python, threadsafety

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.

# 25th May 2009, 9:34 pm / uuid, idserver, python, mike-malone, asyncore, scaling

Working with Python and RabbitMQ. Nathan Borror eliminates the boilerplate needed to talk to RabbitMQ (or any other AMQP queue server) from Python.

# 21st May 2009, 11:10 pm / nathan-borror, rabbitmq, amqp, message-queues, python

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.

# 19th May 2009, 1:34 am / django, template, python, caching, performance, adrian-holovaty

djng—a Django powered microframework

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

[... 1,501 words]

python-daemon (via) A library for correctly creating Unix daemon processes in Python, implementing the proposed PEP 3143 API.

# 18th May 2009, 10:12 am / unix, daemon, python

python-spidermonkey. A Python to JavaScript bridge using Mozilla Spidermonkey. Expose Python objects to JavaScript, or execute JavaScript from Python.

# 14th May 2009, 3:56 pm / spidermonkey, python, javascript, bridge, pythonspidermonkey, mozilla

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.

# 13th May 2009, 12:30 pm / andrew-godwin, south, python, django, orm, parsing, models

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.

# 12th May 2009, 1:19 pm / contextual, python, django, settings, globals

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.

# 11th May 2009, 1:27 pm / zenqueue, message-queues, python, eventlet, coroutines, json, zachary-voase, github

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.

# 8th May 2009, 11:24 am / nose, testing, python, multiprocess, xunit, unittest

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.

# 5th May 2009, 1:45 pm / libketama, amir-salihefendic, caching, consistenthashing, django, hashring, md5, memcached, python

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.

# 4th May 2009, 6:12 pm / github, git, django, django-people, open-source, projects, python

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

# 1st May 2009, 3:04 pm / pypy, jit, python, jpython, unittests, bugs

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.

# 30th April 2009, 7:55 pm / django, rest, restful, python, apis, authentication, oauth, digest, piston, jespernoehr, bitbucket

REST worst practices. Jacob Kaplan-Moss’ thoughts on the characteristics of a well designed Django REST API library, from November 2008.

# 30th April 2009, 7:53 pm / jacob-kaplan-moss, rest, django, python

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).

# 28th April 2009, 8:25 pm / python, sql, sqlparse, appengine, django

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.

# 24th April 2009, 10:58 am / coroutines, concurrency, generators, python, david-beazley

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.

# 22nd April 2009, 12:16 pm / amir-salihefendic, python, debugging, memory, memoryleaks, wsgi, middleware

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.

# 20th April 2009, 6:49 pm / brad-fitzpatrick, pubsub, realtime, atom, pubsubhubbub, appengine, python, webhooks

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?

# 20th April 2009, 4:53 am / nginx, passenger, python, rails, deployment, apache, ruby

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.

# 17th April 2009, 9:53 pm / django, python, search, haystack, whoosh, solr, orm, daniel-lindsley

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?

# 17th April 2009, 5:19 pm / paul-buchheit, python, friendfeed, nginx, comet, epoll, gzip

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.

# 17th April 2009, 5:13 pm / bobippolito, python, acid, databases, data, pycon, pycon2009

Developing Django apps with zc.buildout. Jacob went ahead and actually documented one of Python’s myriad of packaging options.

# 16th April 2009, 9:50 am / jacob-kaplan-moss, zcbuildout, python, packaging