chore: P1 工程化工具链

- pyproject.toml:pytest/black/isort/mypy 统一配置
- requirements-dev.txt:测试与代码规范开发依赖
- .flake8 / .editorconfig:PEP8 与编辑器统一
- .pre-commit-config.yaml:提交前钩子
- Makefile:常用命令集
- .env.example:环境变量模板(76 键)
- tests/:pytest 骨架 + R 响应格式冒烟测试

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DjangoAdmin Dev
2026-08-07 12:14:51 +08:00
co-authored by Claude
parent 15f2a5e097
commit 8691412ec6
12 changed files with 448 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
# ============================================================
# DjangoAdmin Flask+EleVue 项目管理配置
# ============================================================
# 说明:
# 1. 本项目为应用工程(非库),运行依赖由 requirements.txt 管理,
# 此处不重复声明(与既有部署约定保持一致)。
# 2. 本文件承载各开发工具(pytest/black/isort/mypy)统一配置。
[project]
name = "djangoadmin-flask-elevue"
version = "3.0.0"
description = "DjangoAdmin Flask+EleVue 企业数字化开发平台(后端)"
readme = "README.md"
requires-python = ">=3.9"
license = {text = "Apache-2.0"}
authors = [
{name = "一米阳光团队", email = "djangoadmin@126.com"},
]
dependencies = []
# ============================================================
# pytest
# ============================================================
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra --strict-markers"
python_files = ["test_*.py"]
filterwarnings = [
# 存量依赖(Flask-SQLAlchemy 3.x 等)DeprecationWarning 噪音较多,暂统一忽略
"ignore::DeprecationWarning",
]
# ============================================================
# black(代码格式化)
# ============================================================
[tool.black]
line-length = 120
target-version = ["py39", "py310", "py311", "py312"]
skip-string-normalization = false
# ============================================================
# isort(import 排序)
# ============================================================
[tool.isort]
profile = "black"
line_length = 120
skip_gitignore = true
known_first_party = ["application", "config", "extensions", "src", "utils"]
# ============================================================
# mypy(类型检查)
# ============================================================
[tool.mypy]
python_version = "3.9"
ignore_missing_imports = true
warn_unused_configs = true
exclude = ["migrations/", "ui/", "static/"]
# ============================================================
# coverage(pytest-cov)
# ============================================================
[tool.coverage.run]
omit = ["migrations/*", "ui/*", "static/*", "tests/*", "scripts/*"]