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

Show parent comments

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.

4

u/muyuu Dec 22 '10

You get downvoted because you are needlessly aggressive with your promotion of web2py.

Stop it, you do contribute really good stuff.

Here, an upvote.

PS: Flask does compare to Bottle in simplicity. For most tasks, complexity that's completely under the hood is alright. For instance, having Apache with mod-wsgi installed wouldn't justify adding the whole Apache codebase in the comparison.

Bottle wins hands down in lack of dependencies.

-1

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

The Jinja2 and Werkzeug dependencies must be included to compare apples to apples because bottles too includes a template language, digitally signed cookies for sessions, a web server, and multiple server adapters. P.S. Actually, on this thread I am promoting Bottle!

3

u/mitsuhiko Flask Creator Dec 22 '10

I don't plan on removing features, lowering the quality of code or removing documentation to win an argument. So if a microframework does not depend on anything else to be called a microframework the mother of all microframeworks (camping) and the most popular Ruby one (sinatra) are not microframeworks.

-2

u/mdipierro Dec 22 '10

I do not think there is an argument to win. I do not think you have to take anything off. I said and I repeat: I like Flask, although I do not think it is a micro-framework, at least not in the sense Bottle is. Yet it is pointless to argue on definitions. What is important is what it does and what it does not.

DasIch helped clarify things for me. Can you tell us more about the sandbox or point us to the docs?

1

u/mitsuhiko Flask Creator Dec 22 '10

at least not in the sense Bottle is

Again: if that is what you think, no language besides Python has micro frameworks.

Can you tell us more about the sandbox or point us to the docs?

jinja2 sandbox

-1

u/mdipierro Dec 22 '10

this looks like the rexec module that was removed because broken. I think something like this (and digitally signed cookies) should be part of the standard python libraries. How about a PEP to include your code. I would support it.

2

u/mitsuhiko Flask Creator Dec 22 '10

That won't work. Python cannot be sandboxed, Jinja2 can. The techniques I use to sandbox Jinja2 do not work on arbitrary Python expressions.

1

u/mdipierro Dec 22 '10

I misunderstood. Thanks for the clarification.