FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
FastAPI는 표준 Python 타입 힌트를 기반으로 한 Python 3.7+용 모던하고 빠른(고성능) 웹 프레임워크입니다.
Even dependencies can have dependencies, creating a hierarchy or "graph" of dependencies.
→ 의존성은 의존성을 가질 수 있으며, 의존성의 계층 또는 "그래프"를 만듭니다.
All automatically handled by the framework.
All the dependencies can require data from requests and augment the path operation constraints and automatic documentation.
→ 모든 종속성은 요청에서 데이터를 요구하고 경로 작업 제약과 자동 문서화를 보완할 수 있습니다.
Automatic validation even for path operation parameters defined in dependencies.
→ 의존성에 정의된 경로 작업 매개변수에 대해서도 자동 유효성 검사를 수행합니다.
Support for complex user authentication systems, database connections, etc.
No compromise with databases, frontends, etc. But easy integration with all of them.
No brainfuck: https://en.wikipedia.org/wiki/Brainfuck
Plays nicely with your IDE/linter/brain
Fast: in benchmarks Pydantic is faster than all other tested libraries.
Validate complex structures:
typing
’s List
and Dict
, etc.Extensible:
Pydantic allows custom data types to be defined or you can extend validation with methods on a model decorated with the validator decorator.
→ Pydantic는 사용자 정의 데이터 유형을 정의할 수 있도록 하거나, validator 데코레이터가 있는 모델의 메서드로 유효성 검사를 확장할 수 있습니다.
100% test coverage.
from typing import Union
from fastapi import Depends, FastAPI
app = FastAPI()
async def common_parameters(
q: Union[str, None] = None, skip: int = 0, limit: int = 100
):
return {"q": q, "skip": skip, "limit": limit}
@app.get("/items/")
async def read_items(commons: dict = Depends(common_parameters)):
return commons
@app.get("/users/")
async def read_users(commons: dict = Depends(common_parameters)):
return commons
@app.get(~~)
: path operation function