English 中文(简体)
FastAPI - Introduction
  • 时间:2024-12-22

FastAPI - Introduction


Previous Page Next Page  

FastAPI is a modern Python web framework, very efficient in building APIs. It is based on Python’s type hints feature that has been added since Python 3.6 onwards. It is one of the fastest web frameworks of Python.

    As it works on the functionapty of Starlette and Pydantic pbraries, its performance is amongst the best and on par with that of NodeJS and Go.

    In addition to offering high performance, FastAPI offers significant speed for development, reduces human-induced errors in the code, is easy to learn and is completely production-ready.

    FastAPI is fully compatible with well-known standards of APIs, namely OpenAPI and JSON schema.

FastAPI has been developed by Sebastian Ramirez in Dec. 2018. FastAPI 0.68.0 is the currently available version.

FastAPI – EnvironmentSetup

To install FastAPI (preferably in a virtual environment), use pip installer.


pip3 install fastapi

FastAPI depends on Starlette and Pydantic pbraries, hence they also get installed.

Instalpng Uvicorn using PIP

FastAPI doesn’t come with any built-in server apppcation. To run FastAPI app, you need an ASGI server called uvicorn, so install the same too, using pip installer. It will also install uvicorn’s dependencies - asgiref, cpck, h11, and typing-extensions


pip3 install uvicorn

With these two pbraries installed, we can check all the pbraries installed so far.


pip3 freeze
asgiref==3.4.1
cpck==8.0.1
colorama==0.4.4
fastapi==0.68.0
h11==0.12.0
importpb-metadata==4.6.4
pydantic==1.8.2
starlette==0.14.2
typing-extensions==3.10.0.0
uvicorn==0.15.0
zipp==3.5.0
Advertisements