This repository contains the materials for the Cleveland Python Meetup presentation on FastAPI, held in January 2025. It includes a sample FastAPI application and the presentation slides.
code_example/: A complete, working FastAPI application demonstrating CRUD operations with SQLModel.slides/: The Markdown source for the presentation slides (fastapi_presentation.md).
The code_example directory contains a simple API for managing a database of ingredients. It demonstrates core FastAPI features including:
- Pydantic models for data validation (Input/Output schemas).
- SQLModel for ORM (SQLite database).
- Dependency Injection for database sessions.
- CRUD endpoints (Create, Read, Update, Delete).
- Python 3.14+
uv(recommended for package management)
-
Navigate to the
code_exampledirectory:cd code_example -
Install dependencies using
uv:uv sync
-
Run the application:
uv run uvicorn main:app --reload
The API will be available at
http://127.0.0.1:8000. -
Explore the interactive documentation:
- Swagger UI:
http://127.0.0.1:8000/docs - ReDoc:
http://127.0.0.1:8000/redoc
- Swagger UI:
To run the tests using pytest:
cd ./code_example/
PYTHONPATH=. uv run pytestThe presentation covers:
- Introduction to FastAPI.
- Comparison with Django and Flask.
- Key features (Performance, Async, Type Hints, etc.).
- Best practices.
You can view the raw markdown in slides/fastapi_presentation.md.