Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ leveraging the power of asyncio and event loops.

Notably, this example showcases the latest and greatest versions of SQLAlchemy and psycopg,
which are renowned for their robustness, power, and speed. The inclusion of FastAPI adds a modern, fast, and high-performance web framework to the mix
allowing for the rapid development of APIs with Python 3.8+.
allowing for the rapid development of APIs with Python 3.13.

FastAPI has received significant recognition in the industry, including a review on thoughtworks Technology Radar in April 2021,
where it was classified as a Trial technology, with comments praising its performance, ease of use,
Expand Down Expand Up @@ -217,7 +217,9 @@ I've included a few of my favorites to kick things off!
<details>
<summary>2025 (3 changes)</summary>
<ul>
<li>[MAY 3 2025] add large language model integration :robot:</li>
<li>[AUG 23 2025] intro exception handlers</li>
<li>[JUL some sunny day 2025] add rotoger</li>
<li>[MAY 3, 2025] add large language model integration :robot:</li>
<li>[MAR 8 2025] switch from poetry to uv :fast_forward:</li>
<li>[JAN 28 2025] add SMTP setup :email:</li>
</ul>
Expand All @@ -229,7 +231,7 @@ I've included a few of my favorites to kick things off!
<li>[OCT 16 2024] apscheduler added to project :clock1:</li>
<li>[AUG 17 2024] granian use case implemented with docker compose and rich logger :fast_forward:</li>
<li>[JUN 8 2024] implement asyncpg connection pool :fast_forward:</li>
<li>[MAR 15 2024] add polars and calamine to project :heart_eyes_cat:</li>
<li>[MAR 15, 2024] add polars and calamine to project :heart_eyes_cat:</li>
<li>[FEB 1 2024] bump project to Python 3.12 :fast_forward:</li>
</ul>
</details>
Expand Down Expand Up @@ -274,21 +276,21 @@ I've included a few of my favorites to kick things off!
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/python-has-powers/

[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.115.11-009485?style=for-the-badge&logo=fastapi&logoColor=white
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.116.1-009485?style=for-the-badge&logo=fastapi&logoColor=white
[fastapi-url]: https://fastapi.tiangolo.com/
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.10.6-e92063?style=for-the-badge&logo=pydantic&logoColor=white
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.12.0a1-e92063?style=for-the-badge&logo=pydantic&logoColor=white
[pydantic-url]: https://docs.pydantic.dev/latest/
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.38-bb0000?color=bb0000&style=for-the-badge
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.43-bb0000?color=bb0000&style=for-the-badge
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.34.0-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.35.0-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
[uvicorn-url]: https://www.uvicorn.org/
[asyncpg.github.io]: https://img.shields.io/badge/asyncpg-0.30.0-2e6fce?style=for-the-badge&logo=postgresql&logoColor=white
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
[pytest.org]: https://img.shields.io/badge/pytest-8.3.5-fff?style=for-the-badge&logo=pytest&logoColor=white
[pytest.org]: https://img.shields.io/badge/pytest-8.4.1-fff?style=for-the-badge&logo=pytest&logoColor=white
[pytest-url]: https://docs.pytest.org/en/6.2.x/
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.15.1-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.16.4-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
[rich.readthedocs.io]: https://img.shields.io/badge/rich-13.9.4-009485?style=for-the-badge&logo=rich&logoColor=white
[rich.readthedocs.io]: https://img.shields.io/badge/rich-14.1.0-009485?style=for-the-badge&logo=rich&logoColor=white
[rich-url]: https://rich.readthedocs.io/en/latest/
[redis.io]: https://img.shields.io/badge/redis-5.2.1-dc382d?style=for-the-badge&logo=redis&logoColor=white
[redis.io]: https://img.shields.io/badge/redis-6.4.0-dc382d?style=for-the-badge&logo=redis&logoColor=white
[redis-url]: https://redis.io/
2 changes: 1 addition & 1 deletion app/exception_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

logger = AppStructLogger().get_logger()


#TODO: add reasoning for this in readme plus higligh using re-raise in db session
async def sqlalchemy_exception_handler(
request: Request, exc: SQLAlchemyError
) -> JSONResponse:
Expand Down
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def lifespan(app: FastAPI):
def create_app() -> FastAPI:
app = FastAPI(
title="Stuff And Nonsense API",
version="0.19.0",
version="0.20.0",
lifespan=lifespan,
)
app.include_router(stuff_router)
Expand Down
2 changes: 1 addition & 1 deletion db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pull official base image
FROM postgres:17.4-alpine
FROM postgres:17.6-alpine

# run create.sql on init
ADD create.sql /docker-entrypoint-initdb.d
Expand Down
38 changes: 19 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
[project]
name = "fastapi-sqlalchemy-asyncpg"
version = "0.19.0"
version = "0.20.0"
description = "A modern FastAPI application with SQLAlchemy 2.0 and AsyncPG for high-performance async database operations. Features include JWT authentication with Redis token storage, password hashing, connection pooling, data processing with Polars, Rich logging, task scheduling with APScheduler, and Shakespeare datasets integration."
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"fastapi[all]>=0.115.12",
"pydantic[email]>=2.11.5",
"pydantic-settings>=2.9.1",
"sqlalchemy>=2.0.41",
"uvicorn[standard]>=0.34.3",
"fastapi[all]>=0.116.1",
"pydantic[email]>=2.12.0a1",
"pydantic-settings>=2.10.1",
"sqlalchemy>=2.0.43",
"uvicorn[standard]>=0.35.0",
"asyncpg>=0.30.0",
"alembic>=1.16.1",
"alembic>=1.16.4",
"httpx>=0.28.1",
"pytest>=8.4.0",
"pytest-cov>=6.1.1",
"pytest>=8.4.1",
"pytest-cov>=6.2.1",
"uvloop>=0.21.0",
"httptools>=0.6.4",
"rich>=14.0.0",
"rich>=14.1.0",
"pyjwt>=2.10.1",
"redis>=6.2.0",
"redis>=6.4.0",
"bcrypt>=4.3.0",
"polars>=1.30.0",
"polars>=1.32.3",
"python-multipart>=0.0.20",
"fastexcel>=0.14.0",
"inline-snapshot>=0.23.2",
"inline-snapshot>=0.27.2",
"dirty-equals>=0.9.0",
"polyfactory>=2.21.0",
"granian>=2.3.2",
"polyfactory>=2.22.2",
"granian>=2.5.0",
"apscheduler[redis,sqlalchemy]>=4.0.0a6",
"rotoger",
]

[tool.uv]
dev-dependencies = [
"ruff>=0.11.13",
"ruff>=0.12.10",
"devtools[pygments]>=0.12.2",
"pyupgrade>=3.20.0",
"ipython>=9.3.0",
"sqlacodegen>=3.0.0",
"ipython>=9.4.0",
"sqlacodegen<=3.1.0",
"tryceratops>=2.4.1",
"locust>=2.37.9"
"locust>=2.39.0"

]

Expand Down
Loading