FastAPI, Pydantic, Psycopg3: the holy trinity for Python web APIs

This page summarizes the projects mentioned and recommended in the original post on dev.to

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • litestar

    Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs

    If I was starting from scratch with Python web API development today, I would probably look more closely at LiteStar, which seems to me to be a better architected and with a better project governance structure.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • asgiref

    ASGI specification and utilities

    Note 1: we are only interested in async libraries here, as FastAPI is ASGI.

  • tortoise-orm

    Familiar asyncio ORM for python, built with relations in mind

    TortoiseORM: I personally really like this Django-inspired async ORM; it's clean and nice to use.

  • Peewee

    a small, expressive orm -- supports postgresql, mysql, sqlite and cockroachdb

    Alternative ORMs: there are many such as peewee, PonyORM, etc.

  • PonyORM

    Pony Object Relational Mapper

    Alternative ORMs: there are many such as peewee, PonyORM, etc.

  • databases

    Async database support for Python. 🗄

    SQLAlchemy Core: the core SQL query builder, without the mapping to objects part. There is also a higher level ORM built on this called databases that looks very nice. I do wonder how actively developed the project is however.

  • PyPika

    PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.

    PyPika: I don't know much about this one.

  • asyncpg

    A fast PostgreSQL Database Client Library for Python/asyncio.

    asyncpg: this was the gold standard async database driver for Postgres, being one of the first to market and most performant. While all other drivers use the C library libpq to interface with Postgres, MagicStack opted to rewrite their own custom implementation and also deviate from Python DBAPI spec. If performance is your main criteria here, then asyncpg is probably the best option.

  • psycopg

    New generation PostgreSQL database adapter for the Python programming language

    psycopg3: well psycopg2 was clearly the king of the synchronous database driver world for Python/Postgres. psycopg3 (rebranded to simply psycopg) is the next, fully async, iteration of this library. This library has really come into it's own in recent years & I wish to discuss it further. See this interesting blog from the author about the early days of psycopg3.

  • pydantic

    Data validation using Python type hints

    Pydantic is bundled with FastAPI and is excellent for modelling, validating, and serialising API responses.

  • sqlmodel

    SQL databases in Python, designed for simplicity, compatibility, and robustness.

    This is exactly the problem the creator of FastAPI tried to solve with the library SQLModel.

  • attrs

    Python Classes Without Boilerplate

    This functionality allows you to map returned database data to any Python object, including standard lib dataclasses, models from the great attrs library, and yes, Pydantic models!

  • fmtm

    Field Mapping Tasking Manager - coordinated field mapping.

    See the full codebase here. And ⭐ if you found this useful!

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Piccolo ORM – A powerful async ORM for Python

    1 project | news.ycombinator.com | 20 Nov 2024
  • asyncer VS asyncutor - a user suggested alternative

    2 projects | 11 Jul 2024
  • Psycopg 3.2 released – PostgreSQL driver for Python

    1 project | news.ycombinator.com | 1 Jul 2024
  • Reverse-engineered Shazam audio signature generator

    1 project | news.ycombinator.com | 20 May 2024
  • FLaNK Stack 26 February 2024

    50 projects | dev.to | 26 Feb 2024

Did you konow that Python is
the 1st most popular programming language
based on number of metions?