Python frameworks to watch in 2022
Image Courtesy: plainconcepts.com

Python frameworks to watch in 2022

There have been many popular python frameworks. Flask and Django being the most popular of the lot. This is changing. There seem to be a couple of frameworks with a promising and interesting approach.

FastAPI

A lot has been written about FastAPI vs Flask vs Django as python frameworks for modern API Driven microservices or web development. Let us look at some of the reasons which may make FastAPI a better choice

  1. Size: Core project (wheel) size on PyPI

  • Django 4.0 ~ 8 MB
  • Flask (latest) ~95.6 KB
  • FastAPI (latest) ~56 KB

Reduced size typically is preferable as it means reduced load time and reduced cost esp. when deployed as AWS Lambda.

2. Performance

No alt text provided for this image

3. Developer Productivity:

  • Single code base for all endpoints of a single micro-service deployed as a single AWS Lambda. Maintains cohesive consistent codebase for logical components in your architecture.
  • Pydantic based automatic JSON models for input/output of REST APIs.
  • Automatic OpenAPI Specification and in-built documentation by way of swagger/redoc.
  • As easy or as hard as Flask in terms of verbosity of code.
  • Good scaffolding/bootstrap/template code available to get started. Refer: https://fastapi.tiangolo.com/project-generation/
  • Having used it in production can claim it to be much simpler than Django and other lot. Especially with SQLAlchemy like popular python ORM tools for database interaction. Enabled us to train newer developers/Freshers/Interns to get productive quickly esp. even those who were new to Python itself.

Japronto

Disclaimer: Haven't used it just read about the performance it delivers with respect to microservices in #GoLang. Refer: Million requests/sec with Python

Performance is always relative. Also deployment matters a lot. So writing a lot of high performance concurrent code but running it in single CPU containers/lambdas may not always give desired results. One approach is to prefer productivity over performance as it can help deliver products faster to market. With this approach, optimisations can always be done later and helps avoid pre-mature performance optimisations and over-engineering the system design/components than really needed for intended performance or cost. Although better performance is always appreciated to begin with choose correct evaluation parameters and framework matters as these are costly to change later.

Japronto looks promising at least on paper. (Refer: Image below, courtesy JaPronto)

No alt text provided for this image

It seems the reasons for this performance mainly are

  • Written in C
  • Pipelining HTTP server?based on?uvloop?and?picohttpparser.
  • For internal details of optimisations it internally uses - refer this link.

However, it is still in alpha and its GitHub repo itself recommends to use sanic. It is also claimed that certain http servers in Go give performance closer to Japronto. However considering developer productivity even if performance is equitable Japronto will have an edge in python, unless of course the open source project remains un-maintained. Repo seems to have not been updated in last 2 years. Although Github 'issues', 'likes' and 'forks' tell different story. Japronto seems like worthwhile approach at least on paper.

Anything else upcoming/interesting in Python world? Please feel free to share your thoughts in comments below.

要查看或添加评论,请登录

Bhavik Shah的更多文章

  • Scaling up with AWS Lambda

    Scaling up with AWS Lambda

    AWS Lambda is a very effective deployment model for various web frameworks like NodeJS Express, Python FastAPI, GoLang…

  • Composable Architectures

    Composable Architectures

    What is CA? Composable architecture is a way of designing software that makes it easy to create reusable components…

  • Go Lang Framework to watch in 2022

    Go Lang Framework to watch in 2022

    Go Lang is becoming quite popular not only because it is easy to learn but also for its performance, concurrency and…

  • Why Vue is preferable to Angular in 2022?

    Why Vue is preferable to Angular in 2022?

    UI frameworks have come of age. We had used Angular 1.

  • Baking Multi Tenancy in SaaS

    Baking Multi Tenancy in SaaS

    Multi-tenancy is a common requirement in any modern SaaS. The way a B2C SaaS will support it will vary greatly from a…

    1 条评论
  • How to migrate legacy applications to newer architectures

    How to migrate legacy applications to newer architectures

    This is a well known challenge, faced by many organizations atleast once during the software lifecycle. It is faced by…

  • Eazy Kubernetes on Google Cloud

    Eazy Kubernetes on Google Cloud

    Google Cloud makes is super easy to deploy kubernetes clusters. Step 1: Choose to create a cluster Step 2: Provide…

  • Website to App in Minutes!

    Website to App in Minutes!

    Convert website into mobile app! It has been said that an average user spends over 2 hours on mobile phone while 86% of…

    6 条评论
  • How to choose a NoSQL Database

    How to choose a NoSQL Database

    NoSQL has been beautifully explained by Martin Fowler in his book especially the four main types of NoSQL databases…

  • Serve Windows from Google Cloud

    Serve Windows from Google Cloud

    Google Cloud Platform has come a long way from AppEngine days when it was more of PaaS platform allowing you to run app…

社区洞察

其他会员也浏览了