Python Web development in 2021: Which web frameworks are the most popular by Github stars?
TL;DR: Django is the most popular webframework with 57,793 stars. The second place is Flask with 55,624 and the newcomer is FastAPI with 31,777 on the third place.
There are many Web development frameworks in the market. Choosing the right framework is a complex and tricky task. As company you choose a framework that will be maintained at least the next 5 years. It should also fit to your resources and goals. As a developer looking for a job, you will choose a framework which has high demand in the job market and fit your profile.
Here in this article, I will list five frameworks for both enterprises and developers ranked by git stars.
1. Django (57,793 stars)
Django is a free and open-source Python web development framework used in building websites. Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design (check out my article: https://gustavwillig.medium.com/is-django-in-2021-still-relevant-78848c5b8d59). For building highly scalable web applications with a constantly growing audience (e.g. content-based or news sites) is Django a good chose. It was created by Adrian Holovaty and Simon Willison in 2003 and used the Model-Template-View pattern.
- Rapid Development
- Fully loaded
- Open Source
- Vast and Supported Community
2. Flask (55,624 stars)
Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Flask was created by Armin Ronacher of Pocoo, an international group of Python enthusiasts formed in 2004. According to Ronacher, the idea was originally an April Fool’s joke that was popular enough to make into a serious application.
- Built-in development server, fast debugger
- Integrated support for unit testing
- RESTful request dispatching
- Jinja2 Templating
- Support for secure cookies
- Lightweight and modular design allows for a flexible framework
3. FastAPI (31,777 stars )
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. It was created by Sebastián Ramírez Montañ in 2019.
- Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette and Pydantic). One of the fastest Python frameworks available.
- Fast to code: Increase the speed to develop features by about 200% to 300%.
- Fewer bugs: Reduce about 40% of human (developer) induced errors.
- Intuitive: Great editor support. Completion everywhere. Less time debugging.
- Easy: Designed to be easy to use and learn. Less time reading docs.
- Short: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
- Robust: Get production-ready code with automatic interactive documentation.
- Standards-based: Based on (and fully compatible with) the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
4. Tornado (20,017 stars )
Tornado is a scalable, non-blocking web server and web application framework written in Python. It was developed for use by Friend Feed; the company was acquired by Facebook in 2009 and Tornado was open-sourced soon after.
- Built-in support for user authentication
- Real-time services
- High-quality performance
- Python-based web templating language
- Non-blocking HTTP client
- Implementation of third-party authentication and authorization schemes (Google OpenID/OAuth, Facebook Login, Yahoo BBAuth, FriendFeed OpenID/OAuth, Twitter OAuth)
- Support for translation and localization
5. Dash (14,629 stars )
Dash is an open-source Python, R, and Julia framework for building web-based analytic applications. Many specialized open-source Dash libraries exist that are tailored for building domain-specific Dash components and applications. Some examples are Dash DAQ, for building data acquisition GUIs to use with scientific instruments, and Dash Bio, which enables users to build custom chart types, sequence analysis tools and 3D rendering tools for bioinformatics applications. It was created by company Plotly in 2017.
- It allows you to build highly interactive applications using only Python code.
- It makes it simple to use the power of Python tools for manipulating data.