From 0a0334be8515b303defc0a3f4c9b34318adfd9c5 Mon Sep 17 00:00:00 2001 From: burny Date: Fri, 15 Sep 2023 05:02:22 +0200 Subject: [PATCH] Add another missing import annotations and drop python 3.9 --- .github/workflows/earthly_project_check.yml | 2 +- .github/workflows/test_fastapi_server.yml | 3 +-- Earthfile | 2 +- fastapi_server/Earthfile | 1 + fastapi_server/pyproject.toml | 7 +------ fastapi_server/routes/htmx_chat.py | 2 ++ fastapi_server/test/base_test.py | 4 +++- .../endpoints_test/replay_parser/test_replay_parser.py | 2 ++ 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/earthly_project_check.yml b/.github/workflows/earthly_project_check.yml index df8f62b0..3fbceb4c 100644 --- a/.github/workflows/earthly_project_check.yml +++ b/.github/workflows/earthly_project_check.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11'] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/test_fastapi_server.yml b/.github/workflows/test_fastapi_server.yml index b14c228d..a27dcfbc 100644 --- a/.github/workflows/test_fastapi_server.yml +++ b/.github/workflows/test_fastapi_server.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11'] runs-on: ${{ matrix.os }} steps: @@ -86,7 +86,6 @@ jobs: with: gh-token: ${{ secrets.GITHUB_TOKEN }} jobs: | - test_backend_py3.9 test_backend_py3.10 test_backend_py3.11 diff --git a/Earthfile b/Earthfile index 50216870..97675030 100644 --- a/Earthfile +++ b/Earthfile @@ -1,6 +1,6 @@ VERSION 0.6 ARG NODEVERSION=19 # 14, 16, 18, 19 -ARG PYTHONVERSION=3.11 # 3.8 to 3.11 +ARG PYTHONVERSION=3.11 # 3.10 to 3.11 ARG NIMVERSION=2.0.0 FROM alpine:3.15 # Is only used for formatting, so image can be as small as possible diff --git a/fastapi_server/Earthfile b/fastapi_server/Earthfile index 0e119b06..d643940d 100644 --- a/fastapi_server/Earthfile +++ b/fastapi_server/Earthfile @@ -20,6 +20,7 @@ install-dev: RUN poetry install COPY . /root/fastapi_server +# TODO Remove as svelte is no longer used install-integration: FROM nikolaik/python-nodejs:python${PYTHONVERSION}-nodejs${NODEVERSION}-slim WORKDIR /root/fastapi_server diff --git a/fastapi_server/pyproject.toml b/fastapi_server/pyproject.toml index ad4cc1fd..3484e7f0 100644 --- a/fastapi_server/pyproject.toml +++ b/fastapi_server/pyproject.toml @@ -65,7 +65,7 @@ dedent_closing_brackets = true allow_split_before_dict_value = false [tool.ruff] -target-version = 'py38' +target-version = 'py310' line-length = 120 # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" @@ -87,11 +87,6 @@ select = [ # "A", # flake8-builtins ] -[tool.ruff.pyupgrade] -# Preserve types, even if a file imports `from __future__ import annotations`. -# Remove once support for py3.8 and 3.9 is dropped -keep-runtime-typing = true - [tool.ruff.pep8-naming] # Allow Pydantic's `@validator` decorator to trigger class method treatment. classmethod-decorators = ["pydantic.validator", "classmethod"] diff --git a/fastapi_server/routes/htmx_chat.py b/fastapi_server/routes/htmx_chat.py index 4908d0a4..142377a7 100644 --- a/fastapi_server/routes/htmx_chat.py +++ b/fastapi_server/routes/htmx_chat.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import os from collections import OrderedDict from typing import Annotated diff --git a/fastapi_server/test/base_test.py b/fastapi_server/test/base_test.py index 11da9cda..1cb8dd87 100644 --- a/fastapi_server/test/base_test.py +++ b/fastapi_server/test/base_test.py @@ -1,5 +1,7 @@ +from __future__ import annotations + import contextlib -from typing import Generator +from collections.abc import Generator import pytest from fastapi.testclient import TestClient diff --git a/fastapi_server/test/endpoints_test/replay_parser/test_replay_parser.py b/fastapi_server/test/endpoints_test/replay_parser/test_replay_parser.py index 800b0756..d681bf36 100644 --- a/fastapi_server/test/endpoints_test/replay_parser/test_replay_parser.py +++ b/fastapi_server/test/endpoints_test/replay_parser/test_replay_parser.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from pathlib import Path from test.base_test import BaseTest