A Beginner’s Introduction to Python Web Frameworks (2018)
101–110 of 168 posts
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#102This is a short list I have compiled a few months ago, FWIW: New kids on the block: - Starlette https://www.starlette.io - Vibora https://vibora.io - Xweb https://github.com/gaojiuli/xweb - Storm https://github.com/jiajunhuang/storm - Responder http://python-responder.org - Quart https://pgjones.gitlab.io/quart/ - Sanic https://sanic.readthedocs.io - Bocadillo https://bocadilloproject.github.io/ - Japronto https://gi…
Any of those have good Swagger integration? https://swagger.io/
https://github.com/ergo/pyramid_apispec
I'm pretty sure all other popular frameworks have integrations too.
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#103Earlier quoted context omitted.
async is more beneficial for when code is primarily network bound. WSGI is thread based which comes with a higher overhead for task switching. So it’s just not as efficient for most web server tasks.
Ok I think I get it, but if your backend is say, making a single API call and sending that result back to the user, then there's no advantage to going async since the user has to wait for that network call anyways, right? Would you use this async then in instances where some of the API calls don't matter to your user?
With asyncio based implementations, while the coroutine is waiting for the response on the API call, the process's event loop can check on the coroutine which is handling the network socket and start processing another request. Ideally it should have no impact on the amount of time the original request takes to process but you can see how it might since when the API call resolves, the process may be working on the other request instead of continuing with the original coroutine.
Asynchronous code in general can allow you to extend your bandwidth past the number of concurrent executions your program can maintain (whether they be processes in python or threads in other languages) by doing additional work while it is waiting for something to complete. Ideally it should not cost much in terms of latency.
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#104Earlier quoted context omitted.
Django's tagline is "The Web framework for perfectionists with deadlines".
.. That comes with a brief documentation of 1941 pages (as of August 20, 2019)..
I am sure Flasks documentation is a lot smaller but its essentially just a few parts of Django (it doesn't have a built in ORM from what I understand). Start adding in the documentation for SQL alchemy, documentation for an authentication library and whatever else you need and you will probably start getting something similar but without the guarantee that the pieces will play nicely together.
(Djangos documentation is really good.)
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#105We need to write a lot of small APIs in Python for SPAs. We ended up going with FastAPI which utilizes Starlette under the hood. I'm surprised neither of them are mentioned here. Starlette was developed by the same dev who wrote the Django RESTful package. If you mostly just need REST APIs or even GraphQL, it feels far more light and modern than anything in Django and forms some better opinions around things than the…
Do frameworks need to be asynchronous or is it good enough to just spawn threads for background tasks?
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#106For such a comprehensive list, no mention of tornado?
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#107Earlier quoted context omitted.
Any of those have good Swagger integration? https://swagger.io/
FastAPI (built on Starlette) essentially generates your OpenAPI docs for free via intuitive use of decorators and type hints/Pydantic models.
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#108I started working with Python around 2013 and I still consider Django the best framework to use. Yes Flask you can pick what you want to use but I have found the supporting libraries to be a bit outdated. Everytime I have used it I feel like I am just gluing together a lot of different pieces and it becomes messy. Django is constantly updated and I have little to no worries about security issues. Edit: And I have bee…
We have a legacy Django app at work. Coming from Rails and living in the npm eco-system for the past few years, Django to me seems like an anti-pattern framework in a death-spiral.
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#109The post doesn't mention Django's migration system, which is a killer feature. Of course, one should change their database infrequently and deliberately, but it is nonetheless a delight to use, and a feature that is not matched by many other web frameworks, Python-based or otherwise.
I think this attitude leads to a lot of crappy code. It's "safer" just to add a bit more to the application layer than to change the database, but do that enough times and you end up with a mess to compensate for a database design that doesn't model what it needs to. (Learned through experience).
Re: A Beginner’s Introduction to Python Web Frameworks (2018)
#110Are any of these extremely good compared to a framework not written in Python? For example compared to Rails or Phoenix?