mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-06-10 06:40:38 +03:00
Merge pull request #240 from grillazz/41-add-slimfast-option
41 add slimfast option
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.14.0-slim-trixie AS base
|
FROM python:3.14.4-slim-trixie AS base
|
||||||
|
|
||||||
RUN apt-get update -qy \
|
RUN apt-get update -qy \
|
||||||
&& apt-get install -qyy \
|
&& apt-get install -qyy \
|
||||||
@@ -7,11 +7,11 @@ RUN apt-get update -qy \
|
|||||||
build-essential \
|
build-essential \
|
||||||
ca-certificates
|
ca-certificates
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.9.17 /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:0.11.12 /uv /uvx /bin/
|
||||||
|
|
||||||
ENV UV_LINK_MODE=copy \
|
ENV UV_LINK_MODE=copy \
|
||||||
UV_COMPILE_BYTECODE=1 \
|
UV_COMPILE_BYTECODE=1 \
|
||||||
UV_PYTHON=python3.14.0 \
|
UV_PYTHON=python3.14.4 \
|
||||||
UV_PROJECT_ENVIRONMENT=/panettone
|
UV_PROJECT_ENVIRONMENT=/panettone
|
||||||
|
|
||||||
COPY pyproject.toml /_lock/
|
COPY pyproject.toml /_lock/
|
||||||
@@ -19,7 +19,7 @@ COPY uv.lock /_lock/
|
|||||||
|
|
||||||
RUN cd /_lock && uv sync --locked --no-install-project
|
RUN cd /_lock && uv sync --locked --no-install-project
|
||||||
##########################################################################
|
##########################################################################
|
||||||
FROM python:3.14.0-slim-trixie
|
FROM python:3.14.4-slim-trixie
|
||||||
|
|
||||||
ENV PATH=/panettone/bin:$PATH
|
ENV PATH=/panettone/bin:$PATH
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,7 @@
|
|||||||
|
|
||||||
## About The Project
|
## About The Project
|
||||||
|
|
||||||
This example demonstrates the seamless integration of [FastAPI](https://fastapi.tiangolo.com/), a modern, high-performance web framework,
|
This demonstration application showcases the powerful integration of [FastAPI](https://fastapi.tiangolo.com/)—a modern, high-performance web framework—with [Pydantic 2.0](https://github.com/pydantic/pydantic) for robust data validation. The backend architecture is further reinforced by leveraging the [SQLAlchemy ORM](https://www.sqlalchemy.org/) along with an asynchronous connection to a [PostgreSQL 17](https://www.postgresql.org/docs/17/release.html) relational database. High-throughput communication across the stack is achieved using the [asyncpg](https://github.com/MagicStack/asyncpg) database client library, delivering an efficient, non-blocking interface to process database transactions seamlessly within Python's asyncio event loop.
|
||||||
with [Pydantic 2.0](https://github.com/pydantic/pydantic), a robust and powerful data validation library.
|
|
||||||
The integration is further enhanced by the use of [SQLAlchemy ORM](https://www.sqlalchemy.org/), a popular and feature-rich Object-Relational Mapping tool,
|
|
||||||
and [PostgreSQL17](https://www.postgresql.org/docs/17/release.html) relational database.
|
|
||||||
The entire stack is connected using the [asyncpg](https://github.com/MagicStack/asyncpg) Database Client Library,
|
|
||||||
which provides a robust and efficient way to interact with PostgreSQL databases in Python,
|
|
||||||
leveraging the power of asyncio and event loops.
|
|
||||||
|
|
||||||
### Built With
|
### Built With
|
||||||
[![FastAPI][fastapi.tiangolo.com]][fastapi-url]
|
[![FastAPI][fastapi.tiangolo.com]][fastapi-url]
|
||||||
@@ -76,7 +70,7 @@ leveraging the power of asyncio and event loops.
|
|||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
### Make will help you
|
### Make will help you
|
||||||
To build , run and test and more ... use magic of make help to play with this project.
|
To simplify building, running, testing, and managing this project, a `Makefile` is provided. Run `make help` to see a full list of available commands.
|
||||||
```shell
|
```shell
|
||||||
1. make docker-build
|
1. make docker-build
|
||||||
2. make docker-up > alternatively > make docker-up-granian
|
2. make docker-up > alternatively > make docker-up-granian
|
||||||
@@ -90,10 +84,9 @@ To build , run and test and more ... use magic of make help to play with this pr
|
|||||||
|
|
||||||
### How to feed database
|
### How to feed database
|
||||||
|
|
||||||
It took me a while to find nice data set. Hope works of Shakespeare as example will be able to cover
|
Finding a robust and engaging dataset can be challenging. Fortunately, the works of William Shakespeare provide an excellent foundation for demonstrating read-only declarative models and executing a wide variety of complex queries.
|
||||||
first part with read only declarative base configuration and all type of funny selects :)
|
The dataset originates from https://github.com/catherinedevlin/opensourceshakespeare.
|
||||||
Data set is coming form https://github.com/catherinedevlin/opensourceshakespeare
|
The data models were subsequently generated using https://github.com/agronholm/sqlacodegen.
|
||||||
Next models were generated with https://github.com/agronholm/sqlacodegen
|
|
||||||
|
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
||||||
@@ -254,8 +247,9 @@ I've included a few of my favorites to kick things off!
|
|||||||
|
|
||||||
## Change Log
|
## Change Log
|
||||||
<details>
|
<details>
|
||||||
<summary>2026 (1 change)</summary>
|
<summary>2026 (2 changes)</summary>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>[MAY 10 2026] bump project to Python 3.14 :fast_forward:</li>
|
||||||
<li>[FEB 5 2026] add profiler middleware :crystal_ball:</li>
|
<li>[FEB 5 2026] add profiler middleware :crystal_ball:</li>
|
||||||
<li>[JAN 11 2026] refactor test fixture infrastructure to improve test isolation :test_tube:</li>
|
<li>[JAN 11 2026] refactor test fixture infrastructure to improve test isolation :test_tube:</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -323,27 +317,27 @@ 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-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/
|
[linkedin-url]: https://www.linkedin.com/in/python-has-powers/
|
||||||
|
|
||||||
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.121.2-009485?style=for-the-badge&logo=fastapi&logoColor=white
|
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.124.4-009485?style=for-the-badge&logo=fastapi&logoColor=white
|
||||||
[fastapi-url]: https://fastapi.tiangolo.com/
|
[fastapi-url]: https://fastapi.tiangolo.com/
|
||||||
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.12.4-e92063?style=for-the-badge&logo=pydantic&logoColor=white
|
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.12.5-e92063?style=for-the-badge&logo=pydantic&logoColor=white
|
||||||
[pydantic-url]: https://docs.pydantic.dev/latest/
|
[pydantic-url]: https://docs.pydantic.dev/latest/
|
||||||
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.44-bb0000?color=bb0000&style=for-the-badge&logo=python&logoColor=white
|
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.45-bb0000?color=bb0000&style=for-the-badge&logo=python&logoColor=white
|
||||||
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
|
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
|
||||||
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.38.0-2094f3?style=for-the-badge&logo=python&logoColor=white
|
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.38.0-2094f3?style=for-the-badge&logo=python&logoColor=white
|
||||||
[uvicorn-url]: https://www.uvicorn.org/
|
[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.github.io]: https://img.shields.io/badge/asyncpg-0.31.0-2e6fce?style=for-the-badge&logo=postgresql&logoColor=white
|
||||||
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
|
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
|
||||||
[pytest.org]: https://img.shields.io/badge/pytest-9.0.1-fff?style=for-the-badge&logo=pytest&logoColor=white
|
[pytest.org]: https://img.shields.io/badge/pytest-9.0.2-fff?style=for-the-badge&logo=pytest&logoColor=white
|
||||||
[pytest-url]: https://docs.pytest.org/en/9.0.x/
|
[pytest-url]: https://docs.pytest.org/en/9.0.x/
|
||||||
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.17.2-6BA81E?style=for-the-badge&logo=python&logoColor=white
|
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.17.2-6BA81E?style=for-the-badge&logo=python&logoColor=white
|
||||||
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
|
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
|
||||||
[rich.readthedocs.io]: https://img.shields.io/badge/rich-14.2.0-009485?style=for-the-badge&logo=rich&logoColor=white
|
[rich.readthedocs.io]: https://img.shields.io/badge/rich-14.2.0-009485?style=for-the-badge&logo=rich&logoColor=white
|
||||||
[rich-url]: https://rich.readthedocs.io/en/latest/
|
[rich-url]: https://rich.readthedocs.io/en/latest/
|
||||||
[redis.io]: https://img.shields.io/badge/redis-7.0.1-dc382d?style=for-the-badge&logo=redis&logoColor=white
|
[redis.io]: https://img.shields.io/badge/redis-7.1.0-dc382d?style=for-the-badge&logo=redis&logoColor=white
|
||||||
[redis-url]: https://redis.io/
|
[redis-url]: https://redis.io/
|
||||||
[structlog.org]: https://img.shields.io/badge/structlog-25.5.0-000000?style=for-the-badge&logo=python&logoColor=white
|
[structlog.org]: https://img.shields.io/badge/structlog-25.5.0-000000?style=for-the-badge&logo=python&logoColor=white
|
||||||
[structlog-url]: https://www.structlog.org/en/stable/
|
[structlog-url]: https://www.structlog.org/en/stable/
|
||||||
[rotoger]: https://img.shields.io/badge/rotoger-0.2.1-00bfff?style=for-the-badge&logo=python&logoColor=white
|
[rotoger]: https://img.shields.io/badge/rotoger-0.3.0-00bfff?style=for-the-badge&logo=python&logoColor=white
|
||||||
[rotoger-url]: https://github.com/tinyplugins/rotoger
|
[rotoger-url]: https://github.com/tinyplugins/rotoger
|
||||||
[granian]: https://img.shields.io/badge/granian-2.5.7-4f6cb4?style=for-the-badge&logo=rust&logoColor=white
|
[granian]: https://img.shields.io/badge/granian-2.6.0-4f6cb4?style=for-the-badge&logo=rust&logoColor=white
|
||||||
[granian-url]: https://github.com/emmett-framework/granian
|
[granian-url]: https://github.com/emmett-framework/granian
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "fastapi-sqlalchemy-asyncpg"
|
name = "fastapi-sqlalchemy-asyncpg"
|
||||||
version = "1.24.0"
|
version = "2.0.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."
|
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"
|
readme = "README.md"
|
||||||
requires-python = "==3.14.0"
|
requires-python = "==3.14.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastapi[all]==0.124.4",
|
"fastapi[all]==0.124.4",
|
||||||
"pydantic[email]==2.12.5",
|
"pydantic[email]==2.12.5",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
version = 1
|
version = 1
|
||||||
revision = 3
|
revision = 3
|
||||||
requires-python = "==3.14.0"
|
requires-python = "==3.14.4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "alembic"
|
name = "alembic"
|
||||||
@@ -377,7 +377,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastapi-sqlalchemy-asyncpg"
|
name = "fastapi-sqlalchemy-asyncpg"
|
||||||
version = "1.24.0"
|
version = "2.0.0"
|
||||||
source = { virtual = "." }
|
source = { virtual = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "alembic" },
|
{ name = "alembic" },
|
||||||
|
|||||||
Reference in New Issue
Block a user