A Sinatra-inspired web framework for Python

pip install Hoboken==0.5.1



Build Status

Hoboken is a Sinatra-like web framework for Python. It attempts to make writing simple web applications both easy, but also provide enough power to accomplish more complex things. Hoboken officially supports Python 2.6, 2.7, 3.1, 3.2, 3.3, and PyPy. Unofficially, the tests pass on Python 3.0, but I won't officially be supporting it.

Currently, Hoboken is in alpha. There are plenty of tests (actually, test coverage is 100%), but documentation is somewhat lacking. That said, here's a simple "hello world" application:

from hoboken import HobokenApplication

app = HobokenApplication(__name__)

def index():
    return 'Hello world!'

And here's another application that demonstrates a few more of Hoboken's capabilities:

import json
from hoboken import HobokenApplication

app = HobokenApplication(__name__)

def greeting(name=None):
    return json.dumps({
        "greeting": "Hello {0}!".format(name)

You can then host this using any WSGI server (since Hoboken applications are WSGI applications). There's also a built-in test server, so if we use this to test our application: app.test_server(port=8080), we can do this:

$ curl -ik http://localhost:8080/greet/John
HTTP/1.0 200 OK
Date: Thu, 19 Jul 2012 00:00:00 GMT
Server: WSGIServer/0.1 Python/2.7.3
Content-Type: text/html; charset=UTF-8
Content-Length: 26

{"greeting":"Hello John!"}

Finally, here's a longer example:

from __future__ import print_function
from hoboken import HobokenApplication

app = HobokenApplication(__name__)

def authenticate(path):
    # This runs before the actual route.  TODO: Do some authentication.

def index():
    return "Welcome to the app!"

def get_book(title, author=None):
    return "Looking for book '{0}' by '{1}'".format(title, author)

def add_book(author=None):
    return "Added book for '{0}'".format(author)

And there you go! Some simple demonstrations of how Hoboken works.


Hoboken is licensed under the Apache license, and is created and developed by Andrew Dunham.