Tech stack for Python aurweb

Sven-Hendrik Haase svenstaro at gmail.com
Sun May 24 16:35:09 UTC 2020


Hi guys,

This is just a drive-by suggestion but as I've had my fair share of contact
with Python web development, both professional and as a hobby, I thought
I'd write something.

I've worked with Flask for a long time and it really got my career started
so it'll always live in a special place for me but I wouldn't use it for
modern projects anymore. Some of the patterns used by Flask and the
technologies surrounding it are pretty dated by modern standards (magical
globals anyone?).

Let me instead suggest you consider FastAPI [0]. I've created a few
projects using it and I love it. It has the feel of Flask while being
entirely modern and yet doesn't feel bloated at all. Here's my feature top
list:
- Great documentation (even for outside-of-happy-path cases)
- Very fast thanks to async (but you can mix sync and async routes if you
want to)
- Fully typed (with type-based input validation and marshaling using
Pydantic by the same author) which makes it possible to run mypy to good
effect
- Automatic OpenAPI-based API documentation generation based on the
aforementioned types
- Testing is very nice
- Dependency injection is nicer than using Flask's globals (but don't
overuse it!)

It doesn't ship with templating but you can easily add it. [1]

I'm unlikely to be the one implementing this so it's always your call and
I'll try to be helpful whichever framework you go with.

Cheers,
Sven

[0] https://fastapi.tiangolo.com/
[1] https://fastapi.tiangolo.com/advanced/templates/


More information about the aur-dev mailing list