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

6

u/Siraf Dec 22 '10

Actually, I didn't consider the dependencies. Good call. Flask is definitely somewhere between django and bottle in terms of dependencies. I typically have a flask installation up and running in 10 minutes thanks to pip, gunicorn, and virtualenv.

0

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

EDIT: I apologize for the previous joke. It was not on you. It was on me.

I am not sure where Django stands in terms of size if you take out the ORM (Flask does not include one), contrib and tests (I did not include them in my Flask measurement) and the apps (Django has admin and the scaffolding app for example). Probably Flask and Django score pretty close... like Flask and web2py do. Which was the point I tried to make.

Once you include SQLALchemy in Flask or Bottle things change dramatically. In terms of lines of code SQLALchemy is 40,000+ lines of code, bigger than the entire web2py+dal. I would not be surprised if Flask+SQLAlchemy is larger than Django.

I would like to see the people involved publish some numbers. Ideally I would like to see numbers broken by category (core, dal/orm, contrib, apps, tests) not counting blank lines and comments in code.

The web2py dal is a single file and 4949 lines. I think it would make a good pair with bottle. We just changed the license to LGPL3 so it would not affect apps built with it.

3

u/gynecomastic Dec 22 '10

I think this misses the point about what a "microframework" does.

It doesn't really matter from the development point of view how big, in terms of lines of code/modules/dependencies, the framework is. What matters is scope/complexity vs features.

For example, Django provides more out of the box functionality - ORM, admin, auth etc - over Bottle. But Bottle provides (arguably) less conceptual overhead and more flexibility, with the bare minimum to get started with a simple WSGI app. You don't have an ORM, you add one yourself (SQLAlchemy, PyMongo, whatever) or do without one if you wish. Either framework may be a good choice, it depends on requirements and preferences.

I couldn't care less how many lines of code each are written in however. Function call overhead is a concern - how efficiently the code runs - but lines of code != number of function calls. For example, even if SQLAlchemy has 40,000 lines of code, much of that is support for different SQL dialects, extensions etc that will only be executed if you are running a certain extension or dialect.

4

u/Siraf Dec 22 '10

For my ORM, I definitely side-stepped the SQLAlchemy issue by jumping on the NoSQL boat. I use mongoDB.

I'm more of a fan of MongoEngine than mongokit for the vain reason I find the syntax to be more pleasing.

You're definitely right about using lines of code as a metric.