Skip to main content

5 posts tagged with "fastapi"

fastapi tag description

View All Tags

Benchmark: msgspec vs. Pydantic v2

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec is an extremely fast serialization and validation library that consistently outperforms Pydantic v2 in benchmarks. This performance advantage comes from its design as a lean, compiled-code-based library focused on a narrow set of data handling tasks, whereas Pydantic v2 is a feature-rich framework.

The performance differences are most pronounced in two key areas: parsing/decoding (converting data like JSON into Python objects) and serialization/encoding (converting Python objects into data like JSON).

Msgspec fastapi integration

· 4 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec is a Python library designed for high-performance serialization and validation, which makes it a powerful partner for FastAPI. It can be used as a drop-in replacement for FastAPI's default Pydantic models to handle data validation and schema generation, often leading to a significant speedup in API performance.

Measure execution time of a function or endpoint in FastAPI

· 4 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

The best and most precise way to measure the execution time of a function or endpoint in FastAPI is by using a custom decorator or a middleware. This approach allows you to wrap your functions with timing logic without modifying the function's code itself, promoting clean, reusable, and maintainable code.

Supabase FastAPI integration

· 4 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Supabase Integration with FastAPI

Here's a guide to integrating Supabase with a FastAPI application. We'll cover environment setup, connecting to Supabase, and performing basic CRUD operations.