Saturday, September 17, 2005

What's a megaframework?

Okay, so TurboGears is cool. Not because it's another Python web framework, but because it's a... megaframework? Okay, so it's not a framework, but what the heck is a megaframework?

Not that I have a better name for it, mind you. It is definitely a new thing in the Python world - a compelling project built almost entirely from separately-packaged Python components, powered by setuptools and EasyInstall.

It seems to me that I once blogged about how most of a thing's value comes from its incidentals - creature comforts like a good installation process. Or maybe I didn't, but it's true anyway, and it's a big reason that I've put so much effort into setuptools and especially EasyInstall. TurboGears might not be the web framework to end all Python web frameworks, but it sure as heck doesn't reinvent any wheels! While there were other efforts out there to pull together some of the very same tools to make a Rails-killer, Kevin's version of the approach has installation instructions that basically amount to:
  1. Install Python and EasyInstall
  2. Tell EasyInstall to install TurboGears
And that's a Really Cool Thing.

Of course, as I've mentioned here previously, Django also uses setuptools, and so does Paste. It seems it's becoming de rigeur for new Python web frameworks, and rather rightly so. Even Python web applications like the increasingly ubiquitous Trac are using it. I find it rather amusing that there are actually more people using setuptools and WSGI to implement web frameworks, than there are people implementing applications with all the web frameworks I've ever written! Of course, I also feel like a proud papa. Neither of my kids (WSGI and setuptools) are flashy or outspoken, and as long as they do their jobs, you hardly notice that they're there. But things go better when they're around, and that's a nice feeling to have.

Update as of September 18th: setuptools 0.6a2 is now out; it adds support for automatically generating platform-appropriate console scripts (or .exe wrappers on Windows) from your "main" functions, which can be in any module you like. Just list your main functions in setup.py and it'll do the rest. No more script files to create, no more filename munging to put .py extensions on Windows scripts while trying to leave them off for other OSes. Future versions will support a similar mechanism for GUI scripts (similar to .pyw on Windows).