chore: modernize dependencies (Flask 2.x, redis 4/5) and Docker base to Python 3.11 - #230
Merged
Merged
Conversation
- requirements: move to Flask 2.x and drop the ancient itsdangerous==0.24 / MarkupSafe<2.1 pins that blocked installs on Python 3.10+; bump redis to 4/5, aiohttp>=3.9, lxml<6, gevent<25; add explicit Werkzeug<3 bound - Dockerfile: base image python:3.7-alpine (EOL) -> python:3.11-slim so gevent/lxml/aiohttp install from wheels instead of compiling under musl, fixing common build failures and enabling arm64 (e.g. Raspberry Pi) Refs #167, #183, #192, #178, #149, #158
This was referenced Jul 4, 2026
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Issue 收敛计划 Phase 2(依赖与运行环境现代化)。目标:让项目在现代 Python 上能正常安装运行,同时保持行为不变(稳妥升级:Flask 2.x + redis 4/5 + Python 3.11)。
问题
requirements.txt里itsdangerous==0.24(2014 年)、MarkupSafe<2.1、Flask<2.0三者绑死,在 Python 3.10+ 上直接装不上,是大量「安装报错」类 issue 的根因。Dockerfile基于 python:3.7-alpine(3.7 已 EOL)。alpine + musl 需要现场编译gevent/lxml/aiohttp,慢且易失败,ARM(树莓派)尤甚。改动
requirements.txt
Flask升到>=2.0,<3.0,并显式约束Werkzeug>=2.0,<3.0;移除itsdangerous==0.24、MarkupSafe<2.1(由 Flask 2.x 自动解析正确版本)。redis>=4.3,<6(代码已有IS_REDIS_VERSION_2兼容分支,redis-py 4/5 的zadd(mapping)/zincrby(amount, value)签名完全兼容)。aiohttp>=3.9、lxml<6、gevent<25、environs<12、attrs<24,均放宽到支持 3.11/3.12 的版本。Dockerfile
python:3.7-alpine→python:3.11-slim。Debian 有gevent/lxml/aiohttp的 manylinux wheel,安装从「现场编译」变为「直接装 wheel」,更快更稳,并原生支持 arm64。验证
pip install --dry-run -r requirements.txt解析成功、无冲突:代码走查确认未使用 Flask 2.x 已移除的 API。
关联 issue