Software:FastAPI
Developer(s) | Sebastián Ramírez |
---|---|
Initial release | December 5, 2018[1] |
Repository | github |
Written in | Python |
Type | Web framework |
License | MIT |
Website | fastapi |
FastAPI is a modern web framework for building RESTful APIs in Python. It was first released in 2018 and has since quickly gained popularity among developers due to its ease of use, speed and robustness.
FastAPI is based on Pydantic and uses type hints to validate, serialize and deserialize data. It also automatically generates OpenAPI documentation for APIs built with it.[2]
FastAPI fully supports asynchronous programming and can run on Gunicorn and ASGI servers such as Uvicorn and Hypercorn,[3] making it a good choice for production environments. To improve developer-friendliness, editor support was considered since the project's earliest days.[4]
Components
Pydantic
Pydantic is a data validation library for Python. Since the type validation logic is written in Rust programming language, Pydantic is among the fastest data validation libraries for Python. While writing code in an IDE, Pydantic provides type hints for schema validation and serialization through type annotations.[5]
Starlette
Starlette is a lightweight ASGI framework/toolkit, to support async functionality in Python.[6] Starlette has shown great performance by independent benchmarks, which is inherited by FastAPI.[7]
Uvicorn
Uvicorn is a minimal low-level server/application web server for async frameworks, following the ASGI specification.
Features
- High performance
- Type hints
- Data validation
- Automatic documentation based on OpenAPI standards
- Dependency injection
Adoption and real-world usage
FastAPI was the third most loved web framework in Stack Overflow 2021 Developer Survey.[8]
Large companies like Uber and Netflix use it to develop some of their applications.[9][10]
Example
The following code shows a simple web application that displays "Hello World!" when visited:
from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return "Hello World!"
See also
- Django
- Flask
- Pylons project
- Web2py
- Tornado
- Comparison of web frameworks
- Representational state transfer
- Python (programming language)
External links
References
- ↑ "fastapi repo". 2018-12-05. https://github.com/tiangolo/fastapi/commits/master?after=eddbae948f04e13fe412dc45a569d10e34b698a4+1990&branch=master.
- ↑ Lubanovic, Bill (2019-11-06). Introducing Python: Modern Computing in Simple Packages (2nd ed.). O'Reilly Media, Inc. pp. 397, 418. ISBN 9781492051367. https://www.oreilly.com/library/view/introducing-python-2nd/9781492051374/.
- ↑ Philipp Kats; David Katz (2019-08-30). Learn Python by Building Data Science Applications. Packt Publishing Ltd. pp. 435, 365. ISBN 9781789535365.
- ↑ "History, Design and Future - FastAPI". https://fastapi.tiangolo.com/history-design-future/. Retrieved 4 November 2020.
- ↑ "Why use Pydantic - Pydantic". https://docs.pydantic.dev/latest/why/#performance.
- ↑ "Starlette". https://www.starlette.io/.
- ↑ "TechEmpower Web Framework Performance Comparison" (in en). https://www.techempower.com/benchmarks/#hw=ph&test=fortune&l=zijzen-sf§ion=data-r21.
- ↑ "Stack Overflow Developer Survey 2021" (in en). https://insights.stackoverflow.com/survey/2021/#section-most-loved-dreaded-and-wanted-web-frameworks.
- ↑ "Ludwig v0.2 Adds New Features and Other Improvements to its Deep Learning Toolbox". 2019-07-24. https://eng.uber.com/ludwig-v0-2/. Retrieved 4 November 2020.
- ↑ "Introducing Dispatch". 2020-02-25. https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072. Retrieved 4 November 2020.
Original source: https://en.wikipedia.org/wiki/FastAPI.
Read more |