My name is Paul Bissex, and e-scribe.com is my consulting business. I build web applications using as much open source software as possible. From September to June I teach web design and other important non-photographic professional skills to photographers. In the '90s I wrote technology commentary and reviews for magazines, newspapers, and web publications, including Wired, Salon.com, FamilyPC, the late lamented Web Review, and the Chicago Tribune. Feel free to email me.
I'm co-authoring a book, "Python Web Development with Django", with Jeff Forcier and Wesley Chun. It will be published by Prentice Hall in July 2008, but is available for pre-ordering on Amazon now.
This site is built on a fresh trunk checkout of Django, running on Python 2.5.1, served by Apache and mod_python. The database is SQLite. The operating system is FreeBSD, on a VPS hosted at Johncompanies.com. Comment-spam protection by Akismet. Vintage topo imagery from the Maptech archive.
Akismet, del.icio.us, Django, dpaste.com, Emacs, FreeBSD, Freenode, jQuery, LaunchBar, MacPorts, Markdown, Mercurial, OS X, Postfix, Python, SQLite, Subversion, TextMate, Trac, Ubuntu Linux, wmii
Copyright 2008
by Paul Bissex
and E-Scribe New Media
For a long time I've wanted to try working with Bicycle Repair Man, the Python refactoring tool. Unfortunately, the fact that it had neither documentation nor integration with my favorite editor kept pushing it to the back burner.
About a month ago I was excited to come across a post from a guy named David Coffin who had created a BRM integration script for TextMate. I hooked it up per his instructions, and with a little fiddling I got it working. The first thing I tried was the Extract Method or Function command. I had code something like this (structurally, I mean):
def funfacts(string):
l = len(string)
a = string.count('a')
u = string.upper()
print "Length: %s Number of a's: %s Uppercase: %s" % (l, a, u)
I selected the three assignment lines, ran the "Extract Method or Function" command, and typed a name for the new function (funfacts_helper) into the dialog. I hit return and my code changed to this:
def funfacts(string):
l, a, u = funfacts_helper(string)
print "Length: %s Number of a's: %s Uppercase: %s" % (l, a, u)
def funfacts_helper(string):
l = len(string)
a = string.count('a')
u = string.upper()
return l, a, u
Cool. Now, people who have been using fancy refactoring IDEs for a long time may just laugh in their sleeves that I was impressed by this, but I was. This is great timing for me since I expect my copy of the Refactoring book to arrive any day.
David's biketextmate.py script supports five BRM commands: Rename, Find Definition, Extract Method or Function, Inline Local Variable, and Extract Local Variable.
I decided this thing needed to become a proper distributable TextMate bundle. (I actually have commit privileges in the bundle repository, not that you'd know it from my activity in the past year.) I made some minor changes to the biketextmate.py script, mostly to improve handling of file paths with spaces. Boy, did it take me a stupidly long time to figure out where those errors were coming from.
Anyway, please try it out and provide feedback. You'll need to install Bicycle Repair Man (try easy_install bicyclerepair), then fetch a tarball of the bundle -- or get the latest via Subversion:
svn co svn://open.e-scribe.com/python/misc/biketextmate
I don't have contact info for David, but I'm posting a comment on his blog pointing here. So David, if you're reading this, feel free to take my work and run with it, assuming you find it useful.
Comments use Markdown syntax. Your comment will not appear until approved, which may take a few hours or more. Spammers will be torpedoed.
The iPhone keyboard doesn't suck
Python one-liner of the day
7 comments
How not to advocate via Google Code
2 comments
99 problems
3 comments
bitmonk
Obscure "svn mv" problem solved
33 days ago
Charlie
Book news: Rough Cuts and Amazon
34 days ago
Simon Griffee
Django Mercurial mirror tweaks
51 days ago
Jason Calleiro
From PHP to Python
52 days ago
Yuli
dpaste.com
55 days ago
bruce
Neat Python hack: infix operators
59 days ago
David Reynolds
The original Lego Star Wars
67 days ago
At least 29896 pieces of comment spam killed since January 12th. Thanks are mostly due to Akismet.