From 5b282b9ab4b61fbb8b112d051c73fd660f321056 Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Tue, 14 Jan 2025 11:27:10 +0000 Subject: [PATCH 1/4] ignore linter errors I'm pretty sure the type annotations on Starlette are wrong - passing a HTTPEndpoint in should be allowed. --- piccolo_admin/endpoints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/piccolo_admin/endpoints.py b/piccolo_admin/endpoints.py index f1872385..4608ed7c 100644 --- a/piccolo_admin/endpoints.py +++ b/piccolo_admin/endpoints.py @@ -680,7 +680,7 @@ def __init__( private_app.add_route( path="/change-password/", - route=change_password( + route=change_password( # type: ignore login_url="./../../public/login/", session_table=session_table, read_only=read_only, @@ -786,7 +786,7 @@ def __init__( public_app.add_route( path="/logout/", - route=session_logout(session_table=session_table), + route=session_logout(session_table=session_table), # type: ignore methods=["POST"], ) From fded0ad9f15a3ab238c3f9cdced23a2030e17e3f Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Tue, 14 Jan 2025 10:52:36 +0000 Subject: [PATCH 2/4] try older Ubuntu version for Playwright tests https://github.com/microsoft/playwright/issues/30368 --- .github/workflows/playwright.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yaml b/.github/workflows/playwright.yaml index 57fd8e3f..e6f17d85 100644 --- a/.github/workflows/playwright.yaml +++ b/.github/workflows/playwright.yaml @@ -9,7 +9,7 @@ on: jobs: playwright: name: "Playwright Tests" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: "Checkout repository" uses: "actions/checkout@v4" From 18b68bdc62b1c3bed407029d3c9873ba109d0416 Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Tue, 14 Jan 2025 11:15:20 +0000 Subject: [PATCH 3/4] remove fastapi version pin We need the latest version to get around a breaking change in Starlette's test client: https://github.com/encode/starlette/discussions/2770 --- requirements/test-requirements.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/requirements/test-requirements.txt b/requirements/test-requirements.txt index 3ce95ac8..d63cc378 100644 --- a/requirements/test-requirements.txt +++ b/requirements/test-requirements.txt @@ -4,9 +4,5 @@ flake8==7.0.0 piccolo[postgres,sqlite]>=1.16.0 playwright==1.41.2 pytest-playwright==0.4.4 -httpx>=0.20.0 -# This is needed because newer versions of FastAPI use a Starlette version with -# a `TestClient` which breaks rate limiting. -# The changes to `TestClient` will likely be reverted in a future release, in -# which case we can remove this version pin. -fastapi==0.106.0 +httpx==0.28.1 +fastapi==0.115.6 From ce69954dd48e5761e702d1ca9567ef679d62f046 Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Tue, 14 Jan 2025 11:01:45 +0000 Subject: [PATCH 4/4] fix linter errors --- piccolo_admin/endpoints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/piccolo_admin/endpoints.py b/piccolo_admin/endpoints.py index 4608ed7c..6405a070 100644 --- a/piccolo_admin/endpoints.py +++ b/piccolo_admin/endpoints.py @@ -100,13 +100,13 @@ class GroupItem(BaseModel): class GroupedTableNamesResponseModel(BaseModel): - grouped: t.Dict[str, t.List[str]] = Field(default_factory=list) + grouped: t.Dict[str, t.List[str]] = Field(default_factory=dict) ungrouped: t.List[str] = Field(default_factory=list) class GroupedFormsResponseModel(BaseModel): grouped: t.Dict[str, t.List[FormConfigResponseModel]] = Field( - default_factory=list + default_factory=dict ) ungrouped: t.List[FormConfigResponseModel] = Field(default_factory=list)