This post looks at how to configure Celery to handle long-running tasks in a FastAPI app.
FastAPI is a modern, high-performance, batteries-included Python web framework that's perfect for building RESTful APIs. It can handle both synchronous and asynchronous requests and has built-in support for data validation, JSON serialization, authentication and authorization, and OpenAPI.
- Heavily inspired by Flask, it has a lightweight microframework feel with support for Flask-like route decorators.
- It takes advantage of Python type hints for parameter declaration which enables data validation (via Pydantic) and OpenAPI/Swagger documentation.
- Built on top of Starlette, it supports the development of asynchronous APIs.
- It's fast. Since async is much more efficient than the traditional synchronous threading model, it can compete with Node and Go with regards to performance.
The tutorials and articles on TestDriven focus on developing and testing production-ready RESTful APIs along with serving up machine learning models.
Latest Posts (12)
This tutorial details how to configure FastAPI to run on Docker along with Postgres, Uvicorn, Traefik, and Let's Encrypt.
Develop and test an asynchronous API with FastAPI, Postgres, pytest, and Docker using Test-driven Development (TDD).
Commonly used web authentication methods.
Secure a FastAPI application with JSON Web Tokens.
Build a CRUD app with FastAPI and GraphQL.
How property-based testing via Hypothesis and Schemathesis can be used to test FastAPI
Build a CRUD app with FastAPI and React.
Interested in moving from Flask to FastAPI? This article compares and contrasts common patterns in both Flask and FastAPI.
Develop an asynchronous API with FastAPI and MongoDB.
Serve up a style transfer machine learning model with FastAPI and Streamlit.
Develop a production-ready RESTful API for serving up a machine learning model with FastAPI.