TeamNewPipe / web-api

REST API providing external data feeds for the NewPipe website. Written as a micro service. In Python.
MIT License
22 stars 9 forks source link

Switch to Quart #12

Closed TheAssassin closed 3 years ago

TheAssassin commented 3 years ago

This PR switches the project over to Quart, a very Flask like asyncio-powered microframework for web apps. It's apparently slightly slower than our old Tornado setup. However, the difference is negligible for our purposes, and the old Tornado was also getting dated. The main advantage here is that we are now compatible with Python's standard asyncio, and could utilize any asyncio compatible libraries if we wanted to.

I've restructured the code into a (yet not quite perfect yet) Python package, and implemented the typical Flask patterns (app factory with blueprint) that'd also allow for better unit-testing of the code in the future (which might even get better with dependency injection, but I'm not sure how easy that is with Quart).

The project also now uses poetry. While this does indeed bloat our Docker image a bit, it makes handling dependencies a lot easier during development and in production. Maybe someone can find out why I can't just pip install the project inside Docker, though.

TheAssassin commented 3 years ago

@TobiGr doesn't have time to have a look. I benchmarked this solution a bit, and it appears to work fine. Let's merge this.