Tuesday, December 08, 2009

Continuous Quality of .py files on app engine experiments

I've been working on a few small experiments with appengine capabilities (sending e-mail, receiving e-mail, sending and receiving instant messages over xmpp) . It has given me the chance to try Ale on some projects smaller than Flexvite, and I've really enjoyed it.

Typically I get the skeleton of the experiment up in about 60 seconds by using the helloworld quickstart, then adding pyflakes and watcher into the mix with 'ale install pyflakes' and 'ale install watcher'. Once I have spun up 'ale watcher', I've got something that is continuously checking my .py files for extraneous imports, undeclared vars, etc. It's really very nice to be told that you can loose two or three imports and simplify your codebase -- even when your codebase is small! Of course 'ale watcher' can also be used to trigger the running of unit testing or other checks, but for the experimental nature of these projects, that didn't seem necessary.

So for these experiments, my ale setup looks like:

$ ale

Syntax: ale <command>

Core commands:
list list commands currently recipes_installed
create create -- create the skeleton for a new command
install install
remove remove Uninstalls a command
search search commands available for install

Additional Commands:
gae google app engine .ale
pyflakes run pyflakes (lint tool) against the project or pyflakes [dir]
watcher monitors files matching a filespec for change and triggers command(s)


which is something I'm liking a lot.... you can see the commands I'm using with the project without a lot of extraneous stuff.

Starting it up is as simple as 'ale gae start' (which launches the server, and a browser to the app), and deploying it to the google cloud infrastructure (appengine) is as simple as 'ale gae deploy'.

It also turns out to be pretty simple to add these to the ale 'createapp' command (using the tarballs generated by github), so I went ahead and did that so that it's easy to pull one down quickly when you need it:

$ale createapp

createapp [templatename] -- create an app from a template
available app templates:
helloworld -- simple helloworld app
helloworldwebapp -- simple helloworld app using webapp fmk
xmppsendandreply -- simple xmpp (instant message) send and reply
emailreceive -- simple e-mail receive example
emailsendui -- simple e-mail send example


No comments: