pyproject.toml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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-lsp-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. bottom-media-bot = "cool_bots.bottom_media_bot:main"
  42. audio-cleaner-bot = "cool_bots.audio_cleaner_bot:main"
  43. [tool.hatch.version]
  44. path = "src/cool_bots/__about__.py"
  45. [tool.hatch.envs.default]
  46. dependencies = [
  47. "coverage[toml]>=6.5",
  48. "pytest",
  49. ]
  50. [tool.hatch.envs.default.scripts]
  51. test = "pytest -p no:legacypath {args:tests}"
  52. test-cov = "coverage run -m pytest {args:tests}"
  53. cov-report = [
  54. "- coverage combine",
  55. "coverage report -m",
  56. ]
  57. cov = [
  58. "test-cov",
  59. "cov-report",
  60. ]
  61. checkall = [
  62. "cov",
  63. "hatch run lint:all"
  64. ]
  65. [tool.hatch.envs.lint]
  66. dependencies = [
  67. "black>=23.1.0",
  68. "mypy>=1.0.0",
  69. "ruff>=0.0.243",
  70. ]
  71. [tool.hatch.envs.lint.scripts]
  72. typing = "mypy --install-types --non-interactive {args:src/cool_bots tests}"
  73. style = [
  74. "ruff {args:src}",
  75. "black --check --diff {args:src}",
  76. ]
  77. fmt = [
  78. "black {args:src}",
  79. "ruff --fix {args:src}",
  80. "style",
  81. ]
  82. all = [
  83. "style",
  84. "typing",
  85. ]
  86. [tool.hatch.envs.docker]
  87. detached = true
  88. [tool.hatch.envs.docker.scripts]
  89. build = 'docker buildx build {args} -t "cool-bots" -f Dockerfile-dev .'
  90. 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}'
  91. dl-bot = 'env DOCKER_NAME="dl-bot" hatch run "${{HATCH_ENV_ACTIVE}}:shell" dl-bot -qvv --config {args}'
  92. [tool.black]
  93. target-version = ["py310"]
  94. line-length = 79
  95. skip-string-normalization = true
  96. [tool.ruff]
  97. target-version = "py310"
  98. line-length = 79
  99. select = [
  100. "A",
  101. "ARG",
  102. "B",
  103. "C",
  104. "DTZ",
  105. "E",
  106. "EM",
  107. "F",
  108. "FBT",
  109. "I",
  110. "ICN",
  111. "ISC",
  112. "N",
  113. "PLC",
  114. "PLE",
  115. "PLR",
  116. "PLW",
  117. "Q",
  118. "RUF",
  119. "S",
  120. "T",
  121. "TID",
  122. "UP",
  123. "W",
  124. "YTT",
  125. ]
  126. ignore = [
  127. # Allow non-abstract empty methods in abstract base classes
  128. "B027",
  129. # Allow boolean positional values in function calls, like `dict.get(... True)`
  130. "FBT003",
  131. # Ignore checks for possible passwords
  132. "S105", "S106", "S107",
  133. # Ignore complexity
  134. "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
  135. ]
  136. unfixable = [
  137. # Don't touch unused imports
  138. "F401",
  139. ]
  140. [tool.ruff.flake8-quotes]
  141. inline-quotes = "single"
  142. [tool.ruff.isort]
  143. known-first-party = ["cool_bots"]
  144. [tool.ruff.flake8-tidy-imports]
  145. ban-relative-imports = "all"
  146. [tool.ruff.per-file-ignores]
  147. # Tests can use magic values, assertions, and relative imports
  148. "tests/**/*" = ["PLR2004", "S101", "TID252"]
  149. [tool.coverage.run]
  150. source_pkgs = ["cool_bots", "tests"]
  151. branch = true
  152. parallel = true
  153. omit = [
  154. "src/cool_bots/__about__.py",
  155. "src/cool_bots/*_bot.py",
  156. "src/cool_bots/utils/tg_common.py",
  157. ]
  158. [tool.coverage.paths]
  159. cool_bots = ["src/cool_bots", "*/cool-bots/src/cool_bots"]
  160. tests = ["tests", "*/cool-bots/tests"]
  161. [tool.coverage.report]
  162. exclude_lines = [
  163. "no cov",
  164. "unreachable",
  165. ]
  166. exclude_also = [
  167. "def __repr__",
  168. "if self.debug:",
  169. "if settings.DEBUG",
  170. "raise AssertionError",
  171. "raise NotImplementedError",
  172. "if 0:",
  173. "if __name__ == .__main__.:",
  174. "if TYPE_CHECKING:",
  175. "class .*\\bProtocol\\):",
  176. "@(abc\\.)?abstractmethod",
  177. ]
  178. [tool.mypy]
  179. strict = true
  180. [tool.pylsp-mypy]
  181. enable = true
  182. live_mode = false
  183. [[tool.mypy.overrides]]
  184. module = "pyrogram.*"
  185. implicit_reexport = true