Skip to content

Commit 16433b6

Browse files
authored
Merge pull request #44 from testdrivenio/updates
updates
2 parents 13cff42 + 315e351 commit 16433b6

File tree

14 files changed

+44
-60
lines changed

14 files changed

+44
-60
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
-p 5003:8765 \
8484
${{ env.IMAGE }}-final:latest
8585
- name: Install requirements
86-
run: docker exec fastapi-tdd pip install black==23.12.1 flake8==7.0.0 isort==5.13.2 pytest==7.4.4
86+
run: docker exec fastapi-tdd python3 -m pip install black==25.1.0 flake8==7.2.0 isort==6.0.1 pytest==8.3.5
8787
- name: Pytest
8888
run: docker exec fastapi-tdd python -m pytest .
8989
- name: Flake8
@@ -98,7 +98,7 @@ jobs:
9898
runs-on: ubuntu-latest
9999
needs: [build, test]
100100
env:
101-
HEROKU_APP_NAME: quiet-citadel-80656
101+
HEROKU_APP_NAME: shrouded-shelf-89730
102102
HEROKU_REGISTRY_IMAGE: registry.heroku.com/${HEROKU_APP_NAME}/summarizer
103103
steps:
104104
- name: Checkout

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42

53
web:

project/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM python:3.12.1-slim-bookworm
2+
FROM python:3.13.3-slim-bookworm
33

44
# set working directory
55
WORKDIR /usr/src/app

project/Dockerfile.prod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
###########
44

55
# pull official base image
6-
FROM python:3.12.1-slim-bookworm as builder
6+
FROM python:3.13.3-slim-bookworm as builder
77

88
# install system dependencies
99
RUN apt-get update \
@@ -24,7 +24,7 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requir
2424

2525
# lint
2626
COPY . /usr/src/app/
27-
RUN pip install black==23.12.1 flake8==7.0.0 isort==5.13.2
27+
RUN pip install black==25.1.0 flake8==7.2.0 isort==6.0.1
2828
RUN flake8 .
2929
RUN black --exclude=migrations . --check
3030
RUN isort . --check-only
@@ -35,7 +35,7 @@ RUN isort . --check-only
3535
#########
3636

3737
# pull official base image
38-
FROM python:3.12.1-slim-bookworm
38+
FROM python:3.13.3-slim-bookworm
3939

4040
# create directory for the app user
4141
RUN mkdir -p /home/app
@@ -65,7 +65,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
6565
COPY --from=builder /usr/src/app/requirements.txt .
6666
RUN pip install --upgrade pip
6767
RUN pip install --no-cache /wheels/*
68-
RUN pip install "uvicorn[standard]==0.26.0"
68+
RUN pip install "uvicorn[standard]==0.34.1"
6969

7070
# add app
7171
COPY . .

project/app/api/crud.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from typing import List, Union
22

3-
from app.models.pydantic import SummaryPayloadSchema
43
from app.models.tortoise import TextSummary
54

5+
from app.models.pydantic import ( # isort:skip
6+
SummaryPayloadSchema,
7+
SummaryUpdatePayloadSchema,
8+
)
9+
610

711
async def get(id: int) -> Union[dict, None]:
812
summary = await TextSummary.filter(id=id).first().values()
@@ -22,7 +26,7 @@ async def post(payload: SummaryPayloadSchema) -> int:
2226
return summary.id
2327

2428

25-
async def put(id: int, payload: SummaryPayloadSchema) -> Union[dict, None]:
29+
async def put(id: int, payload: SummaryUpdatePayloadSchema) -> Union[dict, None]:
2630
summary = await TextSummary.filter(id=id).update(
2731
url=payload.url, summary=payload.summary
2832
)

project/app/main.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,4 @@ def create_application() -> FastAPI:
2020

2121
app = create_application()
2222

23-
24-
@app.on_event("startup")
25-
async def startup_event():
26-
log.info("Starting up...")
27-
init_db(app)
28-
29-
30-
@app.on_event("shutdown")
31-
async def shutdown_event():
32-
log.info("Shutting down...")
23+
init_db(app)

project/app/summarizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ async def generate_summary(summary_id: int, url: str) -> None:
1010
article.parse()
1111

1212
try:
13-
nltk.data.find("tokenizers/punkt")
13+
nltk.data.find("tokenizers/punkt_tab")
1414
except LookupError:
15-
nltk.download("punkt")
15+
nltk.download("punkt_tab")
1616
finally:
1717
article.nlp()
1818

project/db/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM postgres:16
2+
FROM postgres:17
33

44
# run create.sql on init
55
ADD create.sql /docker-entrypoint-initdb.d

project/migrations/models/0_20240122171233_init.py renamed to project/migrations/models/0_20250421234125_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ async def upgrade(db: BaseDBAsyncClient) -> str:
77
"id" SERIAL NOT NULL PRIMARY KEY,
88
"url" TEXT NOT NULL,
99
"summary" TEXT NOT NULL,
10-
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
10+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
1111
);
1212
CREATE TABLE IF NOT EXISTS "aerich" (
1313
"id" SERIAL NOT NULL PRIMARY KEY,

project/requirements-dev.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
black==23.12.1
2-
flake8==7.0.0
3-
isort==5.13.2
4-
pytest==7.4.4
5-
pytest-cov==4.1.0
6-
pytest-xdist==3.5.0
1+
black==25.1.0
2+
flake8==7.2.0
3+
isort==6.0.1
4+
pytest==8.3.5
5+
pytest-cov==6.1.1
6+
pytest-xdist==3.6.1
77

88
-r requirements.txt

0 commit comments

Comments
 (0)