| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- [project]
- name = "pbot"
- version = "0.1.0"
- description = "传奇996盒子纯协议机器人 — 分层技术框架(骨架)"
- readme = "README.md"
- requires-python = ">=3.12"
- dependencies = [
- "requests",
- "pycryptodome",
- "urllib3",
- "opencv-python-headless",
- "numpy",
- "curl_cffi",
- "scapy>=2.7.0",
- "protobuf>=7.36.2",
- "websocket-client>=1.9.2",
- ]
- [dependency-groups]
- dev = [
- "basedpyright>=1.21",
- "ruff>=0.8",
- "pytest>=8",
- ]
- [build-system]
- requires = ["hatchling"]
- build-backend = "hatchling.build"
- [tool.hatch.build.targets.wheel]
- packages = ["src/pbot"]
- # ─────────────────────────────────────────────────────────────────
- # basedpyright
- # ─────────────────────────────────────────────────────────────────
- [tool.basedpyright]
- typeCheckingMode = "all"
- pythonVersion = "3.12"
- pythonPlatform = "All"
- include = ["src", "tests"]
- exclude = ["**/__pycache__", "**/.venv", "**/build", "**/dist"]
- # 前序已验证: 协议头 Encode6BitBuf 编解码来自 backup/encode6bitbuf_final.py,
- # 迁移实现时以真实函数替换 stub, 不放宽检查。
- # ─────────────────────────────────────────────────────────────────
- # ruff
- # ─────────────────────────────────────────────────────────────────
- [tool.ruff]
- target-version = "py312"
- line-length = 100
- src = ["src", "tests"]
- exclude = ["vendor", "scripts"]
- [tool.ruff.lint]
- select = ["ALL"]
- ignore = [
- "COM812", # formatter conflict
- "ISC001", # formatter conflict
- "D203", # docstyle: prefer D211
- "D213", # docstyle: prefer D212
- "CPY001", # no copyright header
- "FBT001", # boolean flags ok in this codebase's CLI layer
- "FBT002",
- "TD002",
- "TD003",
- "FIX002",
- "D415", # 中文 docstring 首行允许以中文句号/无标点收尾
- "D104", # 包级 __init__ 已有 docstring, 但空命名空间包不强求
- "EM101", # 桩层 NotImplementedError 允许裸字符串(一次性提示)
- "PLC0415", # 测试内延迟 import 是分层验证手段
- "RUF002", # 中文注释里的全角标点为有意使用
- "PT018", # 复合断言在冒烟测试里可读性更好
- "PLR0913", # build_frame(msg_id, recog, p1, p2, p3, body) 为线上协议布局
- "PLR0917",
- "PLR2004", # 协议解析全是实测魔数(2048/0x800/65535...), 提常量反而丢上下文
- "FBT003", # zlib.decompress / random.choice 等位置布尔
- "C901", # WorldUpdater.apply 分发链协议分支多属常态
- "PLR0912",
- "PLR0915", # main() 全链路编排 + JWT 注入实验分支, 拆散反而丢流程视图
- "TRY003", # 错误 detail 已类型化在异常 dataclass 里
- ]
- [tool.ruff.lint.per-file-ignores]
- "tests/**/*.py" = [
- "S101",
- "ARG",
- "PLR2004",
- "SLF001",
- "D",
- ]
- [tool.ruff.lint.pydocstyle]
- convention = "google"
- [tool.ruff.format]
- quote-style = "double"
- indent-style = "space"
- # ─────────────────────────────────────────────────────────────────
- # pytest
- # ─────────────────────────────────────────────────────────────────
- [tool.pytest.ini_options]
- minversion = "8.0"
- testpaths = ["tests"]
- addopts = ["-ra", "--strict-config", "--strict-markers"]
|