pyproject.toml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. [project]
  2. name = "pbot"
  3. version = "0.1.0"
  4. description = "传奇996盒子纯协议机器人 — 分层技术框架(骨架)"
  5. readme = "README.md"
  6. requires-python = ">=3.12"
  7. dependencies = [
  8. "requests",
  9. "pycryptodome",
  10. "urllib3",
  11. "opencv-python-headless",
  12. "numpy",
  13. "curl_cffi",
  14. "scapy>=2.7.0",
  15. "protobuf>=7.36.2",
  16. "websocket-client>=1.9.2",
  17. ]
  18. [dependency-groups]
  19. dev = [
  20. "basedpyright>=1.21",
  21. "ruff>=0.8",
  22. "pytest>=8",
  23. ]
  24. [build-system]
  25. requires = ["hatchling"]
  26. build-backend = "hatchling.build"
  27. [tool.hatch.build.targets.wheel]
  28. packages = ["src/pbot"]
  29. # ─────────────────────────────────────────────────────────────────
  30. # basedpyright
  31. # ─────────────────────────────────────────────────────────────────
  32. [tool.basedpyright]
  33. typeCheckingMode = "all"
  34. pythonVersion = "3.12"
  35. pythonPlatform = "All"
  36. include = ["src", "tests"]
  37. exclude = ["**/__pycache__", "**/.venv", "**/build", "**/dist"]
  38. # 前序已验证: 协议头 Encode6BitBuf 编解码来自 backup/encode6bitbuf_final.py,
  39. # 迁移实现时以真实函数替换 stub, 不放宽检查。
  40. # ─────────────────────────────────────────────────────────────────
  41. # ruff
  42. # ─────────────────────────────────────────────────────────────────
  43. [tool.ruff]
  44. target-version = "py312"
  45. line-length = 100
  46. src = ["src", "tests"]
  47. exclude = ["vendor", "scripts"]
  48. [tool.ruff.lint]
  49. select = ["ALL"]
  50. ignore = [
  51. "COM812", # formatter conflict
  52. "ISC001", # formatter conflict
  53. "D203", # docstyle: prefer D211
  54. "D213", # docstyle: prefer D212
  55. "CPY001", # no copyright header
  56. "FBT001", # boolean flags ok in this codebase's CLI layer
  57. "FBT002",
  58. "TD002",
  59. "TD003",
  60. "FIX002",
  61. "D415", # 中文 docstring 首行允许以中文句号/无标点收尾
  62. "D104", # 包级 __init__ 已有 docstring, 但空命名空间包不强求
  63. "EM101", # 桩层 NotImplementedError 允许裸字符串(一次性提示)
  64. "PLC0415", # 测试内延迟 import 是分层验证手段
  65. "RUF002", # 中文注释里的全角标点为有意使用
  66. "PT018", # 复合断言在冒烟测试里可读性更好
  67. "PLR0913", # build_frame(msg_id, recog, p1, p2, p3, body) 为线上协议布局
  68. "PLR0917",
  69. "PLR2004", # 协议解析全是实测魔数(2048/0x800/65535...), 提常量反而丢上下文
  70. "FBT003", # zlib.decompress / random.choice 等位置布尔
  71. "C901", # WorldUpdater.apply 分发链协议分支多属常态
  72. "PLR0912",
  73. "PLR0915", # main() 全链路编排 + JWT 注入实验分支, 拆散反而丢流程视图
  74. "TRY003", # 错误 detail 已类型化在异常 dataclass 里
  75. ]
  76. [tool.ruff.lint.per-file-ignores]
  77. "tests/**/*.py" = [
  78. "S101",
  79. "ARG",
  80. "PLR2004",
  81. "SLF001",
  82. "D",
  83. ]
  84. [tool.ruff.lint.pydocstyle]
  85. convention = "google"
  86. [tool.ruff.format]
  87. quote-style = "double"
  88. indent-style = "space"
  89. # ─────────────────────────────────────────────────────────────────
  90. # pytest
  91. # ─────────────────────────────────────────────────────────────────
  92. [tool.pytest.ini_options]
  93. minversion = "8.0"
  94. testpaths = ["tests"]
  95. addopts = ["-ra", "--strict-config", "--strict-markers"]