News for hackers. Stuff that matters.
Re:Bottle: Single-File Python Web Framework by zyfo on Sunday July 17, 2011 @01:48PM (#2773753)
Anyone who've used web.py and Bottle (for a real project) and care to comment on the pros/cons of both? I'm quite familiar with web.py but not so much with Bottle.
Re:Bottle: Single-File Python Web Framework by famousactress on Sunday July 17, 2011 @03:31PM (#2773972)
Used it early and extensively for a pretty good sized project. In my experience what really happens on a long-lived project is that you end up writing and assembling your own framework on top of the basics that are provided. Not a bad thing if you think you're gonna end up growing a lot of your own infra anyways..

I think mostly I'd use microframeworks like this in the future to do small projects and early prototyping.. or if I thought the project had special needs that was going to make using something like Django a particularly challenging match.

Re:Bottle: Single-File Python Web Framework by andybak on Sunday July 17, 2011 @04:22PM (#2774102)
It's an interesting dynamic. I'm going through a similar thought process except one level of abstraction higher (at the pseudo-CMS level on top of Django). I'm sure similar debates happen at lower levels of abstraction too.

You've got to decide for yourself where your 'reinventing the wheel' cutoff point is. For some people it's flipping binary bits, for others, anything lower level than configuring Drupal modules is just a waste of time.

Re:Bottle: Single-File Python Web Framework by rmk on Sunday July 17, 2011 @04:26PM (#2774110)
I used this thing in a desktop app that consumed a RESTful API service and received notifications (HTTP POSTs) from the API service.

At a high rate, bottle just dies. So if you have a situation where you are making many requests to it, be careful; your mileage may vary.

Re:Bottle: Single-File Python Web Framework by grncdr on Sunday July 17, 2011 @07:54PM (#2774554)
What WSGI server were you deploying on? I'm thinking of using Bottle for some providing some REST services, so any details you can provide would be helpful.
Re:Bottle: Single-File Python Web Framework by brandon on Monday July 18, 2011 @04:02AM (#2775501)
I can't speak for the parent poster, but I deployed bottle with the grandparent poster without any significant performance issues*. This was first under mod_wsgi, then paste.deploy once mod_wsgi got to be a headache, and now I'm looking at gunicorn as a simpler alternative to paste.deploy.

So, why the asterisk next to "no issues"? I was able to wedge our app once by doing frequent, unbuffered, blocking socket.reads for one byte at a time in our RPC library... the GIL is a fearsome thing and it didn't play well with this strategy under highly concurrent request loads. I don't see that as a bottle problem, though.

If you're anticipating high loads, though, I wholly recommend looking at Brubeck (http://brubeck.io/) or Tornado (http://www.tornadoweb.org/)

Re:Bottle: Single-File Python Web Framework by famousactress on Monday July 18, 2011 @09:25PM (#2779204)
I'd be curious for the details other asked for (define high rate, and how did you serve bottle)... Bottle services requests admirably. Not much there other than regexing your path and calling your function. If you had scalability issues I'd be tempted to believe it wasn't bottle code that was causing your problem (assuming you were using a real webserver to serve bottle workers).
Re:Bottle: Single-File Python Web Framework by ArchD on Sunday July 17, 2011 @03:40PM (#2773993)
I was considering using it for an internal webpage in my company. In my particular use case, I would have needed a separate backend thread that watches some files and gives some data to the server thread(s) with proper synchronization. However, because of the GIL, I decided that using threads like this only adds complexity to my code without improving performance. In the end, I chose Twisted, which supports async. Using Twisted also allows me to use hanging GETs without worrying about needing too many server threads.

I would have been happy to use Bottle if i) it had a feature that lets me specify FDs to watch and associated callbacks, like what I could do if I directly controlled the server select loop and ii) Python had built-in support for reader-writer locks.

Twisted had async support but it's documentation could be more comprehensive. I understood the programming model, classes and methods well enough to use it for my project only after tinkering with code, not from just reading documentation or looking at examples.

Re:Bottle: Single-File Python Web Framework by defnull on Sunday July 17, 2011 @07:10PM (#2774476)
http://bottlepy.org/docs/dev/async.html might be interesting for you.
Re:Bottle: Single-File Python Web Framework by dcreemer on Tuesday July 19, 2011 @01:51AM (#2779749)
I use bottle on top of gevent for two RESTful services, one of which sees peak 100's of requests per second. Bottle is perfect for my use case: basic routing, and a simple management / monitoring UI. I'm quite satisfied.