mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 13:05:18 +00:00
此提交包含多项核心优化: 1. 依赖库升级:更新FastAPI、替换fastapi-limiter为slowapi,更换MySQL驱动为aiomysql,重构缓存系统使用fastapi-cache2-fork 2. 代码重构:移除自定义缓存工具,统一使用fastapi-cache2;重构请求限流逻辑,修复操作日志记录开关逻辑 3. 接口规范:统一将Depends分页/查询参数改为Query注解,补全File上传依赖注解 4. 前端优化:调整登录滑块进度条颜色、移除冗余demo页面样式类 5. 日志优化:重构日志配置,使用time.perf_counter替代time.time统计耗时 6. 测试优化:移除冗余的限流mock配置,改用官方限流方案 7. 模板优化:更新vue代码生成模板,移除冗余导入并优化组件使用 8. 导入功能优化:移除pandas依赖,使用Excel工具类重构文件导入逻辑
138 lines
5.1 KiB
TOML
138 lines
5.1 KiB
TOML
[project]
|
||
name = "backend"
|
||
version = "2.0.0"
|
||
description = "fastapiadmin后端工程"
|
||
readme = "README.md"
|
||
requires-python = ">=3.12"
|
||
dependencies = [
|
||
"agno==2.5.8",
|
||
"aiofiles==24.1.0", # 文件操作
|
||
"aiosmtplib>=3.0.2", # 异步 SMTP 邮件发送(fastapi-mail 要求 >=3.0.2)
|
||
"aiosqlite==0.22.1", # sqlite 异步操作数据库
|
||
"alembic==1.18.4", # 数据库迁移
|
||
"apscheduler==3.11.0", # 定时任务
|
||
"aiomysql>=0.2.0", # mysql 异步操作数据库:基于 pymysql,社区成熟稳定
|
||
"asyncpg==0.31.0", # postgresql 异步操作数据库
|
||
"bleach==6.4.0", # 过滤 HTML 标签
|
||
"click==8.1.7", # 命令行参数解析
|
||
"croniter>=1.0.12,<5.0.0", # cron 表达式解析
|
||
"cryptography==49.0.0", # mysql8 密码加密
|
||
"fastapi==0.138.2", # fastapi 框架
|
||
"slowapi>=0.1.9", # 接口限流
|
||
"greenlet==3.5.2", # 协程核心依赖(SQLAlchemy 异步)
|
||
"httpx==0.28.1", # HTTP 客户端
|
||
"jinja2==3.1.6", # 模板引擎
|
||
"loguru==0.7.3", # 日志
|
||
"openai==2.28.0", # OpenAI API 客户端
|
||
"openpyxl==3.1.5", # Excel 文件处理
|
||
"pillow==12.2.0", # 图片处理
|
||
"psutil==7.2.2", # 系统信息
|
||
"psycopg[binary]==3.3.2", # postgresql 同步驱动(含预编译 libpq,开箱即用)
|
||
"pydantic-settings>=2.6.1", # 配置设置(fastapi-mail 要求 >=2.6.1)
|
||
"pyjwt==2.13.0", # OAuth2
|
||
"pymysql==1.2.0", # mysql 同步步操作数据库基于 pymysql:aiomysql 是 pymysql 的异步版本,pymysql 是一个纯 Python 实现的 MySQL 客户端。成熟度:aiomysql 相对较为成熟,社区支持较好,文档也比较完善。
|
||
"python-multipart==0.0.32", # request.form() 对表单进行「解析」时安装
|
||
"redis==7.1.0", # redis 同/异步操作数据库(用户celery配套使用)redis 异步操作数据库 redis已经完全具备了aioredis的功能,无需重复安全,且aioredis已经不再维护也不兼容3.10+的版本
|
||
"rich==15.0.0", # 终端打印美化
|
||
"sqlalchemy==2.0.51", # 数据库ORM
|
||
"sqlglot[rs]==27.8.0", # sql 解析
|
||
"typer==0.26.7", # 命令行工具
|
||
"ua-parser==1.0.2", # 解析 User-Agent 获取 OS/浏览器
|
||
"uvicorn==0.49.0", # uvicorn web 框架
|
||
"websockets>=16.0,<17.0", # websocket 通信
|
||
"fastapi-mail==1.5.1", # 邮件发送(简化 EmailSendService 底层)
|
||
"tinycss2==1.5.1",
|
||
"weasyprint==69.0",
|
||
"fastapi-cache2-fork[redis]>=2.3.0",
|
||
]
|
||
|
||
[dependency-groups]
|
||
dev = [
|
||
"fakeredis>=2.21.0,<3", # 测试:内存 Redis,配合 TESTING
|
||
"pytest==9.0.2",
|
||
"pytest-asyncio>=0.24.0", # 异步测试支持
|
||
"ruff==0.14.13", # 代码检查/格式化
|
||
]
|
||
|
||
[tool.uv]
|
||
default-groups = ["dev"] # 本地 uv sync 含 dev;生产 pip -r requirements.txt 不含 pytest/ruff/fakeredis
|
||
|
||
[[tool.uv.index]]
|
||
name = "tuna"
|
||
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
||
|
||
[tool.ruff]
|
||
line-length = 200
|
||
indent-width = 4
|
||
preview = false
|
||
fix = true
|
||
show-fixes = true
|
||
exclude = [
|
||
".bzr",
|
||
".direnv",
|
||
".eggs",
|
||
".git",
|
||
".git-rewrite",
|
||
".hg",
|
||
".ipynb_checkpoints",
|
||
".mypy_cache",
|
||
".nox",
|
||
".pants.d",
|
||
".pyenv",
|
||
".pytest_cache",
|
||
".pytype",
|
||
".ruff_cache",
|
||
".svn",
|
||
".tox",
|
||
".venv",
|
||
".vscode",
|
||
"__pypackages__",
|
||
"_build",
|
||
"buck-out",
|
||
"build",
|
||
"dist",
|
||
"node_modules",
|
||
"site-packages",
|
||
"venv",
|
||
]
|
||
extend-include = ["*.pyw"]
|
||
|
||
[tool.ruff.lint]
|
||
select = [
|
||
"FAST",
|
||
"F",
|
||
"E",
|
||
"W",
|
||
"F",
|
||
"I",
|
||
"B",
|
||
"C4",
|
||
"UP",
|
||
]
|
||
ignore = [
|
||
"E501", # line too long, handled by black
|
||
"B008", # do not perform function calls in argument defaults
|
||
"C901", # too complex
|
||
"W191", # indentation contains tabs
|
||
"B904", # Within an `except` clause
|
||
"B010", # Do not call with a constant attribute value.
|
||
"B009", # Do not use getattr() with a constant attribute value.
|
||
"E712", # Avoid equality comparisons to `False`; use `not getattr(self.model, "is_deleted"):` for false checks
|
||
"W293", # blank line with whitespace
|
||
]
|
||
|
||
[tool.ruff.lint.per-file-ignores]
|
||
"tests/conftest.py" = ["E402"] # 先设置 TESTING/SQLite 环境再 import 应用
|
||
|
||
[tool.ruff.format]
|
||
docstring-code-format = true
|
||
preview = false
|
||
quote-style = "double"
|
||
indent-style = "space"
|
||
skip-magic-trailing-comma = false
|
||
line-ending = "auto"
|
||
|
||
[tool.pytest.ini_options]
|
||
asyncio_mode = "auto"
|
||
asyncio_default_fixture_loop_scope = "function"
|