r/Python • • Dec 21 '10

The Bottle Web Micro-framework

http://www.tummy.com/journals/entries/jafo_20101221_020135
43 Upvotes

45 comments sorted by

View all comments

10

u/Siraf Dec 21 '10

I was happily using bottle for a while until I discovered flask . I found flask to have better documentation and better support for important middleware features, such as csrf protection and session-support. Flask also uses decorators for routing / templates.

I do like bottle for its cgi support, however.

9

u/mdipierro Dec 22 '10 edited Dec 22 '10

Joke: Damn flask people injecting in every bottle thread!

A quick check reveals (only core *.py files).

  • Bottle: 1938 (lines of code, 1 file only)

  • Flask (including dependencies Jinja2, Werkzeug, not including tests, debug, apps, contrib): 24179 (lines of code)

  • web2py (not including tests, apps, contrib, database abstraction layer but including templates, html helpers, form generation and processing libraries, and syntax highligther and all handlers) 23469 (lines of code)

For people who want a MICRO framework. I think Bottle wins by one order of magnitude.

EDIT: Before touchy people jump up and down: I added web2py as a reference point. I am not comparing it with Bottle and Flask. I am not saying it is a micro framework. If I had Django or Pylons installed I would have added them as reference points too (I would not know how to separate the ORM). Perhaps other redditors can contribute numbers and verify mine.

2

u/ubernostrum yes, you can have a pony Dec 22 '10

Translation:

"Hey, I've got this reputation for being a guy who bursts into threads about other frameworks to talk about my own. So I'm going to snipe this dude by making a 'joke' about him doing the same thing, and then use it as an excuse to cover yet another case of me bursting into threads about other frameworks to talk about my own!"

-1

u/mdipierro Dec 22 '10

Since Ericflo is not answering my question, when you are done with the personal attacks, could you tell us how many lines of code is Django without orm, apps, tests and contrib (but including comments in code)? I would not know how to measure it precisely and I am interested in the number. I think people are interested in numbers.

For the record: the joke was on myself. I do not think Siraf or bobx11 did anything wrong. Do you think they did something wrong? Or are you using a different metric to judge my posts?

I personally judge posts and posters by a simple criteria: is it about a technical issue? Did it tell something I did not know? or is it just a personal issue? By my own standard this post of mine scores very low.

3

u/[deleted] Dec 22 '10

From memory it's about 60k lines of code, no idea if that includes tests, but it doesn't include docs.

-2

u/mdipierro Dec 22 '10

Thank you. That confirms my suspicion that Flask+SQLA is bigger than Django. bottle.py+dal.py adds up to 7000 lines (including doctests) and provide very similar features to Flask+SQLA in 10% of the size. The more I look into the bottle source the more I like it. It is really clean and well designed and contains a lot of gems.

8

u/[deleted] Dec 22 '10

I seriously doubt the web2py DAL provides similar features to SQLAlchemy.

-2

u/mdipierro Dec 22 '10 edited Dec 22 '10

The web2py DAL does not handle very well legacy databases. Apart for that I am not aware of any feature of SQLA that DAL does not provide. If you know please tell me so I can add them. The DAL is faster and supports more backends.