From 2382289484fd3c20cfa80fd78c077fa066bef85f Mon Sep 17 00:00:00 2001 From: derekc Date: Tue, 27 Oct 2026 23:02:45 -0700 Subject: [PATCH] Major dependency upgrades: Python 3.14, FastAPI, SQLAlchemy 2.1, PyJWT, MySQL 8.4 - Python base image 3.12-slim -> 3.14-slim - fastapi 0.136.3 -> 0.162.0, sqlalchemy 2.0.50 -> 2.1.6 - Replace unmaintained python-jose with PyJWT 2.15.1; tokens issued by python-jose remain valid, so existing sessions are not logged out - MySQL 8.0.46 (EOL) -> 8.4.13 LTS; in-place data dictionary upgrade runs automatically on first start Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- backend/Dockerfile | 2 +- backend/auth.py | 7 ++++--- backend/requirements.txt | 6 +++--- docker-compose.yml | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 90f6aae..ff5fbcd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A self-hosted, multi-user web app for backyard chicken keepers to track egg prod |----------|-------------------------| | Frontend | Vanilla HTML/CSS/JS | | Backend | FastAPI (Python) | -| Database | MySQL 8.0 | +| Database | MySQL 8.4 LTS | | Server | Nginx (static + proxy) | | Runtime | Docker Compose | diff --git a/backend/Dockerfile b/backend/Dockerfile index 0f8124d..8827c20 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim +FROM python:3.14-slim WORKDIR /app diff --git a/backend/auth.py b/backend/auth.py index 9a68ca0..375ada3 100644 --- a/backend/auth.py +++ b/backend/auth.py @@ -3,7 +3,8 @@ from datetime import datetime, timedelta, timezone from typing import Optional import bcrypt -from jose import JWTError, jwt +import jwt +from jwt import InvalidTokenError from fastapi import Cookie, Depends, HTTPException, Response, status from sqlalchemy.orm import Session @@ -82,7 +83,7 @@ async def get_current_user( if user_id_str is None: raise credentials_exception user_id = int(user_id_str) - except (JWTError, ValueError): + except (InvalidTokenError, ValueError): raise credentials_exception user = db.get(User, user_id) @@ -110,7 +111,7 @@ async def get_token_payload( ) try: return jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM]) - except JWTError: + except InvalidTokenError: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", diff --git a/backend/requirements.txt b/backend/requirements.txt index 8c88c93..a5adb61 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,9 +1,9 @@ -fastapi==0.136.3 +fastapi==0.162.0 uvicorn==0.54.0 -sqlalchemy==2.0.50 +sqlalchemy==2.1.6 pymysql==1.2.3 cryptography==50.0.2 pydantic==2.14.1 -python-jose[cryptography]==3.5.0 +pyjwt==2.15.1 bcrypt==5.0.0 httpx==0.28.1 diff --git a/docker-compose.yml b/docker-compose.yml index 755bb29..13d8e7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: # MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD should each be 20+ random characters. # Generate with: openssl rand -hex 16 db: - image: mysql:8.0.46 + image: mysql:8.4.13 restart: unless-stopped deploy: resources: