Skip to content

switch to python3.13 and update packages #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 6, 2024
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
8 changes: 3 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
interval: monthly
open-pull-requests-limit: 5
allow:
- dependency-type: "all"
groups:
all-dependencies:
patterns:
- "*"
exclude-patterns:
- "pytest-asyncio"

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
interval: monthly

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
interval: monthly
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
- "**"
tags-ignore:
- "*.*"
pull_request:
types: [opened, reopened]

jobs:
tests:
Expand All @@ -29,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
Expand All @@ -43,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'
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/type_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
- "**"
tags-ignore:
- "*.*"
pull_request:
types: [opened, reopened]

jobs:
type_check:
Expand All @@ -21,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
Expand All @@ -41,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'
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.5-slim-bullseye as base
FROM python:3.13.1-slim-bookworm as base

ENV PYTHONUNBUFFERED 1
WORKDIR /build
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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

Expand Down
10 changes: 5 additions & 5 deletions app/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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()
Expand All @@ -90,7 +90,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

Expand All @@ -114,8 +114,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
Expand All @@ -124,7 +124,7 @@ async def fixture_client(session: AsyncSession) -> AsyncGenerator[AsyncClient, N
@pytest_asyncio.fixture(name="default_user", scope="function")
async def fixture_default_user(
session: AsyncSession, default_hashed_password: str
) -> AsyncGenerator[User, None]:
) -> AsyncGenerator[User]:
default_user = User(
user_id=default_user_id,
email=default_user_email,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
services:
postgres_db:
restart: unless-stopped
image: postgres:16
image: postgres:17
volumes:
- postgres_db:/var/lib/postgresql/data
environment:
Expand Down
Loading
Loading