diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 382c8f2..c49c702 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ updates: - package-ecosystem: pip directory: / schedule: - interval: weekly + interval: monthly open-pull-requests-limit: 5 allow: - dependency-type: "all" @@ -17,9 +17,9 @@ updates: - package-ecosystem: github-actions directory: / schedule: - interval: weekly + interval: monthly - package-ecosystem: docker directory: / schedule: - interval: weekly + interval: monthly diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba62473..ba49978 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12.2" + python-version: "3.13.1" - name: Install Poetry uses: snok/install-poetry@v1 @@ -41,7 +41,7 @@ jobs: uses: actions/cache@v4 with: path: /opt/venv - key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }} + key: venv-${{ runner.os }}-python-3.13.1-${{ hashFiles('poetry.lock') }} - name: Install dependencies and actiavte virtualenv if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' diff --git a/.github/workflows/type_check.yml b/.github/workflows/type_check.yml index ffde1e6..32e664e 100644 --- a/.github/workflows/type_check.yml +++ b/.github/workflows/type_check.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12.2" + python-version: "3.13.1" - name: Install Poetry uses: snok/install-poetry@v1 @@ -39,7 +39,7 @@ jobs: uses: actions/cache@v4 with: path: /opt/venv - key: venv-${{ runner.os }}-python-3.12.2-${{ hashFiles('poetry.lock') }} + key: venv-${{ runner.os }}-python-3.13.1-${{ hashFiles('poetry.lock') }} - name: Install dependencies and actiavte virtualenv if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 919bdcd..a9c70c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,16 +1,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-yaml - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.0 + rev: v0.8.2 hooks: - id: ruff-format - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.0 + rev: v0.8.2 hooks: - id: ruff args: [--fix] diff --git a/Dockerfile b/Dockerfile index 5437327..8d38b42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim-bullseye as base +FROM python:3.13.1-slim-bookworm as base ENV PYTHONUNBUFFERED 1 WORKDIR /build diff --git a/README.md b/README.md index f1a6475..5a3d952 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Live example](https://img.shields.io/badge/live%20example-https%3A%2F%2Fminimal--fastapi--postgres--template.rafsaf.pl-blueviolet)](https://minimal-fastapi-postgres-template.rafsaf.pl/) [![License](https://img.shields.io/github/license/rafsaf/minimal-fastapi-postgres-template)](https://github.com/rafsaf/minimal-fastapi-postgres-template/blob/main/LICENSE) -[![Python 3.12](https://img.shields.io/badge/python-3.12-blue)](https://docs.python.org/3/whatsnew/3.12.html) +[![Python 3.13](https://img.shields.io/badge/python-3.13-blue)](https://docs.python.org/3/whatsnew/3.13.html) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Tests](https://github.com/rafsaf/minimal-fastapi-postgres-template/actions/workflows/tests.yml/badge.svg)](https://github.com/rafsaf/minimal-fastapi-postgres-template/actions/workflows/tests.yml) @@ -60,11 +60,11 @@ See [docs](https://docs.github.com/en/repositories/creating-and-managing-reposit ```bash cd your_project_name -### Poetry install (python3.12) +### Poetry install (python3.13) poetry install ``` -Note, be sure to use `python3.12` with this template with either poetry or standard venv & pip, if you need to stick to some earlier python version, you should adapt it yourself (remove new versions specific syntax for example `str | int` for python < 3.10) +Note, be sure to use `python3.13` with this template with either poetry or standard venv & pip, if you need to stick to some earlier python version, you should adapt it yourself (remove new versions specific syntax for example `str | int` for python < 3.10) ### 3. Setup database and migrations diff --git a/app/api/deps.py b/app/api/deps.py index c52c243..6b4b0f3 100644 --- a/app/api/deps.py +++ b/app/api/deps.py @@ -14,7 +14,7 @@ from app.models import User oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth/access-token") -async def get_session() -> AsyncGenerator[AsyncSession, None]: +async def get_session() -> AsyncGenerator[AsyncSession]: async with database_session.get_async_session() as session: yield session diff --git a/app/tests/conftest.py b/app/tests/conftest.py index fbbe8f9..b79d477 100644 --- a/app/tests/conftest.py +++ b/app/tests/conftest.py @@ -71,7 +71,7 @@ async def fixture_setup_new_test_database() -> None: @pytest_asyncio.fixture(scope="function", autouse=True) -async def fixture_clean_get_settings_between_tests() -> AsyncGenerator[None, None]: +async def fixture_clean_get_settings_between_tests() -> AsyncGenerator[None]: yield get_settings.cache_clear() @@ -85,7 +85,7 @@ async def fixture_default_hashed_password() -> str: @pytest_asyncio.fixture(name="session", scope="function") async def fixture_session_with_rollback( monkeypatch: pytest.MonkeyPatch, -) -> AsyncGenerator[AsyncSession, None]: +) -> AsyncGenerator[AsyncSession]: # we want to monkeypatch get_async_session with one bound to session # that we will always rollback on function scope @@ -108,8 +108,8 @@ async def fixture_session_with_rollback( @pytest_asyncio.fixture(name="client", scope="function") -async def fixture_client(session: AsyncSession) -> AsyncGenerator[AsyncClient, None]: - transport = ASGITransport(app=fastapi_app) # type: ignore +async def fixture_client(session: AsyncSession) -> AsyncGenerator[AsyncClient]: + transport = ASGITransport(app=fastapi_app) async with AsyncClient(transport=transport, base_url="http://test") as aclient: aclient.headers.update({"Host": "localhost"}) yield aclient