This repository has been archived on 2026-10-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
NeteaseUrl/pyproject.toml
T
snowy-yang 8803444755 feat: 后端接线上 React 构建产物,legacy 模板降级为兜底
为什么:前端迁移到 Vite 后,首页应直接返回 frontend/dist/index.html
字节(golden 口径随之变为构建产物原样字节),仅当 dist 未构建时
回退 Jinja2 渲染的 legacy 模板。同步挂载 /assets 静态目录、排除
frontend 的 node_modules/tsbuildinfo 入库、docker 构建只带 dist
不带源码、ruff/pyright 排除 frontend 目录(TS 侧由 tsc+vite 把关)。
2026-09-27 18:35:04 +08:00

115 lines
4.4 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
[project]
name = "yunmusic-assistant"
version = "3.0.0"
description = "云村小助手 · 网易云音乐解析/下载服务(FastAPI + asyncio + aiohttp)"
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.115,<1.0",
"uvicorn[standard]>=0.30,<1.0",
"aiohttp>=3.10,<4.0",
"aiosqlite>=0.20,<1.0",
"aiofiles>=24.1",
"itsdangerous>=2.2,<3.0",
"cryptography>=50.0,<51.0",
"qrcode>=7.0,<8.3",
"python-multipart>=0.0.9",
"jinja2>=3.1,<4.0",
"filetype>=1.2.0",
"aria2p>=0.12.1",
"mutagen>=1.48.1",
]
[dependency-groups]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24",
"ruff>=0.6",
"pyright>=1.1.390",
"httpx>=0.27",
"httpx2>=2.13.1",
]
# 应用工程(非库):不把自身装进环境,避免 uv 扫描顶层模块
[tool.uv]
package = false
# ============ Ruff:静态检查 + 导入排序 + 格式化 ============
[tool.ruff]
target-version = "py312"
line-length = 120
extend-exclude = [".venv", ".zcode", "templates", "static", "frontend", "data"]
[tool.ruff.lint]
# E/F 基础错误、I 导入排序、B bugbear、UP 升级、C4 推导式、ASYNC 异步陷阱、S 安全、RUF
select = ["E", "F", "W", "I", "B", "UP", "C4", "ASYNC", "S", "RUF"]
ignore = [
"E501", # 行宽交给 formatter,不强制
"S101", # 生产代码外的 assert(测试/断言脚本)
"S104", # 绑定 0.0.0.0(服务端有意为之)
"S110", # try/except/pass(本项目「失败静默降级」策略)
"S112", # try/except/continue
"S324", # hashlib.md5 用于非安全场景(上游签名口径)
"S603", "S607", # subprocess(打包/运维脚本)
"UP009", # 保留 `# -*- coding: utf-8 -*-` 文件头(全项目既有约定)
"RUF001", "RUF002", "RUF003", # 全角字符(中文注释/文案,误报)
# ---- 以下为「有意保留」,已被逐条论证为协议/设计约束,非待修缺陷 ----
"RUF012", # 常量类可变默认值:APIConstants/PodcastConstants 是常量表,非实例状态
"S305", # AES-ECB:网易云 weapi 协议**要求**的加密模式,非可自由选择
"S311", # randrange:生成上游 requestId(协议随机数),非安全用途
"ASYNC250", # input():music_api.qr_client 交互式 CLI 的人类输入,异步化无意义
"S310", # urllib:仅用于音频 Range 代理的 URL 校验路径
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["S", "ASYNC"]
".zcode/**" = ["S", "ASYNC", "F"]
# ASYNC109:timeout 参数是有意 API——直接转发给 aiohttp 的 ClientTimeout,
# 不是「用 sleep 当超时」的反模式。
"core/http_client.py" = ["ASYNC109"]
"core/aiohttp_compat.py" = ["ASYNC109"]
[tool.ruff.lint.isort]
known-first-party = ["core", "web", "services", "music_api", "auth_system", "music_downloader"]
[tool.ruff.format]
quote-style = "preserve"
# ============ Pyright:类型检查 ============
[tool.pyright]
# 全量纳入(Flask 巨石删除后不再有例外清单)
# 顶层模块与 tests 此前不在名单里——「pyright 0 错误」只覆盖了 core/web/services,
# 而 requests→sync_http 迁移的遗留恰好全部躲在漏检的顶层模块中,故补齐。
include = [
"core",
"web",
"services",
"tests",
"music_api",
"auth_system",
"music_downloader",
"_mkpkg.py",
]
exclude = [".venv", ".zcode", "data", "downloads", "templates", "static", "frontend"]
venvPath = "."
venv = ".venv"
pythonVersion = "3.12"
typeCheckingMode = "standard"
reportMissingImports = true
# standard 比 basic 多出「变量可能未绑定 / 实参类型不符 / 无意义重定义 / 未使用符号」
# 等**可执行缺陷**(basic 全部漏报,实测 standard 多报 7 处真实缺陷),
# 故作为门禁级别;strict 的 reportUnknown* 需要给全部第三方库补存根,暂不启用。
# 以下三项在 standard 下已由类型系统覆盖,降为 warning 以避免第三方存根不全的噪声
reportOptionalMemberAccess = "warning"
reportAttributeAccessIssue = "warning"
# ============ Pytest ============
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = "-q"
# 本工程不装进环境(package = false),且 tests/ 无 __init__.py,
# 故必须显式把项目根加入 import 路径——否则裸跑 `pytest` 时
# `import core` 必然 ModuleNotFoundError(只有 `python -m pytest` 才碰巧能用)。
pythonpath = ["."]