How property-based testing via Hypothesis and Schemathesis can be used to test FastAPI
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.io focus on developing and testing production-ready RESTful APIs, integrating FastAPI with Vue and React, and serving up machine learning models.
Latest Posts (16)
Develop an asynchronous API with FastAPI, MongoDB, and Beanie.
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.
Deploy a FastAPI Application to AWS Elastic Beanstalk.
Develop an asynchronous API with FastAPI and MongoDB.
Serve up a style transfer machine learning model with FastAPI and Streamlit.
Configure SQLAlchemy, SQLModel, and Alembic to work with FastAPI asynchronously.
Step-by-step walkthrough of how to set up a basic CRUD app with Vue and FastAPI.
Develop a production-ready RESTful API for serving up a machine learning model with FastAPI.
This post looks at how to configure Celery to handle long-running tasks in a FastAPI app.
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.