123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- [build-system]
- requires = ["hatchling"]
- build-backend = "hatchling.build"
- [project]
- name = "cool-bots"
- dynamic = ["version"]
- description = ''
- readme = "README.md"
- requires-python = ">=3.10"
- license = "GPL-3.0-or-later"
- authors = [
- { name = "dm9pZCAq", email = "v@0x0c.link" }
- ]
- classifiers = [
- "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
- "Operating System :: OS Independent",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
- ]
- dependencies = [
- "pyrogram",
- "tgcrypto",
- "uvloop",
- "tomli >= 1.1.0 ; python_version < '3.11'",
- "simple-parsing",
- "yt-dlp",
- ]
- [project.optional-dependencies]
- dev = [
- "python-lsp-server",
- "pylsp-mypy",
- "python-lsp-ruff",
- "pylsp-rope",
- ]
- [project.scripts]
- dl-bot = "cool_bots.dl_bot:main"
- video-note-bot = "cool_bots.video_note_bot:main"
- bottom-media-bot = "cool_bots.bottom_media_bot:main"
- audio-cleaner-bot = "cool_bots.audio_cleaner_bot:main"
- [tool.hatch.version]
- path = "src/cool_bots/__about__.py"
- [tool.hatch.envs.default]
- dependencies = [
- "coverage[toml]>=6.5",
- "pytest",
- ]
- [tool.hatch.envs.default.scripts]
- test = "pytest -p no:legacypath {args:tests}"
- test-cov = "coverage run -m pytest {args:tests}"
- cov-report = [
- "- coverage combine",
- "coverage report -m",
- ]
- cov = [
- "test-cov",
- "cov-report",
- ]
- checkall = [
- "cov",
- "hatch run lint:all"
- ]
- [tool.hatch.envs.lint]
- dependencies = [
- "black>=23.1.0",
- "mypy>=1.0.0",
- "ruff>=0.0.243",
- ]
- [tool.hatch.envs.lint.scripts]
- typing = "mypy --install-types --non-interactive {args:src/cool_bots tests}"
- style = [
- "ruff {args:src}",
- "black --check --diff {args:src}",
- ]
- fmt = [
- "black {args:src}",
- "ruff --fix {args:src}",
- "style",
- ]
- all = [
- "style",
- "typing",
- ]
- [tool.hatch.envs.docker]
- detached = true
- [tool.hatch.envs.docker.scripts]
- build = 'docker buildx build {args} -t "cool-bots" -f Dockerfile-dev .'
- 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}'
- dl-bot = 'env DOCKER_NAME="dl-bot" hatch run "${{HATCH_ENV_ACTIVE}}:shell" dl-bot -qvv --config {args}'
- [tool.black]
- target-version = ["py310"]
- line-length = 79
- skip-string-normalization = true
- [tool.ruff]
- target-version = "py310"
- line-length = 79
- select = [
- "A",
- "ARG",
- "B",
- "C",
- "DTZ",
- "E",
- "EM",
- "F",
- "FBT",
- "I",
- "ICN",
- "ISC",
- "N",
- "PLC",
- "PLE",
- "PLR",
- "PLW",
- "Q",
- "RUF",
- "S",
- "T",
- "TID",
- "UP",
- "W",
- "YTT",
- ]
- ignore = [
- # Allow non-abstract empty methods in abstract base classes
- "B027",
- # Allow boolean positional values in function calls, like `dict.get(... True)`
- "FBT003",
- # Ignore checks for possible passwords
- "S105", "S106", "S107",
- # Ignore complexity
- "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
- ]
- unfixable = [
- # Don't touch unused imports
- "F401",
- ]
- [tool.ruff.flake8-quotes]
- inline-quotes = "single"
- [tool.ruff.isort]
- known-first-party = ["cool_bots"]
- [tool.ruff.flake8-tidy-imports]
- ban-relative-imports = "all"
- [tool.ruff.per-file-ignores]
- # Tests can use magic values, assertions, and relative imports
- "tests/**/*" = ["PLR2004", "S101", "TID252"]
- [tool.coverage.run]
- source_pkgs = ["cool_bots", "tests"]
- branch = true
- parallel = true
- omit = [
- "src/cool_bots/__about__.py",
- "src/cool_bots/*_bot.py",
- "src/cool_bots/utils/tg_common.py",
- ]
- [tool.coverage.paths]
- cool_bots = ["src/cool_bots", "*/cool-bots/src/cool_bots"]
- tests = ["tests", "*/cool-bots/tests"]
- [tool.coverage.report]
- exclude_lines = [
- "no cov",
- "unreachable",
- ]
- exclude_also = [
- "def __repr__",
- "if self.debug:",
- "if settings.DEBUG",
- "raise AssertionError",
- "raise NotImplementedError",
- "if 0:",
- "if __name__ == .__main__.:",
- "if TYPE_CHECKING:",
- "class .*\\bProtocol\\):",
- "@(abc\\.)?abstractmethod",
- ]
- [tool.mypy]
- strict = true
- [tool.pylsp-mypy]
- enable = true
- live_mode = false
- [[tool.mypy.overrides]]
- module = "pyrogram.*"
- implicit_reexport = true
|