From c37d89fa67680c7b874c479cffd54025c5644f6b Mon Sep 17 00:00:00 2001 From: grillazz Date: Sun, 15 May 2022 13:58:16 +0200 Subject: [PATCH 1/4] python 3.10 improvements --- the_app/api/stuff.py | 4 +--- the_app/config.py | 2 +- the_app/models/__init__.py | 2 +- the_app/utils.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/the_app/api/stuff.py b/the_app/api/stuff.py index e1f57a7..93b8acf 100644 --- a/the_app/api/stuff.py +++ b/the_app/api/stuff.py @@ -1,5 +1,3 @@ -from typing import List - from fastapi import APIRouter, Depends, HTTPException, status from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.asyncio import AsyncSession @@ -15,7 +13,7 @@ logger = get_logger(__name__) @router.post("/add_many", status_code=status.HTTP_201_CREATED) -async def create_multi_stuff(payload: List[StuffSchema], db_session: AsyncSession = Depends(get_db)): +async def create_multi_stuff(payload: list[StuffSchema], db_session: AsyncSession = Depends(get_db)): try: stuff_instances = [Stuff(name=stuf.name, description=stuf.description) for stuf in payload] db_session.add_all(stuff_instances) diff --git a/the_app/config.py b/the_app/config.py index efab465..116b3b4 100644 --- a/the_app/config.py +++ b/the_app/config.py @@ -38,7 +38,7 @@ class Settings(BaseSettings): jwt_access_toke_expire_minutes: int = os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", 1) -@lru_cache() +@lru_cache def get_settings(): logger.info("Loading config settings from the environment...") return Settings() diff --git a/the_app/models/__init__.py b/the_app/models/__init__.py index 63287f6..abb31f4 100644 --- a/the_app/models/__init__.py +++ b/the_app/models/__init__.py @@ -1,3 +1,3 @@ from the_app.models.nonsense import Nonsense # noqa -from the_app.models.stuff import Stuff # noqa from the_app.models.shakespeare import Character # noqa +from the_app.models.stuff import Stuff # noqa diff --git a/the_app/utils.py b/the_app/utils.py index d2f9f52..6c1ba75 100644 --- a/the_app/utils.py +++ b/the_app/utils.py @@ -7,7 +7,7 @@ from rich.logging import RichHandler console = Console(color_system="256", width=200, style="blue") -@lru_cache() +@lru_cache def get_logger(module_name): logger = logging.getLogger(module_name) handler = RichHandler(rich_tracebacks=True, console=console, tracebacks_show_locals=True) From 96f41a0b5c8f4c6c87ae0cf5ab0a8db861e3f4f1 Mon Sep 17 00:00:00 2001 From: grillazz Date: Sun, 15 May 2022 14:01:05 +0200 Subject: [PATCH 2/4] python 3.10 improvements --- the_app/config.py | 2 +- the_app/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/the_app/config.py b/the_app/config.py index 116b3b4..efab465 100644 --- a/the_app/config.py +++ b/the_app/config.py @@ -38,7 +38,7 @@ class Settings(BaseSettings): jwt_access_toke_expire_minutes: int = os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", 1) -@lru_cache +@lru_cache() def get_settings(): logger.info("Loading config settings from the environment...") return Settings() diff --git a/the_app/utils.py b/the_app/utils.py index 6c1ba75..d2f9f52 100644 --- a/the_app/utils.py +++ b/the_app/utils.py @@ -7,7 +7,7 @@ from rich.logging import RichHandler console = Console(color_system="256", width=200, style="blue") -@lru_cache +@lru_cache() def get_logger(module_name): logger = logging.getLogger(module_name) handler = RichHandler(rich_tracebacks=True, console=console, tracebacks_show_locals=True) From fca0606fb5ea4b027345497d85212a11799147b3 Mon Sep 17 00:00:00 2001 From: grillazz Date: Sun, 15 May 2022 14:03:21 +0200 Subject: [PATCH 3/4] python 3.10 improvements --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a446f09..a5d9eb7 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11"] fail-fast: false services: From 7bec2ea2ecdb59be9d866b97245dc3aeb4c3e7ad Mon Sep 17 00:00:00 2001 From: grillazz Date: Sun, 15 May 2022 14:05:43 +0200 Subject: [PATCH 4/4] update postgresql to version 14 --- .github/workflows/build-and-test.yml | 4 ++-- db/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a5d9eb7..c3d77d6 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10"] fail-fast: false services: sqldb: - image: postgres:13 + image: postgres:14 env: POSTGRES_USER: user POSTGRES_PASSWORD: secret diff --git a/db/Dockerfile b/db/Dockerfile index 6d3c800..d2223b8 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM postgres:13-alpine +FROM postgres:14-alpine # run create.sql on init ADD create.sql /docker-entrypoint-initdb.d