I recently published a post titled ‘7 Minimal Node.js Web Frameworks for 2014 and Beyond‘ – it’s currently my all time top viewed post on this blog: more than 10,000 people have viewed, shared and discussed the web frameworks I had put together.
It’s not easy to ‘please’ everyone at once, I try my best to include frameworks that somehow are appearing on the top of the list when I look for them. I try to rank each one by community size, and also activity on GitHub. I encourage you to leave a comment linking to your own personal favorite (or the one you’re working with right now) and I will add it to the bottom of the list as soon as I can.
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.
Hello World in Python
You might have forgotten how to do it, here is a reminder.
print "Hello World!";
I also enjoy this one,
while True: for i in ["/","*","|","\\","|"]: print "%s\r" % i,
Web Frameworks for Python
It’s easier to work on something when you’ve got the basic stuff covered for you, this is why frameworks have become so popular within the developer communities around all of the programming languages, you can’t disagree that putting together a website or a project is much easier than having to build your own classes and functions.
I’m keeping my promise of not making this or any of the future lists biased towards one specific framework, and all of the choices are purely based on my own opinion and liking. I will appreciate if you can share this post with your friends and on your blog to help spread the word AND the hard work that has gone into making these python web frameworks possible.
Bobo is a light-weight framework for creating WSGI web applications. It’s goal is to be easy to use and remember.
It addresses 2 problems:
1) mapping URLs to objects and
2) calling objects to generate HTTP responses.
Bobo doesn’t have a templating language, a database integration layer, or a number of other features that are better provided by WSGI middle-ware or application-specific libraries. Bobo builds on other frameworks, most notably WSGI and WebOb.
Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library.
It provides support for apps like the Google App Engine, Python Paste, and includes several templates like Cheetah and Mako.
CherryPy allows developers to build web applications in much the same way they would build any other object-oriented Python program. This results in smaller source code developed in less time. CherryPy will allow you to do a lot of the normal Python programming, but it does not come integrated with a templating system – which you’ll have to find for yourself. (it supports all the major ones)
CherrPy very much adapts the default Python functionality and structure, and is merely a link between being able to develop web applications with less code.
Cyclone is a web server framework for Python that implements the Tornado API as a Twisted protocol.
I will pass on the explanation of this framework to Gleicon from 7co. Read his post about Cyclone and how it operates.
itty.py is a little experiment, an attempt at a Sinatra influenced micro-framework that does just enough to be useful and nothing more.
- Basic responses
- HTTP Status codes
- URL Parameters
- Basic GET/POST/PUT/DELETE support
- User-definable error handlers
- Redirect support
- File uploads
- Header support
- Static media serving
Beware! If you’re looking for a proven, enterprise-ready framework, you’re in the wrong place. But it sure is a lot of fun.
Klein is a micro-framework for developing production-ready web services with Python. It’s built on widely used and well tested components like Werkzeug and Twisted, and has near-complete test coverage.
Morepath is a Python web microframework, with super powers. Morepath is an Python WSGI microframework. It uses routing, but the routing is to models. Morepath is model-driven and flexible, which makes it expressive. There are some details and tips about Morepath on this blog.
ObjectWeb is a fast, minimalist, pure-Python web framework that relies on no third party libraries. It is designed around using Python as it was originally intended to be used: as an Object Oriented Programming language. ObjectWeb supports the CGI and WSGI standards and has a built-in development server. I think it’s being developed by this guy.
Pecan was created to fill a void in the Python web-framework world – a very lightweight framework that provides object-dispatch style routing. Pecan does not aim to be a “full stack” framework, and therefore includes no out of the box support for things like sessions or databases. Pecan instead focuses on HTTP itself.
Pyramid is a very general open source Python web framework. As a framework, its primary job is to make it easier for a developer to create an arbitrary web application. The type of application being created isn’t really important; it could be a spreadsheet, a corporate intranet, or a social networking platform. Pyramid is general enough that it can be used in a wide variety of circumstances.
You can learn a lot more about Pyramid by reading / watching this tutorial by Caliv from SixFeetUp.
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user.
web.py is a web framework for Python that is as simple as it is powerful. web.py is in the public domain; you can use it for whatever purpose with absolutely no restrictions. You can check out a guide and a tiny comparison to Django (well, I don’t think we can call it comparison) on Lucas’s Kauffman’s blog.
A lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web.
Here is a little introduction to Wheezy from Andriy Kornatskyy.
Minimal Web Frameworks for Python
I guess it’s worth mentioning again that these frameworks are in fact minimal and stuff like web2py and Django are not on the list for a reason. I’m open to feedback and reviews for each of these frameworks, and I’m also curious as to whether there is any interested in a list of full-scale web frameworks for Python? (which would include Django)
I was putting this together, and I did come across a few nice articles – one of them was a benchmark of a couple of Python web frameworks, most of which are in this list. The benchmark was done by Faruk Akgul, and it can be seen by clicking this link.
The official Python homepage also has a section dedicated for frameworks, which you might want to check out.
What’s next? Ruby or PHP?
photo by francois