Brubeck
- From:
- James Dennis
- Date:
- 2011-03-09 @ 16:18
Brubeck is a Python based nonblocking / asynchronous Mongrel2 request
handler modeled after Tornado (or web.py, which Tornado is itself modeled
after).
Routing in Brubeck is a lot like Tornado. You basically specify a regex and
a class to handle calls to that URL.
Demo: https://github.com/j2labs/brubeck/blob/master/demo/demo.py
I recently started work on an authentication system for Brubeck too. I use
DictShield for database agnostic modeling. It outputs JSON or BSON and
offers tools for validating dictionaries straight off the wire. I will
probably model messages between brubeck instances using DictShield too, but
I'm not there yet.
Demo with authentication via python decorators:
https://github.com/j2labs/brubeck/blob/master/demo/demoauth.py
User and UserProfile objects as DictShield documents:
https://github.com/j2labs/brubeck/blob/master/brubeck/models.py
Brubeck also uses coroutines as provided by eventlet (greenthreads, FTW) for
nonblocking I/O. My goal here is to make all the IOLoop nonsense in Tornado
much more tolerable and essentially hidden from the view of the user.
Eventlet also greens existing blocking code to make it nonblocking
automatically.
At some point I'd like to build FormShield or something similar to make
generating forms from models easy but I'm not there yet.
Brubeck is also primarily useful for API's as I haven't hooked in any
template system yet. I'm thinking of doing something similar to Tornado here
too since Tornado's templates 1) assume the user isn't an idiot and 2) are
really fast.
James