Skip to content

Commit c37593a

Browse files
committed
feat: update dependencies for image processing and Redis support
1 parent d7e7512 commit c37593a

File tree

7 files changed

+587
-345
lines changed

7 files changed

+587
-345
lines changed

backend/app/api/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from fastapi import APIRouter
22

3-
from app.api.routes import items, login, private, users, utils
3+
from app.api.routes import images, items, login, private, users, utils
44
from app.core.config import settings
55

66
api_router = APIRouter()
77
api_router.include_router(login.router)
88
api_router.include_router(users.router)
99
api_router.include_router(utils.router)
1010
api_router.include_router(items.router)
11+
api_router.include_router(images.router)
1112

1213

1314
if settings.ENVIRONMENT == "local":

backend/app/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
import sentry_sdk
2+
from contextlib import asynccontextmanager
23
from fastapi import FastAPI
34
from fastapi.routing import APIRoute
45
from starlette.middleware.cors import CORSMiddleware
56

67
from app.api.main import api_router
78
from app.core.config import settings
9+
from app.services.image_worker import start_image_worker, stop_image_worker
810

911

1012
def custom_generate_unique_id(route: APIRoute) -> str:
1113
return f"{route.tags[0]}-{route.name}"
1214

1315

14-
if settings.SENTRY_DSN and settings.ENVIRONMENT != "local":
15-
sentry_sdk.init(dsn=str(settings.SENTRY_DSN), enable_tracing=True)
16+
@asynccontextmanager
17+
async def lifespan(app: FastAPI):
18+
# Start background workers
19+
await start_image_worker()
20+
yield
21+
# Stop background workers
22+
stop_image_worker()
23+
24+
25+
# if settings.SENTRY_DSN and settings.ENVIRONMENT != "local":
26+
# sentry_sdk.init(dsn=str(settings.SENTRY_DSN), enable_tracing=True)
1627

1728
app = FastAPI(
1829
title=settings.PROJECT_NAME,
1930
openapi_url=f"{settings.API_V1_STR}/openapi.json",
2031
generate_unique_id_function=custom_generate_unique_id,
32+
lifespan=lifespan,
2133
)
2234

2335
# Set all CORS enabled origins

backend/pyproject.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@ version = "0.1.0"
44
description = ""
55
requires-python = ">=3.10,<4.0"
66
dependencies = [
7-
"fastapi[standard]<1.0.0,>=0.114.2",
8-
"python-multipart<1.0.0,>=0.0.7",
9-
"email-validator<3.0.0.0,>=2.1.0.post1",
7+
"fastapi[standard]==0.109.2",
8+
"python-multipart==0.0.6",
9+
"email-validator<2.1,>=1.1.0",
1010
"passlib[bcrypt]<2.0.0,>=1.7.4",
1111
"tenacity<9.0.0,>=8.2.3",
1212
"pydantic>2.0",
1313
"emails<1.0,>=0.6",
1414
"jinja2<4.0.0,>=3.1.4",
1515
"alembic<2.0.0,>=1.12.1",
16-
"httpx<1.0.0,>=0.25.1",
16+
"httpx==0.24.1",
1717
"psycopg[binary]<4.0.0,>=3.1.13",
1818
"sqlmodel<1.0.0,>=0.0.21",
1919
# Pin bcrypt until passlib supports the latest
2020
"bcrypt==4.3.0",
2121
"pydantic-settings<3.0.0,>=2.2.1",
2222
"sentry-sdk[fastapi]<2.0.0,>=1.40.6",
2323
"pyjwt<3.0.0,>=2.8.0",
24+
"redis[hiredis]<6.0.0,>=5.0.0",
25+
# Image processing dependencies
26+
"boto3<2.0.0,>=1.28.0",
27+
"pillow<11.0.0,>=10.0.0",
28+
"aiofiles<24.0.0,>=23.0.0",
2429
]
2530

2631
[tool.uv]
@@ -31,6 +36,10 @@ dev-dependencies = [
3136
"pre-commit<4.0.0,>=3.6.2",
3237
"types-passlib<2.0.0.0,>=1.7.7.20240106",
3338
"coverage<8.0.0,>=7.4.3",
39+
# Image processing test dependencies
40+
"pytest-asyncio<1.0.0,>=0.21.0",
41+
"respx<1.0.0,>=0.20.0",
42+
"moto[s3]<5.0.0,>=4.0.0",
3443
]
3544

3645
[build-system]

backend/uv.lock

Lines changed: 507 additions & 322 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ services:
1515
- .env
1616
environment:
1717
- PGDATA=/var/lib/postgresql/data/pgdata
18-
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
19-
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
20-
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
18+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
19+
- POSTGRES_USER=${POSTGRES_USER}
20+
- POSTGRES_DB=${POSTGRES_DB}
2121

2222
adminer:
2323
image: adminer

frontend/package-lock.json

Lines changed: 39 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)