Where does one draw the distinction between micro- and megaframeworks? Or, for that reference, just a "framework"?
Here is how we (Flask developers) define microframework: http://flask.pocoo.org/docs/foreword/#what-does-micro-mean
21–30 of 59 posts
Where does one draw the distinction between micro- and megaframeworks? Or, for that reference, just a "framework"?
Here is how we (Flask developers) define microframework: http://flask.pocoo.org/docs/foreword/#what-does-micro-mean
I have no idea how the LOC numbers of Flask come together though. Flask itself is 1.4KLOC, Jinja2 is 6.5KLOC and Werkzeug is 10KLOC (all measured without tests). Even if you add them up you don't end up with 32KLOC.
sudo pip install -u flask
cd /usr/local/lib/python2.6/dist-packages
find flask/ werkzeug/ jinja2/ -name '*.py' | xargs wc
...
34936 127298 1658380 total
Werkzeug alone has 18KLOC and does not ship with tests.Where does one draw the distinction between micro- and megaframeworks? Or, for that reference, just a "framework"?
Generally I would consider any framework which requires (almost) no setup requirements to be a microframework. This is opposed to frameworks which require a basic configuration, directory layout or certain files to be present.
However there are a lot of other people with other definitions regarding this, the distinction is not at all very clear for example there are people that consider being written in a single file to be a distinguishing feature of microframeworks.
I have no idea how the LOC numbers of Flask come together though. Flask itself is 1.4KLOC, Jinja2 is 6.5KLOC and Werkzeug is 10KLOC (all measured without tests). Even if you add them up you don't end up with 32KLOC.
The author probably did something like this: sudo pip install -u flask cd /usr/local/lib/python2.6/dist-packages find flask/ werkzeug/ jinja2/ -name '*.py' | xargs wc ... 34936 127298 1658380 total Werkzeug alone has 18KLOC and does not ship with tests.
With this little script (http://paste.pocoo.org/show/465885/) I get the following results:
Flask 1467 LOC
Jinja2 6560 LOC
Werkzeug 9923 LOC
Bottle 1910 LOC
(FWIW)Is this for real? Do people find the difference between the style of these micro-frameworks substantial? Maybe I've been out of Python-land for too long, but 70% of these look almost identical (raising exceptions for redirects, a combination of lists and naming conventions or decorators for routes/methods, etc.) and the other 30% look awful.
Furthermore, when all of the frameworks are basically the same, isn't a much more important question what scenario they were designed for, or what extra features they have, or performance, or how big a community they have? (Even where the author seems to have reasonable criteria, like WSGI, he doesn't seem able to look up that web.py is WSGI-based.) And seriously, does anyone care about Python 3 and/or PyPy support in 2011?
Another way of putting this: do the criteria that the author lists match anyone's criteria who is currently writing Python web applications in the real world?
Earlier quoted context omitted.
The author probably did something like this: sudo pip install -u flask cd /usr/local/lib/python2.6/dist-packages find flask/ werkzeug/ jinja2/ -name '*.py' | xargs wc ... 34936 127298 1658380 total Werkzeug alone has 18KLOC and does not ship with tests.
Those are not lines of code. That includes docstrings which all of Pocoo code is full of. If you want to measure lines of code you at least have to skip comments, docstrings and empty lines. And for that there is sloccount. This also includes the testsuites btw. With this little script ( http://paste.pocoo.org/show/465885/ ) I get the following results: Flask 1467 LOC Jinja2 6560 LOC Werkzeug 9923 LOC Bottle 1910 LOC…
Aside from Python3 Support (which is a bit irrelevant at this point), what does Bottle actually offer that Flask does not?
Nothing, that I can see. Flask has a thriving community, first-class extensions, extremely high quality documentation, and an elegant API. It even lets you dip down into the lower-level werkzeug when you want.
Is Bottle being chosen because of LOC? Again, completely irrelevant.
Earlier quoted context omitted.
Those are not lines of code. That includes docstrings which all of Pocoo code is full of. If you want to measure lines of code you at least have to skip comments, docstrings and empty lines. And for that there is sloccount. This also includes the testsuites btw. With this little script ( http://paste.pocoo.org/show/465885/ ) I get the following results: Flask 1467 LOC Jinja2 6560 LOC Werkzeug 9923 LOC Bottle 1910 LOC…
There are better ways to count LOC, I agree. But the idea is the same: Bottle does what it does with 1/10 of the code that runs flask.
Not all of the code that is in Jinja2 or Werkzeug is used by the average Flask application. Also Flask does a lot more than Bottle, even for the same things. The routing system behind Werkzeug itself already comes close to 1KLOC (and for good reasons). Which is why I think that any comparison between Bottle and Flask is pretty pointless, it's not really a fair fight for either.
For Flask it was never a goal to have less code than another framework, in fact, from our perspective that's quite a pointless goal.
Where does one draw the distinction between micro- and megaframeworks? Or, for that reference, just a "framework"?
Things a company will ask you to know is a megaframeworks. Else, it's a micro or simply framework. Obviously, I'm not serious here; but there's some truth in it. I.e. You'll see some companies ask for django or rails developers; not for flask python hacker right ;-)