e29f27e2eb
通过 vitepress-openapi 插件,在 VitePress 文档中实现基于 openapi.json 的 API 文档。 这样实现的 API 文档可以从最新版本的代码库中提取路由信息,继而实现自动集成。 --- 同时,通过 Kimi 和 Deepseek 实现并审查了一个对 Google 风格 docstring 的解析函数。 该函数可以从 Google 风格的 docstring 中提取参数文档并按 openapi 规范重新整理它们。 --- 增加了 nyahome openapi 命令用来导出 openapi.json。 增加了 task openapi-docs 命令用来准备未来的持续集成。
116 lines
2.1 KiB
TOML
116 lines
2.1 KiB
TOML
[project]
|
|
name = "nyahome"
|
|
version = "0.1.0"
|
|
description = "Add your description here"
|
|
readme = "README.md"
|
|
requires-python = ">=3.13"
|
|
dependencies = [
|
|
"aiofiles>=25.1.0",
|
|
"aiosmtplib>=5.1.0",
|
|
"alembic>=1.18.4",
|
|
"argon2-cffi>=25.1.0",
|
|
"fastapi>=0.136.1",
|
|
"httpx>=0.28.1",
|
|
"jinja2>=3.1.6",
|
|
"openai>=2.38.0",
|
|
"passlib[bcrypt]>=1.7.4",
|
|
"pydantic>=2.13.4",
|
|
"python-jose[cryptography]>=3.5.0",
|
|
"python-multipart>=0.0.29",
|
|
"pyyaml>=6.0.3",
|
|
"rich>=15.0.0",
|
|
"sqlalchemy>=2.0.49",
|
|
"sqlmodel>=0.0.38",
|
|
"typer>=0.25.1",
|
|
"uvicorn>=0.47.0",
|
|
]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"docstring-parser>=0.18.0",
|
|
"mypy>=2.1.0",
|
|
"ruff>=0.15.14",
|
|
"taskipy>=1.14.1",
|
|
"types-aiofiles>=25.1.0.20260518",
|
|
"types-passlib>=1.7.7.20260211",
|
|
"types-python-jose>=3.5.0.20260408",
|
|
]
|
|
|
|
[project.scripts]
|
|
nyahome = "nyahome.manage:app"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.sdist]
|
|
artifacts = ["src/nyahome/static/**"]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/nyahome"]
|
|
artifacts = ["src/nyahome/static/**"]
|
|
|
|
[tool.ruff]
|
|
preview = true
|
|
line-length = 120
|
|
target-version = "py313"
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"A",
|
|
"B",
|
|
"C",
|
|
"E",
|
|
"F",
|
|
"E",
|
|
"Q",
|
|
"I",
|
|
"N",
|
|
"W",
|
|
"DOC",
|
|
"RSE",
|
|
"RET",
|
|
"FAST",
|
|
"YTT",
|
|
"ANN",
|
|
"ASYNC",
|
|
"COM",
|
|
"T20",
|
|
"SIM",
|
|
"PTH",
|
|
"FLY",
|
|
"RUF",
|
|
]
|
|
|
|
ignore = [
|
|
"PTH123",
|
|
"RUF001",
|
|
"RUF002",
|
|
"RUF003",
|
|
"RUF029",
|
|
"C90",
|
|
"COM812",
|
|
"E501",
|
|
]
|
|
|
|
fixable = ["ALL"]
|
|
|
|
[tool.mypy]
|
|
files = ["src"]
|
|
strict = true
|
|
warn_return_any = true
|
|
|
|
disable_error_code = ["list-item", "attr-defined", "type-arg"]
|
|
|
|
[tool.taskipy.tasks]
|
|
# 生成迁移
|
|
makemigrations = "alembic revision --autogenerate -m 'auto'"
|
|
# 执行迁移
|
|
migrate = "alembic upgrade head"
|
|
# 回滚
|
|
rollback = "alembic downgrade -1"
|
|
# 查看数据库版本
|
|
current = "alembic current"
|
|
# 为 docs 文档生成最新 openapi.json
|
|
openapi-docs = "nyahome openapi docs/.vitepress/theme/openapi.json"
|