pyproject.toml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. [build-system]
  2. requires = ["hatchling"]
  3. build-backend = "hatchling.build"
  4. [project]
  5. name = "cool-bots"
  6. dynamic = ["version"]
  7. description = ''
  8. readme = "README.md"
  9. requires-python = ">=3.10"
  10. license = "GPL-3.0-or-later"
  11. authors = [
  12. { name = "dm9pZCAq", email = "v@0x0c.link" }
  13. ]
  14. classifiers = [
  15. "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
  16. "Operating System :: OS Independent",
  17. "Programming Language :: Python",
  18. "Programming Language :: Python :: 3.10",
  19. "Programming Language :: Python :: 3.11",
  20. "Programming Language :: Python :: Implementation :: CPython",
  21. "Programming Language :: Python :: Implementation :: PyPy",
  22. ]
  23. dependencies = [
  24. "pyrogram",
  25. "tgcrypto",
  26. "uvloop",
  27. "tomli >= 1.1.0 ; python_version < '3.11'",
  28. "simple-parsing",
  29. "yt-dlp",
  30. ]
  31. [project.optional-dependencies]
  32. dev = [
  33. "python-language-server",
  34. "pylsp-mypy",
  35. "python-lsp-ruff",
  36. "pylsp-rope",
  37. ]
  38. [project.scripts]
  39. dl-bot = "cool_bots.dl_bot:main"
  40. video-note-bot = "cool_bots.video_note_bot:main"
  41. audio-cleaner-bot = "cool_bots.audio_cleaner_bot:main"
  42. [tool.hatch.version]
  43. path = "src/cool_bots/__about__.py"
  44. [tool.hatch.envs.default]
  45. dependencies = [
  46. "coverage[toml]>=6.5",
  47. "pytest",
  48. ]
  49. [tool.hatch.envs.default.scripts]
  50. test = "pytest -p no:legacypath {args:tests}"
  51. test-cov = "coverage run -m pytest {args:tests}"
  52. cov-report = [
  53. "- coverage combine",
  54. "coverage report -m",
  55. ]
  56. cov = [
  57. "test-cov",
  58. "cov-report",
  59. ]
  60. checkall = [
  61. "cov",
  62. "hatch run lint:all"
  63. ]
  64. [tool.hatch.envs.lint]
  65. dependencies = [
  66. "black>=23.1.0",
  67. "mypy>=1.0.0",
  68. "ruff>=0.0.243",
  69. ]
  70. [tool.hatch.envs.lint.scripts]
  71. typing = "mypy --install-types --non-interactive {args:src/cool_bots tests}"
  72. style = [
  73. "ruff {args:src}",
  74. "black --check --diff {args:src}",
  75. ]
  76. fmt = [
  77. "black {args:src}",
  78. "ruff --fix {args:src}",
  79. "style",
  80. ]
  81. all = [
  82. "style",
  83. "typing",
  84. ]
  85. [tool.hatch.envs.docker]
  86. detached = true
  87. [tool.hatch.envs.docker.scripts]
  88. build = 'docker buildx build {args} -t "cool-bots" -f Dockerfile-dev .'
  89. shell = 'docker run --network=host --tmpfs=/tmp -v "$(pwd):/cool-bots" --rm -it --name="${{DOCKER_NAME:-cool-bots}}" "cool-bots" /cool-bots/run-in-docker {args}'
  90. dl-bot = 'env DOCKER_NAME="dl-bot" hatch run "${{HATCH_ENV_ACTIVE}}:shell" dl-bot -qvv --config {args}'
  91. [tool.black]
  92. target-version = ["py310"]
  93. line-length = 79
  94. skip-string-normalization = true
  95. [tool.ruff]
  96. target-version = "py310"
  97. line-length = 79
  98. select = [
  99. "A",
  100. "ARG",
  101. "B",
  102. "C",
  103. "DTZ",
  104. "E",
  105. "EM",
  106. "F",
  107. "FBT",
  108. "I",
  109. "ICN",
  110. "ISC",
  111. "N",
  112. "PLC",
  113. "PLE",
  114. "PLR",
  115. "PLW",
  116. "Q",
  117. "RUF",
  118. "S",
  119. "T",
  120. "TID",
  121. "UP",
  122. "W",
  123. "YTT",
  124. ]
  125. ignore = [
  126. # Allow non-abstract empty methods in abstract base classes
  127. "B027",
  128. # Allow boolean positional values in function calls, like `dict.get(... True)`
  129. "FBT003",
  130. # Ignore checks for possible passwords
  131. "S105", "S106", "S107",
  132. # Ignore complexity
  133. "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
  134. ]
  135. unfixable = [
  136. # Don't touch unused imports
  137. "F401",
  138. ]
  139. [tool.ruff.flake8-quotes]
  140. inline-quotes = "single"
  141. [tool.ruff.isort]
  142. known-first-party = ["cool_bots"]
  143. [tool.ruff.flake8-tidy-imports]
  144. ban-relative-imports = "all"
  145. [tool.ruff.per-file-ignores]
  146. # Tests can use magic values, assertions, and relative imports
  147. "tests/**/*" = ["PLR2004", "S101", "TID252"]
  148. [tool.coverage.run]
  149. source_pkgs = ["cool_bots", "tests"]
  150. branch = true
  151. parallel = true
  152. omit = [
  153. "src/cool_bots/__about__.py",
  154. "src/cool_bots/*_bot.py",
  155. "src/cool_bots/utils/tg_common.py",
  156. ]
  157. [tool.coverage.paths]
  158. cool_bots = ["src/cool_bots", "*/cool-bots/src/cool_bots"]
  159. tests = ["tests", "*/cool-bots/tests"]
  160. [tool.coverage.report]
  161. exclude_lines = [
  162. "no cov",
  163. "unreachable",
  164. ]
  165. exclude_also = [
  166. "def __repr__",
  167. "if self.debug:",
  168. "if settings.DEBUG",
  169. "raise AssertionError",
  170. "raise NotImplementedError",
  171. "if 0:",
  172. "if __name__ == .__main__.:",
  173. "if TYPE_CHECKING:",
  174. "class .*\\bProtocol\\):",
  175. "@(abc\\.)?abstractmethod",
  176. ]
  177. [tool.mypy]
  178. strict = true
  179. [tool.pylsp-mypy]
  180. enable = true
  181. live_mode = false
  182. [[tool.mypy.overrides]]
  183. module = "pyrogram.*"
  184. implicit_reexport = true