From 0ed30d38597676909a8e0da3cae5911d0f7241de Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:02:25 +0100 Subject: [PATCH 01/12] Upgrade aiohttp --- frameworks/Python/aiohttp/requirements.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index 444a284f816..43442b08882 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -1,9 +1,8 @@ -aiohttp==3.10.2 -asyncpg==0.25.0 -cchardet==2.1.7 -gunicorn==20.1 +aiohttp==3.10.10 +asyncpg==0.30.0 +gunicorn==23.0.0 jinja2==3.1.4 -psycopg2==2.9.2 -SQLAlchemy==1.4.29 -ujson==5.4.0 -uvloop==0.16 +psycopg2==3.2.3 +SQLAlchemy==2.0.36 +ujson==5.10.0 +uvloop==0.21.0 From 5228f7e4f282330475ea5aa9e01a50a6832858f3 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:07:45 +0100 Subject: [PATCH 02/12] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index b817ec61264..cc51093e0bb 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -1,10 +1,10 @@ -FROM python:3.8 +FROM python:3.13 ADD ./ /aiohttp WORKDIR aiohttp -RUN pip3 install cython==0.29.23 && \ +RUN pip3 install cython==3.0.11 && \ pip3 install -r /aiohttp/requirements.txt WORKDIR /aiohttp From 08e9ddbce979057bb6465afcd0f8772f26c0aa56 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:08:05 +0100 Subject: [PATCH 03/12] Update aiohttp-pg-raw.dockerfile --- frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile index ddcb349006a..13bf04ac4fb 100644 --- a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile @@ -4,7 +4,7 @@ ADD ./ /aiohttp WORKDIR aiohttp -RUN pip3 install cython==0.29.23 && \ +RUN pip3 install cython==3.0.11 && \ pip3 install -r /aiohttp/requirements.txt ENV CONNECTION=RAW From 3ed5ad1f4c509bd4ee9e24194fe7904c43e35b7a Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:08:16 +0100 Subject: [PATCH 04/12] Update aiohttp-pg-raw.dockerfile --- frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile index 13bf04ac4fb..3e9139df3b9 100644 --- a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8 +FROM python:3.13 ADD ./ /aiohttp From a5e8ca2c0b6876c9afaed5bcaa137ff4dca2f6d6 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:14:51 +0100 Subject: [PATCH 05/12] Update main.py --- frameworks/Python/aiohttp/app/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/Python/aiohttp/app/main.py b/frameworks/Python/aiohttp/app/main.py index 087bd39f56d..4887a194739 100644 --- a/frameworks/Python/aiohttp/app/main.py +++ b/frameworks/Python/aiohttp/app/main.py @@ -4,8 +4,7 @@ import asyncpg from aiohttp import web from sqlalchemy.engine.url import URL -from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine -from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine from .views import ( json, @@ -48,15 +47,17 @@ async def db_ctx(app: web.Application): print(f'connection pool: min size: {min_size}, max size: {max_size}, orm: {CONNECTION_ORM}') if CONNECTION_ORM: dsn = pg_dsn('asyncpg') - engine = create_async_engine(dsn, future=True, pool_size=max_size) - app['db_session'] = sessionmaker(engine, class_=AsyncSession) + engine = create_async_engine(dsn, pool_size=max_size) + app['db_session'] = async_sessionmaker(engine) else: dsn = pg_dsn() app['pg'] = await asyncpg.create_pool(dsn=dsn, min_size=min_size, max_size=max_size, loop=app.loop) yield - if not CONNECTION_ORM: + if CONNECTION_ORM: + await app['db_session'].dispose() + else: await app['pg'].close() From bf3b64a15a529ddd9ca576d73f3b133fceca6437 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:19:54 +0100 Subject: [PATCH 06/12] Update models.py --- frameworks/Python/aiohttp/app/models.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frameworks/Python/aiohttp/app/models.py b/frameworks/Python/aiohttp/app/models.py index 69f9f3858a1..a8b09a354fb 100644 --- a/frameworks/Python/aiohttp/app/models.py +++ b/frameworks/Python/aiohttp/app/models.py @@ -1,20 +1,20 @@ -from sqlalchemy import Column, Integer, String -from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import DeclarativeBase, Mapped -Base = declarative_base() +class Base(DeclarativeBase): + """Base for models.""" class World(Base): __tablename__ = 'world' - id = Column(Integer, primary_key=True) - randomnumber = Column(Integer) + id: Mapped[int] = mapped_column(primary_key=True) + randomnumber: Mapped[int] sa_worlds = World.__table__ class Fortune(Base): __tablename__ = 'fortune' - id = Column(Integer, primary_key=True) - message = Column(String) + id: Mapped[int] = mapped_column(primary_key=True) + message: Mapped[str] sa_fortunes = Fortune.__table__ From 4ab07f32fe2e6ee14c5cd3a489289d7659dc02d6 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:34:27 +0100 Subject: [PATCH 07/12] Update frameworks/Python/aiohttp/requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index 43442b08882..b58e83c3698 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -2,7 +2,7 @@ aiohttp==3.10.10 asyncpg==0.30.0 gunicorn==23.0.0 jinja2==3.1.4 -psycopg2==3.2.3 +psycopg2==2.9.10 SQLAlchemy==2.0.36 ujson==5.10.0 uvloop==0.21.0 From 831595daaa4bf6af097a1f41d61c3244b0f047a1 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 13:39:01 +0100 Subject: [PATCH 08/12] Update models.py --- frameworks/Python/aiohttp/app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/app/models.py b/frameworks/Python/aiohttp/app/models.py index a8b09a354fb..c614124cbe4 100644 --- a/frameworks/Python/aiohttp/app/models.py +++ b/frameworks/Python/aiohttp/app/models.py @@ -1,4 +1,4 @@ -from sqlalchemy.orm import DeclarativeBase, Mapped +from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column class Base(DeclarativeBase): """Base for models.""" From 58be08c25ba486efd90c1a4c8ae30fdfbb76d76d Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 14:01:41 +0100 Subject: [PATCH 09/12] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index cc51093e0bb..fe1648e3ff4 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -11,4 +11,4 @@ WORKDIR /aiohttp EXPOSE 8080 -CMD gunicorn app.gunicorn:app -c gunicorn_conf.py +CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py From c0303c33607b73ef6daf1b14cbf5ece7a63224e7 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 22 Oct 2024 14:02:05 +0100 Subject: [PATCH 10/12] Update aiohttp-pg-raw.dockerfile --- frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile index 3e9139df3b9..f6dda6f5ef5 100644 --- a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile @@ -11,4 +11,4 @@ ENV CONNECTION=RAW EXPOSE 8080 -CMD gunicorn app.gunicorn:app -c gunicorn_conf.py +CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py From f770061d906049f9d2551a50239256f43b10dbba Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 2 Dec 2024 00:34:50 +0000 Subject: [PATCH 11/12] Update requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index b58e83c3698..c4c10b2b024 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.10.10 +aiohttp==3.11.9 asyncpg==0.30.0 gunicorn==23.0.0 jinja2==3.1.4 From 1beae77c8272ec937ce3ad1a6959582198925552 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sat, 11 Jan 2025 23:15:28 +0000 Subject: [PATCH 12/12] Update requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index c4c10b2b024..1a462ba28fc 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -1,8 +1,8 @@ -aiohttp==3.11.9 +aiohttp==3.11.11 asyncpg==0.30.0 gunicorn==23.0.0 -jinja2==3.1.4 +jinja2==3.1.5 psycopg2==2.9.10 -SQLAlchemy==2.0.36 +SQLAlchemy==2.0.37 ujson==5.10.0 uvloop==0.21.0