Files
meijiaka-zy/python-api/pyproject.toml
T
小鱼开发 b597d715c8 fix: 认证流程修复 + alembic 迁移补全 + 前端僵尸代码清理
后端:
- 修复 get_current_user 未校验 is_active,被封禁用户仍可用旧 Token
- auth.py 捕获 ValueError 转 HTTPException(验证码错误、账号被封、Token 无效等不再返回 500)
- 修正 SMS 每日上限注释(3次 → 10次)
- 修复迁移脚本外键引用错误:users.id → mjk_users.id
- 新建积分系统 4 张表的迁移(mjk_user_points/batches/transactions/recharge_orders)
- pyproject.toml 补充 alembic + psycopg2-binary 依赖
- ruff 格式修复(import 排序等)

前端:
- 修复 doRefreshToken 成功后不持久化新 Token 的严重 bug
- 修复应用重启后 SSE 不自动重连(收不到踢人通知)
- 修复 App.tsx handleLogout 未 await
- client.ts 统一从 utils/env 导入 isTauri,默认 base URL 兜底 localhost:8000
- 清理 ~20 个未使用的 hooks/utils/api 模块/组件导出
- 修复所有 ESLint 警告(206 → 0)和 TSC 错误
- 测试通过(5/5)

其他:
- 更新 requirements.lock 和 uv.lock
2026-05-08 11:10:48 +08:00

132 lines
3.1 KiB
TOML

[project]
name = "meijiaka-ai-api"
version = "0.1.0"
description = "美家卡智影 - AI 视频创作后端 API"
authors = [{ name = "Meijiaka Team" }]
readme = "README.md"
requires-python = ">=3.13"
license = { text = "MIT" }
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
]
dependencies = [
# Web 框架 (FastAPI 0.116+ 修复 Starlette 安全漏洞)
"fastapi>=0.116.0",
"uvicorn[standard]~=0.32.0",
"python-multipart~=0.0.20",
# 认证 & 安全
"passlib[bcrypt]~=1.7.4",
"bcrypt~=4.2.0",
# 数据库
"sqlalchemy[asyncio]~=2.0.36",
"asyncpg~=0.30.0",
"psycopg2-binary~=2.9.10",
"alembic~=1.14.0",
# 缓存 & 任务队列
"redis~=5.2.0",
# 配置 & 验证
"pydantic~=2.9.0",
"pydantic-settings~=2.6.0",
# AI / LLM
"openai~=1.58.0",
# 重试 & 容错
"tenacity~=9.0.0",
# 火山方舟官方 SDK(可选,如不需要可注释掉)
"volcengine-python-sdk[ark]~=5.0.0",
# HTTP 客户端
"httpx~=0.28.0",
"aiohttp>=3.13.4", # 安全修复:修复 CVE-2025-XXXX 系列漏洞
# 对象存储
"qiniu~=7.13.0",
# 工具
"python-jose[cryptography]~=3.4.0",
"pyyaml~=6.0.2",
"orjson>=3.11.0", # 安全修复:修复 CVE-2025-XXXX
]
[project.optional-dependencies]
dev = [
"pytest~=8.3.0",
"pytest-asyncio~=0.24.0",
"pytest-cov~=6.0.0",
"ruff~=0.8.0",
"black~=24.10.0",
"mypy~=1.14.0",
"bandit[toml]~=1.8.0", # 安全扫描
"pip-audit~=2.7.0", # 漏洞检测
"pre-commit~=4.0.0", # Git 钩子
]
[project.scripts]
meijiaka-api = "app.main:main"
[tool.setuptools]
packages = ["app"]
[tool.black]
line-length = 100
target-version = ["py313"]
[tool.ruff]
line-length = 100
target-version = "py313"
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP", "B", "C4", "SIM"]
ignore = ["E501", "E402", "N802", "N803", "N806", "N815", "B008", "B904"]
[tool.mypy]
python_version = "3.13"
strict = false
warn_return_any = false
warn_unused_configs = true
ignore_missing_imports = true
# 逐步修复历史遗留问题
warn_no_return = false
check_untyped_defs = false
disallow_untyped_defs = false
disallow_incomplete_defs = false
# ========== 重构防护网:新代码严格模式 ==========
[[tool.mypy.overrides]]
module = ["app.schemas.*", "app.crud.*", "app.scheduler.handlers.*"]
strict = true
warn_return_any = true
check_untyped_defs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
# Redis 客户端 typing 问题(Awaitable[T] | T),暂不严格检查
[[tool.mypy.overrides]]
module = ["app.scheduler.registry", "app.scheduler.slot_manager"]
strict = false
check_untyped_defs = false
disallow_untyped_defs = false
[tool.pytest.ini_options]
asyncio_mode = "auto"
[tool.bandit]
exclude_dirs = ["tests", "scripts"]
skips = ["B101", "B104", "B105", "B106", "B107", "B301", "B403", "B404", "B603", "B607"]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]