Simon Willison’s Weblog

Subscribe
Atom feed for python

1,085 items tagged “python”

The Python programming language.

2009

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.

# 24th November 2009, 9:06 am / uritemplates, javascript, node, python, django, regex

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.

# 24th November 2009, 8:44 am / woof, python, filesharing, commandline

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.

# 23rd November 2009, 4:19 pm / batchselect, django, python, orm, manytomany, sql, selectrelated, john-montgomery

Debugging in Python. The missing manual for Python’s powerful pdb debugger.

# 18th November 2009, 12:34 pm / python, pdb, debugger, debugging

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.

# 15th November 2009, 10:14 pm / drupal, django, frameworks, php, python

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.

# 12th November 2009, 10:49 am / choropleths, mapping, python, infographics, beautifulsoup, elementtree, css, svg

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.

# 11th November 2009, 7:13 am / jacob-kaplan-moss, documentation, django, python

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.

# 10th November 2009, 8:48 pm / martijnfaassen, python, packaging, setuptools, distutils

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.

# 9th November 2009, 2:02 pm / fabric, python, deployment, ssh

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.

# 9th November 2009, 1:53 pm / oracle, mysql, postgresql, django, jython, python, leosoto

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!

# 6th November 2009, 11:04 am / guido-van-rossum, python, science, scipy, hubblespacetelescope, astronomy

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.

# 4th November 2009, 10:33 pm / sun, jython, python, java, frank-wierzbicki

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.

# 3rd November 2009, 10:42 am / django, eric-holscher, search, haystack, patterns, classbasedviews, python

Exploring Python (via) Notes from the introduction to Python presentation I gave today at Stack Overflow DevDays Amsterdam.

# 2nd November 2009, 3:35 pm / stackoverflow, devdays, speaking, python

pudb. A full-screen, curses console based visual debugger for Python, built using the urwid console UI library.

# 1st November 2009, 12:09 pm / python, pdb, debugger, urwid, ui, console, pudb

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.

# 26th October 2009, 10:38 am / django, multidb, python, classbasedviews, orm

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.

# 25th October 2009, 11:30 pm / python, twisted, async, callbacks, generators, yield

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.

# 21st October 2009, 6:48 pm / hadoop, open-source, cloudera, python, django, mootools, twisted, lxml, cherrypy, mako, java, aspectj

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.

# 10th October 2009, 12:24 am / django, security, python, regular-expressions

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.

# 9th October 2009, 12:38 am / python, michael-moore, django, scaling

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.

# 8th October 2009, 11:48 am / twisted, jpcalderon, python

Python is Unix. Jacob ports Ryan Tomayko’s simple prefork network server to Python.

# 7th October 2009, 11:43 am / python, jacob-kaplan-moss, ryan-tomayko, unix

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.

# 4th October 2009, 10:29 am / django, python, history, alex-martelli, james-bennett

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

# 2nd October 2009, 2:16 pm / mysql, python, databases, django

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

# 1st October 2009, 3:51 pm / django, python, sixapart, motion, typepad, fowa

Python Logging 101. A really useful introduction to Python’s logging module by that module’s author, Vinay Sajip.

# 29th September 2009, 6:40 pm / python, logging, vinaysajip

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.

[... 1,674 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.

# 25th September 2009, 10:14 pm / ubuntu, vmware, snowleopard, samba, textmate, python, mysql, osx

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.

# 23rd September 2009, 5:15 pm / generators, diesel, comet, async, python