FastAPI is a modern web framework first released in 2018 for building RESTful APIs in Python. It is used for building APIs with Python 3.8+ based on standard Python-type hints.

FastAPI
Developer(s)Sebastián Ramírez
Initial releaseDecember 5, 2018; 5 years ago (2018-12-05)[1]
Stable release
0.110.0[2] Edit this on Wikidata / 24 February 2024; 28 days ago (24 February 2024)
Repositorygithub.com/tiangolo/fastapi
Written inPython
TypeWeb framework
LicenseMIT
Websitefastapi.tiangolo.com

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.[3]

Components edit

Pydantic edit

Pydantic is a data validation library for Python. While writing code in an IDE, Pydantic provides type hints for schema validation and serialization through type annotations.[4]

Starlette edit

Starlette is a lightweight ASGI framework/toolkit, to support async functionality in Python.[5]

Uvicorn edit

Uvicorn is a minimal low-level server/application web server for async frameworks, following the ASGI specification.

Example edit

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 edit

External links edit

References edit

  1. ^ "fastapi repo". GitHub. 2018-12-05.
  2. ^ "Release 0.110.0". 24 February 2024. Retrieved 22 March 2024.
  3. ^ Lubanovic, Bill (2019-11-06). Introducing Python: Modern Computing in Simple Packages (2nd ed.). O'Reilly Media, Inc. pp. 397, 418. ISBN 9781492051367.
  4. ^ "Why use Pydantic - Pydantic". docs.pydantic.dev. Retrieved 2023-09-21.
  5. ^ "Starlette". www.starlette.io. Retrieved 2023-09-21.